diff --git a/.github/workflows/build-ultraplot.yml b/.github/workflows/build-ultraplot.yml index 8746dda49..ec69464a6 100644 --- a/.github/workflows/build-ultraplot.yml +++ b/.github/workflows/build-ultraplot.yml @@ -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: @@ -23,6 +27,7 @@ jobs: create-args: >- --verbose python=${{ inputs.python-version }} + matplotlib=${{ inputs.matplotlib-version }} cache-environment: true cache-downloads: false @@ -50,6 +55,7 @@ jobs: create-args: >- --verbose python=${{ inputs.python-version }} + matplotlib=${{ inputs.matplotlib-version }} cache-environment: true cache-downloads: false @@ -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/* diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 67ac6369c..76426b176 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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("."))) @@ -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!" diff --git a/pyproject.toml b/pyproject.toml index 42be755e4..2cf743f81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"]