Skip to content
Merged
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: 9 additions & 3 deletions .github/workflows/build-ultraplot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ on:
python-version:
required: true
type: string
locale:
matplotlib-version:
required: true
type: string

env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8

jobs:
build-ultraplot:
name: Test Python ${{ inputs.python-version }}
name: Test Python ${{ inputs.python-version }} with ${{ inputs.matplotlib-version }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand All @@ -23,6 +27,7 @@ jobs:
create-args: >-
--verbose
python=${{ inputs.python-version }}
matplotlib=${{ inputs.matplotlib-version }}
cache-environment: true
cache-downloads: false

Expand Down Expand Up @@ -50,6 +55,7 @@ jobs:
create-args: >-
--verbose
python=${{ inputs.python-version }}
matplotlib=${{ inputs.matplotlib-version }}
cache-environment: true
cache-downloads: false

Expand Down Expand Up @@ -79,5 +85,5 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: failed-comparisons-${{ inputs.python-version }}-${{ inputs.locale }}
name: failed-comparisons-${{ inputs.python-version }}-${{ inputs.matplotlib-version }}
path: results/*
69 changes: 57 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ on:
branches: [main, devel]

jobs:
get-python-versions:
get-versions:
runs-on: ubuntu-latest
outputs:
python-versions: ${{ steps.set-versions.outputs.python-versions }}
matplotlib-versions: ${{ steps.set-versions.outputs.matplotlib-versions }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -38,7 +39,7 @@ jobs:
min_version = re.search(r">=(\d+\.\d+)", python_req)
max_version = re.search(r"<(\d+\.\d+)", python_req)

versions = []
python_versions = []
if min_version and max_version:
# Convert version strings to tuples
min_v = tuple(map(int, min_version.group(1).split(".")))
Expand All @@ -47,26 +48,70 @@ jobs:
# Generate version list
current = min_v
while current < max_v:
versions.append(".".join(map(str, current)))
python_versions.append(".".join(map(str, current)))
current = (current[0], current[1] + 1)

# Print as JSON array
print(json.dumps(versions))

# parse MPL versions
mpl_req = None
for d in data["project"]["dependencies"]:
if d.startswith("matplotlib"):
mpl_req = d
break
assert mpl_req is not None, "matplotlib version not found in dependencies"
min_version = re.search(r">=(\d+\.\d+)", mpl_req)
max_version = re.search(r"<(\d+\.\d+)", mpl_req)

mpl_versions = []
if min_version and max_version:
# Convert version strings to tuples
min_v = tuple(map(int, min_version.group(1).split(".")))
max_v = tuple(map(int, max_version.group(1).split(".")))

# Generate version list
current = min_v
while current < max_v:
mpl_versions.append(".".join(map(str, current)))
current = (current[0], current[1] + 1)

# If no versions found, default to 3.9
if not mpl_versions:
mpl_versions = ["3.9"]

# Create output dictionary
output = {
"python_versions": python_versions,
"matplotlib_versions": mpl_versions
}

# Print as JSON
print(json.dumps(output))
EOF

# Run the script and capture output
VERSIONS=$(python3 get_versions.py)
echo "Detected versions: ${VERSIONS}" # Debug output
echo "python-versions=${VERSIONS}" >> $GITHUB_OUTPUT
OUTPUT=$(python3 get_versions.py)
PYTHON_VERSIONS=$(echo $OUTPUT | jq -r '.python_versions')
MPL_VERSIONS=$(echo $OUTPUT | jq -r '.matplotlib_versions')

echo "Detected Python versions: ${PYTHON_VERSIONS}"
echo "Detected Matplotlib versions: ${MPL_VERSIONS}"
echo "python-versions=$(echo $PYTHON_VERSIONS | jq -c)" >> $GITHUB_OUTPUT
echo "matplotlib-versions=$(echo $MPL_VERSIONS | jq -c)" >> $GITHUB_OUTPUT

build:
needs: get-python-versions
needs: get-versions
strategy:
matrix:
python-version: ${{ fromJson(needs.get-python-versions.outputs.python-versions) }}
locale: ["en_US.UTF-8", "C.UTF-8"]
python-version: ${{ fromJson(needs.get-versions.outputs.python-versions) }}
matplotlib-version: ${{ fromJson(needs.get-versions.outputs.matplotlib-versions) }}
fail-fast: false
uses: ./.github/workflows/build-ultraplot.yml
with:
python-version: ${{ matrix.python-version }}
locale: ${{ matrix.locale }}
matplotlib-version: ${{ matrix.matplotlib-version }}

build-success:
needs: build
runs-on: ubuntu-latest
steps:
- run: echo "All tests passed successfully!"
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Framework :: Matplotlib :: 3.9",
# "Framework :: Matplotlib :: 3.10" # add when basemap is updated
]
dependencies= [
"numpy>=1.26.0",
"matplotlib>=3.9"
"matplotlib>=3.9,<3.10" # bump to 3.11 when basemap is updated
]
dynamic = ["version"]

Expand Down