Skip to content

Commit 26e0957

Browse files
committed
Add pip and tox caching to CI workflows
- Add pip caching to Python setup steps in test and lint workflows - Add tox environment caching to reduce setup time - Cache key includes tox.ini, setup.py, and pyproject.toml hashes
1 parent 0d1d2bb commit 26e0957

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ jobs:
8686
if: ${{ steps.counter.outputs.count > 0 }}
8787
with:
8888
python-version: '3.9'
89+
cache: 'pip'
8990
- run: pip install mypy==1.5.1
9091
if: ${{ steps.counter.outputs.count > 0 }}
9192
- run: mypy ${{ steps.filter.outputs.python_files }} --follow-imports=silent --ignore-missing-imports

.github/workflows/test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ jobs:
2626
uses: actions/setup-python@v4
2727
with:
2828
python-version: ${{ matrix.py }}
29+
cache: 'pip'
30+
- name: Cache tox environments
31+
uses: actions/cache@v3
32+
with:
33+
path: .tox
34+
key: tox-${{ matrix.os }}-${{ matrix.py }}-${{ hashFiles('tox.ini', 'setup.py', 'pyproject.toml') }}
35+
restore-keys: |
36+
tox-${{ matrix.os }}-${{ matrix.py }}-
2937
- name: Install tox
3038
run: python -m pip install tox
3139
- uses: actions/checkout@v3
@@ -35,6 +43,7 @@ jobs:
3543
uses: actions/setup-python@v4
3644
with:
3745
python-version: ${{ matrix.py }}
46+
cache: 'pip'
3847
- name: Setup test suite
3948
run: |
4049
sudo apt-get update && sudo apt-get install -y portaudio19-dev

0 commit comments

Comments
 (0)