Skip to content

Commit 73b8b88

Browse files
committed
Cache Hypothesis examples dir in CI
Fixes #2419
1 parent 910310f commit 73b8b88

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,27 @@ jobs:
5151
with:
5252
cache: true
5353
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'v4-dev' }} # TODO: Update v4-dev to main when v4 is released
54+
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
55+
- name: Restore cached hypothesis directory
56+
id: restore-hypothesis-cache
57+
uses: actions/cache/restore@v4
58+
with:
59+
path: .hypothesis/
60+
key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
61+
restore-keys: |
62+
cache-hypothesis-${{ runner.os }}-
5463
- name: Unit test
64+
id: unit-test
5565
run: |
5666
pixi run -e ${{ matrix.pixi-environment }} tests -v -s --cov=parcels --cov-report=xml --html="${{ env.COVERAGE_REPORT }}" --self-contained-html
67+
# explicitly save the cache so it gets updated, also do this even if it fails.
68+
- name: Save cached hypothesis directory
69+
id: save-hypothesis-cache
70+
if: always() && steps.unit-test.outcome != 'skipped'
71+
uses: actions/cache/save@v4
72+
with:
73+
path: .hypothesis/
74+
key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
5775
- name: Codecov
5876
uses: codecov/[email protected]
5977
env:

0 commit comments

Comments
 (0)