Skip to content

Commit 8be0ccc

Browse files
committed
Switch to image baselines cached per PR
1 parent 07eac06 commit 8be0ccc

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

.github/workflows/build-ultraplot.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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
@@ -108,7 +99,6 @@ jobs:
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

Comments
 (0)