Skip to content

Commit

Permalink
Switch to cache-dependency-path
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgauntseo-sentry committed Jan 11, 2023
1 parent ce81577 commit dc9adda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Sets up python and a virtual environment with caching.
id: venv
with:
python-version: 3.10.7
cache-dependency-path: |
requirements.txt
requirements-frozen.txt
- run: pip install -r requirements.txt
if: steps.venv.outputs.cache-hit != 'true'
```
5 changes: 3 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: 'configures venv, python and caches'
inputs:
python-version:
description: "Version range or exact version of Python or PyPy to use, using SemVer's version range syntax."
requirement-files:
cache-dependency-path:
description: "Requirement files to install. Can be a glob pattern."
default: '**/requirements*.txt'
venv-dir:
Expand All @@ -23,12 +23,13 @@ runs:
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
cache-dependency-path: ${{ inputs.cache-dependency-path }}

- uses: actions/cache@v3
id: cache-venv
with:
path: ${{ inputs.venv-dir }}
key: setup-venv-${{ runner.os }}-py-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles(inputs.requirement-files) }}
key: setup-venv-${{ runner.os }}-py-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles(inputs.cache-dependency-path) }}

- run: python3 -m venv ${{ inputs.venv-dir }}
if: steps.cache-venv.outputs.cache-hit != 'true'
Expand Down

0 comments on commit dc9adda

Please sign in to comment.