Skip to content

Commit 02f40af

Browse files
committed
chore: Add package cache for poetry and pre-commit and update codecov
1 parent 72aaeef commit 02f40af

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

.github/workflows/ci-tests.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,17 @@ jobs:
1414
uses: actions/setup-python@v2
1515
with:
1616
python-version: 3.9
17-
- name: Update pip
18-
run: |
19-
python -m pip install --upgrade pip
20-
- name: Install and run pre-commit
21-
uses: pre-commit/[email protected]
17+
- uses: pre-commit/[email protected]
2218
with:
23-
extra_args: --all-files
19+
extra_args: --all-files --show-diff-on-failure
2420
pytest:
2521
needs:
2622
- lint
2723
strategy:
2824
fail-fast: false
2925
matrix:
3026
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.8", "pypy3.9" ]
31-
poetry-version: [ "latest" ]
27+
poetry-version: [ "1.5.1" ]
3228
os: [ ubuntu-20.04, macos-latest, windows-latest ]
3329
runs-on: ${{ matrix.os }}
3430
name: Python ${{ matrix.python-version }} / Poetry ${{ matrix.poetry-version }} / ${{ matrix.os }}
@@ -44,9 +40,23 @@ jobs:
4440
with:
4541
python-version: ${{ matrix.python-version }}
4642
cache: 'pip'
47-
- name: Update pip
43+
- name: Select the cache folder
44+
id: cache-folder
4845
run: |
49-
python -m pip install --upgrade pip
46+
if [ ${{ matrix.os }} == 'ubuntu-20.04' ]; then
47+
CACHE_FOLDER="/home/runner/.cache/pypoetry"
48+
elif [ ${{ matrix.os }} == 'macos-latest' ]; then
49+
CACHE_FOLDER="/Users/runner/Library/Caches/pypoetry"
50+
elif [ ${{ matrix.os }} == 'windows-latest' ]; then
51+
CACHE_FOLDER="C:\Users\runneradmin\AppData\Local\pypoetry\Cache"
52+
fi
53+
echo "Cache folder is $CACHE_FOLDER"
54+
echo "folder=$CACHE_FOLDER" >> "$GITHUB_OUTPUT"
55+
- name: Cache Poetry cache
56+
uses: actions/cache@v3
57+
with:
58+
path: ${{ steps.cache-folder.outputs.folder }}
59+
key: poetry-cache-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.poetry-version }}
5060
- name: Run Poetry action
5161
uses: abatilo/actions-poetry@v2
5262
with:
@@ -58,7 +68,7 @@ jobs:
5868
- name: Run tests
5969
run: poetry run pytest
6070
- name: Upload coverage to Codecov
61-
uses: codecov/codecov-action@v1
71+
uses: codecov/codecov-action@v3
6272
with:
6373
token: ${{ secrets.CODECOV_TOKEN }}
6474
flags: unittests

0 commit comments

Comments
 (0)