Skip to content

Commit c9ab5e3

Browse files
committed
refactor workflow
1 parent c51f1a9 commit c9ab5e3

2 files changed

Lines changed: 48 additions & 18 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
inputs:
2+
python-version:
3+
description: "Python version to use"
4+
required: true
5+
venv-cache-key:
6+
description: "Cache key for the virtual environment"
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- uses: actions/setup-python@v5
13+
with:
14+
python-version: ${{ inputs.python-version }}
15+
- uses: actions/cache@v4
16+
with:
17+
path: .venv
18+
key: ${{ inputs.venv-cache-key }}
19+
fail-on-cache-miss: true
20+
- uses: snok/install-poetry@v1
21+
with:
22+
virtualenvs-create: true
23+
virtualenvs-in-project: true

.github/workflows/check.yml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,40 @@ jobs:
2727
path: .venv
2828
key: ${{ steps.cache-key.outputs.value }}
2929

30-
check:
30+
lint:
3131
needs: setup
3232
runs-on: ubuntu-latest
33-
strategy:
34-
matrix:
35-
task: [ lint, types, test ]
36-
fail-fast: false
3733
steps:
3834
- uses: actions/checkout@v4
39-
- uses: actions/setup-python@v5
35+
- uses: ./.github/actions/setup-check
4036
with:
4137
python-version: ${{ env.python-version }}
42-
- uses: actions/cache@v4
43-
with:
44-
path: .venv
45-
key: ${{ needs.setup.outputs.cache-key }}
46-
fail-on-cache-miss: true
47-
- uses: snok/install-poetry@v1
48-
with:
49-
virtualenvs-create: true
50-
virtualenvs-in-project: true
38+
venv-cache-key: ${{ needs.setup.outputs.cache-key }}
39+
- run: make lint
5140

52-
- if: matrix.task == 'types'
53-
uses: actions/cache@v4
41+
types:
42+
needs: setup
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: ./.github/actions/setup-check
47+
with:
48+
python-version: ${{ env.python-version }}
49+
venv-cache-key: ${{ needs.setup.outputs.cache-key }}
50+
- uses: actions/cache@v4
5451
with:
5552
path: .mypy_cache
5653
key: mypy-${{ runner.os }}-${{ env.python-version }}-${{ hashFiles('**/*.py') }}
5754
restore-keys: mypy-${{ runner.os }}-${{ env.python-version }}-
55+
- run: make types
5856

59-
- run: make ${{ matrix.task }}
57+
test:
58+
needs: setup
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
- uses: ./.github/actions/setup-check
63+
with:
64+
python-version: ${{ env.python-version }}
65+
venv-cache-key: ${{ needs.setup.outputs.cache-key }}
66+
- run: make test

0 commit comments

Comments
 (0)