Skip to content

Commit ea21ef6

Browse files
committed
ci(tests): Use poetry cache action
This was added in https://github.com/actions/setup-python/releases/tag/v3.1.0
1 parent 623a393 commit ea21ef6

File tree

1 file changed

+7
-35
lines changed

1 file changed

+7
-35
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,22 @@ jobs:
99
matrix:
1010
python-version: [ '3.10' ]
1111
steps:
12-
- uses: actions/checkout@v1
13-
- name: Set up Python ${{ matrix.python-version }}
14-
uses: actions/setup-python@v1
15-
with:
16-
python-version: ${{ matrix.python-version }}
17-
18-
- name: Get full Python version
19-
id: full-python-version
20-
shell: bash
21-
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
22-
12+
- uses: actions/checkout@v3
2313
- name: Install poetry
2414
run: |
2515
curl -O -sSL https://install.python-poetry.org/install-poetry.py
2616
python install-poetry.py -y --version 1.1.12
2717
echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV
2818
rm install-poetry.py
2919
30-
- name: Add ~/.local/bin to PATH
31-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
32-
33-
- name: Get poetry cache paths from config
34-
run: |
35-
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
36-
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
37-
38-
- name: Configure poetry
39-
shell: bash
40-
run: poetry config virtualenvs.in-project true
41-
42-
- name: Set up cache
43-
uses: actions/cache@v2
44-
id: cache
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v3
4522
with:
46-
path: |
47-
.venv
48-
${{ env.poetry_cache_dir }}
49-
${{ env.poetry_virtualenvs_path }}
50-
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
23+
python-version: ${{ matrix.python-version }}
24+
cache: 'poetry'
5125

52-
- name: Ensure cache is healthy
53-
if: steps.cache.outputs.cache-hit == 'true'
54-
shell: bash
55-
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
26+
- name: Add ~/.local/bin to PATH
27+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
5628

5729
- name: Install dependencies
5830
run: poetry install -E "docs test coverage lint format"

0 commit comments

Comments
 (0)