Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Caching Issues #15

Merged
merged 1 commit into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/test_setup_python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ jobs:
cache_hit_pre:
name: Setup Cache
runs-on: ubuntu-latest
outputs:
python_version: ${{ steps.python.outputs.python-version }}

steps:
- uses: actions/checkout@v3

- name: Setup Python
id: python
uses: ./setup-python
with:
install_args: "--without dev"
Expand All @@ -90,7 +93,11 @@ jobs:
uses: ./setup-python
with:
install_args: "--without dev"
python_version: '3.10'
# The python version must explicitly be specified using the setup's version,
# since the underlying setup action can sometimes use different patch versions randomly.
# I.e: the setup-python action can use 3.10.9 on one run, and 3.10.8 on the next,
# even if both are specified as 3.10.
python_version: ${{ needs.cache_hit_pre.outputs.python_version }}
working_dir: setup-python/tests/

- name: Check For Cache hit
Expand Down
7 changes: 4 additions & 3 deletions setup-python/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ runs:
with:
path: |
~/.cache/pypoetry
~/.cache/py-user-base
~/.cache/pip
key: "python-${{ runner.os }}-v1.3.4b1-\
${{ steps.python_setup.outputs.python-version }}-${{ inputs.dev }}-${{ inputs.working_dir }}-${{ inputs.poetry_version }}-${{ inputs.install_args }}-\
${{ hashFiles(format('{0}/pyproject.toml', inputs.working_dir), format('{0}/poetry.lock', inputs.working_dir)) }}"
Expand Down Expand Up @@ -94,8 +94,9 @@ runs:
if [ "${{ steps.python_cache.outputs.cache-hit }}" = "true" ]; then
if [ "${{ inputs.use_cache }}" = "false" ]; then
echo "Caching not enbaled, deleting cache."
rm -rf ~/.cache/py-user-base
rm -rf ~/.cache/pre-commit
rm -rf ~/.cache/pypoetry
rm -rf ~/.cache/pip
rm -rf ~/.cache/pre-commit
else
echo "Cache hit, skipping install."
exit
Expand Down
47 changes: 19 additions & 28 deletions setup-python/tests/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.