Skip to content

Commit

Permalink
MNT/CI: switch away from deprecated save-always directive for actions…
Browse files Browse the repository at this point in the history
…/cache
  • Loading branch information
theOehrly committed Oct 27, 2024
1 parent 5e0575c commit c92462a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ jobs:
run: |
mkdir doc_cache # make sure cache dir exists
- name: Cache FastF1
uses: actions/cache@v4
- name: Restore cache for FastF1
id: cache-doc-restore
uses: actions/cache/restore@v4
with:
save-always: true
path: ./doc_cache
key: fastf1-doc-cache-${{ hashFiles('*.*') }}
# Restore any matching cache independent of hash suffix. We cannot
# know if anything has changed at this stage.
key: fastf1-doc-cache-${{ hashFiles('./doc_cache/**/*.*') }}
restore-keys: |
fastf1-doc-cache
Expand Down Expand Up @@ -94,6 +96,15 @@ jobs:
with:
path: docs/_build/html/

- name: Save cache for FastF1
id: cache-doc-save
# Save the cache even in case of a failure but only if the content of
# the cached directory has changed.
if: always() && steps.cache-doc-restore.outputs.cache-matched-key != hashFiles('./doc_cache/**/*.*')
uses: actions/cache/save@v4
with:
key: fastf1-doc-cache-${{ hashFiles('./doc_cache/**/*.*') }}
path: ./doc_cache

deploy:
if: (github.event_name == 'release') || inputs.publish
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,31 @@ jobs:
run: |
mkdir test_cache # make sure cache dir exists
- name: Cache FastF1
- name: Restore cache for FastF1
id: cache-fastf1-restore
uses: actions/cache@v4
with:
save-always: true
path: ./test_cache
key: fastf1-${{ matrix.python-version }}${{ matrix.cache-suffix }}-${{ hashFiles('*.*') }}
# Restore any matching cache independent of hash suffix. We cannot
# know if anything has changed at this stage.
key: fastf1-${{ matrix.python-version }}${{ matrix.cache-suffix }}-${{ hashFiles('./test_cache/**/*.*') }}
restore-keys: |
fastf1-${{ matrix.python-version }}${{ matrix.cache-suffix }}
- name: Run tests
run: |
pytest -ra
- name: Save cache for FastF1
id: cache-fastf1-save
# Save the cache even in case of a failure but only if the content of
# the cached directory has changed.
if: always() && steps.cache-fastf1-restore.outputs.cache-matched-key != hashFiles('./test_cache/**/*.*')
uses: actions/cache/save@v4
with:
key: fastf1-${{ matrix.python-version }}${{ matrix.cache-suffix }}-${{ hashFiles('./test_cache/**/*.*') }}
path: ./test_cache


run-lint-checks:
if: (!contains(github.event.head_commit.message, '[skip-ruff]'))
Expand Down

0 comments on commit c92462a

Please sign in to comment.