5353 with :
5454 fetch-depth : 0
5555
56+ - name : Prepare compatible test environment
57+ run : >-
58+ python3 tools/ci/version_support.py
59+ --matplotlib-version '${{ inputs.matplotlib-version }}'
60+ --environment-output '${{ runner.temp }}/ultraplot-environment.yml'
61+
5662 - uses : mamba-org/setup-micromamba@v3.2.1
5763 with :
58- environment-file : ./ environment.yml
64+ environment-file : ${{ runner.temp }}/ultraplot- environment.yml
5965 init-shell : bash
6066 condarc-file : ./.github/micromamba-condarc.yml
6167 post-cleanup : none
6975 - name : Build Ultraplot
7076 run : |
7177 pip install --no-build-isolation --no-deps .
78+ python - <<'PY'
79+ import sys
80+ import matplotlib, mpltern, pycirclize
81+ assert sys.version_info[:2] == tuple(map(int, '${{ inputs.python-version }}'.split('.')))
82+ assert matplotlib.__version__.startswith('${{ inputs.matplotlib-version }}.')
83+ print('Python executable:', sys.executable)
84+ print('Matplotlib:', matplotlib.__version__)
85+ PY
7286
7387 compare-baseline :
7488 name : Compare baseline Python ${{ inputs.python-version }} with MPL ${{ inputs.matplotlib-version }}
@@ -100,9 +114,15 @@ jobs:
100114
101115 - uses : actions/checkout@v7
102116
117+ - name : Prepare compatible test environment
118+ run : >-
119+ python3 tools/ci/version_support.py
120+ --matplotlib-version '${{ inputs.matplotlib-version }}'
121+ --environment-output '${{ runner.temp }}/ultraplot-environment.yml'
122+
103123 - uses : mamba-org/setup-micromamba@v3.2.1
104124 with :
105- environment-file : ./ environment.yml
125+ environment-file : ${{ runner.temp }}/ultraplot- environment.yml
106126 init-shell : bash
107127 condarc-file : ./.github/micromamba-condarc.yml
108128 post-cleanup : none
@@ -128,11 +148,26 @@ jobs:
128148 echo "base_sha=${BASE_SHA}" >> "${GITHUB_OUTPUT}"
129149 echo "Resolved baseline ref=${BASE_REF} sha=${BASE_SHA}"
130150
151+ - name : Check baseline version support
152+ id : baseline-support
153+ run : |
154+ git show '${{ steps.baseline-ref.outputs.base_sha }}:pyproject.toml' > '${{ runner.temp }}/baseline-pyproject.toml'
155+ python tools/ci/version_support.py \
156+ --baseline-pyproject '${{ runner.temp }}/baseline-pyproject.toml' \
157+ --python-version '${{ inputs.python-version }}' \
158+ --matplotlib-version '${{ inputs.matplotlib-version }}' >> "$GITHUB_OUTPUT"
159+
160+ - name : Explain unavailable baseline
161+ if : steps.baseline-support.outputs.baseline-supported != 'true'
162+ run : |
163+ echo '::notice::Image comparison skipped: the base commit does not support this Python/Matplotlib pair. PR tests still run in the coverage job.'
164+ echo 'Image comparison skipped for Python ${{ inputs.python-version }} / Matplotlib ${{ inputs.matplotlib-version }}: base commit ${{ steps.baseline-ref.outputs.base_sha }} does not support this pair. The coverage job still tests the PR on this pair.' >> "$GITHUB_STEP_SUMMARY"
165+
131166 # Cache Baseline Figures (Restore step)
132167 - name : Cache Baseline Figures
133168 id : cache-baseline
134169 uses : actions/cache@v6
135- if : ${{ env.IS_PR }}
170+ if : env.IS_PR == 'true' && steps.baseline-support.outputs.baseline-supported == 'true'
136171 with :
137172 path : ./ultraplot/tests/baseline # The directory to cache
138173 # Key is based on OS, Python/Matplotlib versions, and the base commit SHA
@@ -143,7 +178,7 @@ jobs:
143178 # Conditional Baseline Generation (Only runs on cache miss)
144179 - name : Generate baseline from main
145180 # Skip this step if the cache was found (cache-hit is true)
146- if : steps.cache-baseline.outputs.cache-hit != 'true' || ! env.IS_PR
181+ if : steps.baseline-support.outputs.baseline-supported == 'true' && (steps. cache-baseline.outputs.cache-hit != 'true' || env.IS_PR != 'true')
147182 run : |
148183 mkdir -p ultraplot/tests/baseline
149184 echo "TEST_MODE=${TEST_MODE}"
@@ -219,6 +254,7 @@ jobs:
219254
220255 # Image Comparison (Uses cached or newly generated baseline)
221256 - name : Image Comparison Ultraplot
257+ if : steps.baseline-support.outputs.baseline-supported == 'true'
222258 run : |
223259 set -uo pipefail
224260 # This workflow runs in a login shell (bash -el), which executes
0 commit comments