Skip to content

Commit 9fcc48a

Browse files
authored
Merge pull request #538 from boriel/feature/cache-tox-in-GH-actions
Cache tox env in GH actions
2 parents 8d11dae + f7ff8d3 commit 9fcc48a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/python-app.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,28 @@ jobs:
2020
uses: actions/setup-python@v2
2121
with:
2222
python-version: 3.8
23+
- name: Caches pip
24+
uses: actions/cache@v1
25+
with:
26+
path: ~/.cache/pip
27+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
28+
restore-keys: |
29+
${{ runner.os }}-pip-
2330
- name: Install dependencies
2431
run: |
2532
python -m pip install --upgrade pip
2633
pip install poetry tox
2734
poetry install
35+
- name: Cache tox environments
36+
id: cache-tox
37+
uses: actions/cache@v1
38+
with:
39+
path: .tox
40+
# setup.cfg, pyproject.toml, and .pre-commit-config.yaml have
41+
# versioning info that would impact the tox environment. hashFiles
42+
# only takes a single file path or pattern at the moment.
43+
key: ${{ runner.os }}-${{ matrix.python }}-tox-${{ hashFiles('setup.cfg') }}-${{ hashFiles('pyproject.toml') }}
44+
45+
2846
- name: Run Tox
2947
run: tox -- --no-cov

0 commit comments

Comments
 (0)