Skip to content

Commit 65f20a1

Browse files
authored
ci: fix poetry caching (#546)
* fix poetry caching * add poetry version flag * don't install poetry if cache hit * edit cache key * apply to other tests * add env var to integration tests
1 parent aeecb4b commit 65f20a1

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.github/workflows/integration_test.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
workflow_dispatch:
88

9+
env:
10+
POETRY_VERSION: 1.4.2
11+
912
jobs:
1013
integration-test:
1114
name: Integration test
@@ -29,14 +32,16 @@ jobs:
2932
uses: actions/checkout@v3
3033

3134
- name: Load cached .local
35+
id: cache-poetry
3236
uses: actions/cache@v3
3337
with:
3438
path: /home/runner/.local
35-
key: dotlocal-${{ matrix.python-version }}-${{ hashFiles('.github/workflows') }}
39+
key: dotlocal-${{ env.POETRY_VERSION }}
3640

3741
- name: Install poetry
42+
if: steps.cache-poetry.outputs.cache-hit != 'true'
3843
run: |
39-
curl -sSL https://install.python-poetry.org/ | python -
44+
curl -sSL https://install.python-poetry.org/ | python - --version ${{ env.POETRY_VERSION }}
4045
echo "$HOME/.local/bin" >> $GITHUB_PATH
4146
4247
- name: Install Python + Retrieve Poetry dependencies from cache

.github/workflows/unit_test.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
workflow_dispatch:
88

9+
env:
10+
POETRY_VERSION: 1.4.2
11+
912
jobs:
1013
lint-and-type-check:
1114
name: Lint and type-check
@@ -19,14 +22,16 @@ jobs:
1922
uses: actions/checkout@v3
2023

2124
- name: Load cached .local
25+
id: cache-poetry
2226
uses: actions/cache@v3
2327
with:
2428
path: /home/runner/.local
25-
key: dotlocal-${{ env.PYTHON_VERSION }}-${{ hashFiles('.github/workflows') }}
29+
key: dotlocal-${{ env.POETRY_VERSION }}
2630

2731
- name: Install poetry
32+
if: steps.cache-poetry.outputs.cache-hit != 'true'
2833
run: |
29-
curl -sSL https://install.python-poetry.org/ | python -
34+
curl -sSL https://install.python-poetry.org/ | python - --version ${{ env.POETRY_VERSION }}
3035
echo "$HOME/.local/bin" >> $GITHUB_PATH
3136
3237
- name: Install Python + Retrieve Poetry dependencies from cache
@@ -62,14 +67,16 @@ jobs:
6267
uses: actions/checkout@v3
6368

6469
- name: Load cached .local
70+
id: cache-poetry
6571
uses: actions/cache@v3
6672
with:
6773
path: /home/runner/.local
68-
key: dotlocal-${{ matrix.python-version }}-${{ hashFiles('.github/workflows') }}
74+
key: dotlocal-${{ env.POETRY_VERSION }}
6975

7076
- name: Install poetry
77+
if: steps.cache-poetry.outputs.cache-hit != 'true'
7178
run: |
72-
curl -sSL https://install.python-poetry.org/ | python -
79+
curl -sSL https://install.python-poetry.org/ | python - --version ${{ env.POETRY_VERSION }}
7380
echo "$HOME/.local/bin" >> $GITHUB_PATH
7481
7582
- name: Install Python + Retrieve Poetry dependencies from cache

0 commit comments

Comments
 (0)