Skip to content

Commit 1941dd8

Browse files
committed
Rework env variables
1 parent 1c960d7 commit 1941dd8

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

.github/actions/restore-venv/action.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ description: "Restores the venv and pre-commit cache or fails"
33

44
inputs:
55
python-version:
6-
required: false
7-
default: "${{ env.DEFAULT_PYTHON }}"
6+
required: true
87
cache-key:
98
required: true
109
fail-on-miss:
1110
required: false
1211
default: "true" # DefauLt fail if not available
12+
venv-dir:
13+
required: true
14+
precommit-home:
15+
required: true
1316

1417
runs:
1518
using: "composite"
@@ -19,8 +22,8 @@ runs:
1922
uses: actions/cache@v4
2023
with:
2124
path: |
22-
${{ env.VENV }}
23-
${{ env.PRE_COMMIT_HOME }}
25+
${{ inputs.venv_dir }}
26+
${{ inputs.precommit-home }}
2427
key: ${{ inputs.cache-key }}
2528
- name: Create Python virtual environment
2629
if: ${{ steps.cache-create.outputs.cache-hit != 'true' }}

.github/workflows/verify.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ jobs:
5454
with:
5555
cache-key: ${{ needs.cache.outputs.cache-key }}
5656
fail-on-miss: false # First time create cache (if not already exists)
57+
python-version: ${{ steps.python.outputs.python-version }}
58+
venv-dir: ${{ env.VENV }}
59+
precommit-home: ${{ env.PRE_COMMIT_HOME }}
5760

5861
ruff:
5962
runs-on: ubuntu-latest
@@ -74,6 +77,9 @@ jobs:
7477
uses: ./.github/actions/restore-venv
7578
with:
7679
cache-key: ${{ needs.cache.outputs.cache-key }}
80+
python-version: ${{ steps.python.outputs.python-version }}
81+
venv-dir: ${{ env.VENV }}
82+
precommit-home: ${{ env.PRE_COMMIT_HOME }}
7783
- name: Ruff (check)
7884
run: |
7985
. venv/bin/activate
@@ -111,6 +117,9 @@ jobs:
111117
uses: ./.github/actions/restore-venv
112118
with:
113119
cache-key: ${{ needs.cache.outputs.cache-key }}
120+
python-version: ${{ steps.python.outputs.python-version }}
121+
venv-dir: ${{ env.VENV }}
122+
precommit-home: ${{ env.PRE_COMMIT_HOME }}
114123
- name: Verify commit
115124
run: |
116125
. venv/bin/activate
@@ -146,9 +155,11 @@ jobs:
146155
id: cache-reuse
147156
uses: ./.github/actions/restore-venv
148157
with:
149-
python-version: ${{ matrix.python-version }}
150158
cache-key: ${{ needs.cache.outputs.cache-key }}-pytest-matrix-${{ matrix.python-version }}
151159
fail-on-miss: false # First time create cache (if not already exists)
160+
python-version: ${{ matrix.python-version }}
161+
venv-dir: ${{ env.VENV }}
162+
precommit-home: ${{ env.PRE_COMMIT_HOME }}
152163
- name: Run all tests
153164
run: |
154165
. venv/bin/activate
@@ -183,6 +194,9 @@ jobs:
183194
uses: ./.github/actions/restore-venv
184195
with:
185196
cache-key: ${{ needs.cache.outputs.cache-key }}
197+
python-version: ${{ steps.python.outputs.python-version }}
198+
venv-dir: ${{ env.VENV }}
199+
precommit-home: ${{ env.PRE_COMMIT_HOME }}
186200
- name: Run mypy
187201
run: |
188202
. venv/bin/activate
@@ -229,6 +243,9 @@ jobs:
229243
uses: ./.github/actions/restore-venv
230244
with:
231245
cache-key: ${{ needs.cache.outputs.cache-key }}
246+
python-version: ${{ steps.python.outputs.python-version }}
247+
venv-dir: ${{ env.VENV }}
248+
precommit-home: ${{ env.PRE_COMMIT_HOME }}
232249
- name: Download all coverage artifacts
233250
uses: actions/download-artifact@v4
234251
- name: Combine coverage results
@@ -267,6 +284,9 @@ jobs:
267284
uses: ./.github/actions/restore-venv
268285
with:
269286
cache-key: ${{ needs.cache.outputs.cache-key }}
287+
python-version: ${{ steps.python.outputs.python-version }}
288+
venv-dir: ${{ env.VENV }}
289+
precommit-home: ${{ env.PRE_COMMIT_HOME }}
270290
- name: Install pypa/build
271291
run: |
272292
. venv/bin/activate
@@ -302,6 +322,9 @@ jobs:
302322
uses: ./.github/actions/restore-venv
303323
with:
304324
cache-key: ${{ needs.cache.outputs.cache-key }}
325+
python-version: ${{ steps.python.outputs.python-version }}
326+
venv-dir: ${{ env.VENV }}
327+
precommit-home: ${{ env.PRE_COMMIT_HOME }}
305328
- name: Run complexity report (click to view details)
306329
run: |
307330
. venv/bin/activate

0 commit comments

Comments
 (0)