Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Build docs
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
inputs:
python-version:
required: true
type: string

jobs:
build:
build-docs:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand All @@ -16,6 +17,7 @@ jobs:
environment-file: ./environment-dev.yml
init-shell: bash
create-args: --verbose
python=${{ inputs.python-version }}
cache-environment: true
cache-downloads: false

Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/build-ultraplot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
inputs:
python-version:
required: true
type: string

jobs:
build:
build-ultraplot:
name: Test Python ${{ inputs.python-version }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand All @@ -15,7 +17,9 @@ jobs:
with:
environment-file: ./environment-dev.yml
init-shell: bash
create-args: --verbose
create-args: >-
--verbose
python=${{ inputs.python-version }}
cache-environment: true
cache-downloads: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [main]

jobs:
build:
linter:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Matrix Test
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
get-python-versions:
runs-on: ubuntu-latest
outputs:
python-versions: ${{ steps.set-versions.outputs.python-versions }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install dependencies
run: pip install tomli

- id: set-versions
run: |
# Save the Python script to a file
cat > get_versions.py << 'EOF'
import tomli
import re
import json

with open("pyproject.toml", "rb") as f:
data = tomli.load(f)
python_req = data["project"]["requires-python"]
min_version = re.search(r">=(\d+\.\d+)", python_req)
max_version = re.search(r"<(\d+\.\d+)", python_req)

versions = []
if min_version and max_version:
min_v = tuple(map(int, min_version.group(1).split(".")))
max_v = tuple(map(int, max_version.group(1).split(".")))
current = min_v
while current < max_v:
versions.append(".".join(map(str, current)))
current = (current[0], current[1] + 1)

print(json.dumps(versions))
EOF

# Run the Python script and capture output
VERSIONS=$(python3 get_versions.py)
echo "python-versions=${VERSIONS}" >> $GITHUB_OUTPUT

build-test:
needs: get-python-versions
strategy:
matrix:
python-version: ${{ fromJson(needs.get-python-versions.outputs.python-versions) }}
uses: ./.github/workflows/build-ultraplot.yml
with:
python-version: ${{ matrix.python-version }}

build-docs:
needs: get-python-versions
strategy:
matrix:
python-version: ${{ fromJson(needs.get-python-versions.outputs.python-versions) }}
uses: ./.github/workflows/build-docs.yml
with:
python-version: ${{ matrix.python-version }}
Loading