Skip to content

Commit 3c98570

Browse files
authored
Update hypothesis action to always save the cache (#8913)
* Update hypothesis actions * fix path * try again * try again
1 parent 5bcbf70 commit 3c98570

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

.github/workflows/hypothesis.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,33 @@ jobs:
7676
conda info -a
7777
conda list
7878
python xarray/util/print_versions.py
79+
80+
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
7981
- name: Restore cached hypothesis directory
80-
uses: actions/cache@v4
82+
id: restore-hypothesis-cache
83+
uses: actions/cache/restore@v4
8184
with:
8285
path: .hypothesis/
83-
key: cache-hypothesis
84-
enableCrossOsArchive: true
85-
save-always: true
86+
key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
87+
restore-keys: |
88+
cache-hypothesis-
89+
8690
- name: Run slow Hypothesis tests
8791
if: success()
8892
id: status
8993
run: |
9094
python -m pytest --hypothesis-show-statistics --run-slow-hypothesis properties/*.py \
9195
--report-log output-${{ matrix.python-version }}-log.jsonl
96+
97+
# explicitly save the cache so it gets updated, also do this even if it fails.
98+
- name: Save cached hypothesis directory
99+
id: save-hypothesis-cache
100+
if: always() && steps.status.outcome != 'skipped'
101+
uses: actions/cache/save@v4
102+
with:
103+
path: .hypothesis/
104+
key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
105+
92106
- name: Generate and publish the report
93107
if: |
94108
failure()

0 commit comments

Comments
 (0)