mirror of
https://github.com/actions/cache.git
synced 2024-12-27 14:28:01 +08:00
Add pip (with virtual environments) example for Python project
This commit is contained in:
parent
8c4c641fa0
commit
8505450d2a
17
examples.md
17
examples.md
@ -119,3 +119,20 @@ uses: actions/cache@preview
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-mix-
|
${{ runner.os }}-mix-
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Python - pip
|
||||||
|
|
||||||
|
Use with virtual environments.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: actions/cache@preview
|
||||||
|
with:
|
||||||
|
path: .venv
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles(format('{0}/{1}', github.workspace, 'requirements.txt')) }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
- run: |
|
||||||
|
python -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python -m pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user