@@ -20,33 +20,41 @@ jobs:
2020 matrix :
2121 python-version : ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
2222 steps :
23- - uses : actions/checkout@v2
24- with :
25- submodules : ' recursive'
26- - name : Set up Python ${{ matrix.python-version }}
27- uses : actions/setup-python@v5
28- with :
29- python-version : ${{ matrix.python-version }}
30-
31- - name : Setup poetry
32- uses : abatilo/actions-poetry@v4
33- with :
34- poetry-version : ' 1.8.5'
35-
36- - name : Setup a local virtual environment
37- run : |
38- poetry config virtualenvs.create true --local
39- poetry config virtualenvs.in-project true --local
40-
41- - uses : actions/cache@v3
42- name : Define a cache for the virtual environment based on the dependencies lock file
43- with :
44- path : ./.venv
45- key : venv-${{ hashFiles('poetry.lock') }}
46-
47- - name : Install dependencies
48- run : poetry install -E crypto
49- - name : Generate rest sync code and tests
50- run : poetry run unasync
51- - name : Test with pytest
52- run : poetry run pytest --verbose --tb=short
23+ - uses : actions/checkout@v4
24+ with :
25+ submodules : ' recursive'
26+ - name : Set up Python ${{ matrix.python-version }}
27+ uses : actions/setup-python@v5
28+ id : setup-python
29+ with :
30+ python-version : ${{ matrix.python-version }}
31+
32+ - name : Setup poetry
33+ run : |
34+ python3 -m pip install --user pipx
35+ python3 -m pipx ensurepath
36+ pipx install poetry==1.8.5 --python ${{ steps.setup-python.outputs.python-path }}
37+
38+ - name : Setup a local virtual environment
39+ run : |
40+ poetry config virtualenvs.create true --local
41+ poetry config virtualenvs.in-project true --local
42+
43+ - uses : actions/cache@v3
44+ name : Define a cache for the virtual environment based on the dependencies lock file
45+ id : cache
46+ with :
47+ path : ./.venv
48+ key : venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
49+
50+ - name : Ensure cache is healthy
51+ if : steps.cache.outputs.cache-hit == 'true'
52+ shell : bash
53+ run : poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
54+
55+ - name : Install dependencies
56+ run : poetry install -E crypto
57+ - name : Generate rest sync code and tests
58+ run : poetry run unasync
59+ - name : Test with pytest
60+ run : poetry run pytest --verbose --tb=short --reruns 3
0 commit comments