Skip to content

Commit 03c77b1

Browse files
committed
ci(docs): Use checkout@v3's (v3.1) poetry cache
1 parent f6e2e64 commit 03c77b1

File tree

1 file changed

+7
-35
lines changed

1 file changed

+7
-35
lines changed

.github/workflows/docs.yml

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
matrix:
1313
python-version: ["3.10"]
1414
steps:
15-
- uses: actions/checkout@v1
15+
- uses: actions/checkout@v3
1616
- name: Filter changed file paths to outputs
1717
uses: dorny/[email protected]
1818
id: changes
@@ -33,49 +33,21 @@ jobs:
3333
if: steps.changes.outputs.docs == 'true' || steps.changes.outputs.root_docs == 'true' || steps.changes.outputs.python_files == 'true'
3434
run: echo "PUBLISH=$(echo true)" >> $GITHUB_ENV
3535

36-
- name: Set up Python ${{ matrix.python-version }}
37-
uses: actions/setup-python@v1
38-
with:
39-
python-version: ${{ matrix.python-version }}
40-
41-
- name: Get full Python version
42-
id: full-python-version
43-
shell: bash
44-
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
45-
4636
- name: Install poetry
4737
run: |
4838
curl -O -sSL https://install.python-poetry.org/install-poetry.py
4939
python install-poetry.py -y --version 1.1.12
5040
echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV
5141
rm install-poetry.py
5242
53-
- name: Add ~/.local/bin to PATH
54-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
55-
56-
- name: Get poetry cache paths from config
57-
run: |
58-
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
59-
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
60-
61-
- name: Configure poetry
62-
shell: bash
63-
run: poetry config virtualenvs.in-project true
64-
65-
- name: Set up cache
66-
uses: actions/cache@v2
67-
id: cache
43+
- name: Set up Python ${{ matrix.python-version }}
44+
uses: actions/setup-python@v3
6845
with:
69-
path: |
70-
.venv
71-
{{ env.poetry_cache_dir }}
72-
{{ env.poetry_virtualenvs_path }}
73-
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
46+
python-version: ${{ matrix.python-version }}
47+
cache: 'poetry'
7448

75-
- name: Ensure cache is healthy
76-
if: steps.cache.outputs.cache-hit == 'true'
77-
shell: bash
78-
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
49+
- name: Add ~/.local/bin to PATH
50+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
7951

8052
- name: Install dependencies [w/ docs]
8153
run: poetry install --extras "docs lint"

0 commit comments

Comments
 (0)