@@ -77,24 +77,15 @@ jobs:
7777 uses : actions/cache@v4
7878 with :
7979 path : ./ultraplot/tests/baseline # The directory to cache
80- # Key is based on OS, Python/Matplotlib versions, and the base commit SHA
81- key : ${{ runner.os }}-baseline-${{ inputs.python-version }}-${{ inputs.matplotlib -version }}-${{ github.event.pull_request.base.sha }}
80+ # Key is based on OS, Python/Matplotlib versions, and the PR number
81+ key : ${{ runner.os }}-baseline-pr- ${{ github.event.pull_request.number }}-${{ inputs.python -version }}-${{ inputs.matplotlib-version }}
8282 restore-keys : |
83- ${{ runner.os }}-baseline-${{ inputs.python-version }}-${{ inputs.matplotlib-version }}-
84-
85- - name : Check baseline hash library
86- id : baseline-hash
87- run : |
88- if [ -f "./ultraplot/tests/baseline/baseline_hashes_py${{ inputs.python-version }}_mpl${{ inputs.matplotlib-version }}.json" ]; then
89- echo "exists=true" >> "$GITHUB_OUTPUT"
90- else
91- echo "exists=false" >> "$GITHUB_OUTPUT"
92- fi
83+ ${{ runner.os }}-baseline-pr-${{ github.event.pull_request.number }}-${{ inputs.python-version }}-${{ inputs.matplotlib-version }}-
9384
9485 # Conditional Baseline Generation (Only runs on cache miss)
9586 - name : Generate baseline from main
9687 # Skip this step if the cache was found (cache-hit is true)
97- if : steps.cache-baseline.outputs.cache-hit != 'true' || steps.baseline-hash.outputs.exists != 'true'
88+ if : steps.cache-baseline.outputs.cache-hit != 'true'
9889 run : |
9990 mkdir -p ultraplot/tests/baseline
10091 # Checkout the base branch (e.g., 'main') to generate the official baseline
10899 python -c "import ultraplot as plt; plt.config.Configurator()._save_yaml('ultraplot.yml')"
109100 pytest -x -n auto -W ignore \
110101 --mpl-generate-path=./ultraplot/tests/baseline/ \
111- --mpl-generate-hash-library=./ultraplot/tests/baseline/baseline_hashes_py${{ inputs.python-version }}_mpl${{ inputs.matplotlib-version }}.json\
112102 --mpl-default-style="./ultraplot.yml"\
113103 ultraplot/tests
114104
@@ -125,7 +115,7 @@ jobs:
125115 python -c "import ultraplot as plt; plt.config.Configurator()._save_yaml('ultraplot.yml')"
126116 pytest -x -n auto -W ignore -n auto\
127117 --mpl \
128- --mpl-hash-library=baseline/baseline_hashes_py${{ inputs.python-version }}_mpl${{ inputs.matplotlib-version }}.json \
118+ --mpl-baseline-path=./ultraplot/tests/baseline \
129119 --mpl-results-path=./results/ \
130120 --mpl-generate-summary=html \
131121 --mpl-default-style="./ultraplot.yml" \
0 commit comments