-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch caching to use re-actors/cache-python-deps (#93)
- Loading branch information
Showing
4 changed files
with
96 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
|
||
name: placeholder | ||
description: placeholder | ||
|
||
outputs: | ||
cache-key-for-dep-files: | ||
description: >- | ||
A cache key string derived from the dependency declaration files. | ||
value: ${{ steps.calc-cache-key-files.outputs.files-hash-key }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: >- | ||
Calculate dependency files' combined hash value | ||
for use in the cache key | ||
id: calc-cache-key-files | ||
run: | | ||
from os import environ | ||
from pathlib import Path | ||
FILE_APPEND_MODE = 'a' | ||
files_derived_hash = '${{ | ||
hashFiles( | ||
'tox.ini', | ||
'pyproject.toml', | ||
'.pre-commit-config.yaml', | ||
'pytest.ini', | ||
'requirements/**', | ||
'setup.cfg' | ||
) | ||
}}' | ||
print(f'Computed file-derived hash is {files_derived_hash}.') | ||
with Path(environ['GITHUB_OUTPUT']).open( | ||
mode=FILE_APPEND_MODE, | ||
) as outputs_file: | ||
print( | ||
f'files-hash-key={files_derived_hash}', | ||
file=outputs_file, | ||
) | ||
shell: python | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
GitHub Actions CI/CD is now configured to manage caching pip-ecosystem | ||
dependencies using `re-actors/cache-python-deps`_ -- an action by | ||
:user:`webknjaz` that takes into account ABI stability and the exact | ||
version of Python runtime. | ||
|
||
.. _`re-actors/cache-python-deps`: | ||
https://github.com/marketplace/actions/cache-python-deps |