|
1 | | -# This is a basic workflow to help you get started with Actions |
2 | | - |
3 | 1 | name: Unit tests |
4 | 2 |
|
5 | | -# Controls when the action will run. Triggers the workflow on push or pull request |
6 | | -# events but only for the main branch |
7 | 3 | on: |
8 | 4 | push: |
9 | 5 | branches: [ main ] |
10 | 6 | pull_request: |
11 | 7 | branches: [ main ] |
12 | 8 |
|
13 | | -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
14 | 9 | jobs: |
15 | | - # This workflow contains a single job called "build" |
16 | 10 | build: |
17 | 11 | strategy: |
18 | 12 | matrix: |
19 | 13 | python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ] |
20 | | - |
21 | | - # The type of runner that the job will run on |
22 | 14 | runs-on: ubuntu-latest |
23 | | - |
24 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
25 | 15 | steps: |
26 | | - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
27 | | - - uses: actions/checkout@v2 |
28 | | - - uses: actions/setup-python@v2 |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + - name: Install poetry |
| 18 | + run: pipx install poetry |
| 19 | + - uses: actions/setup-python@v5 |
29 | 20 | with: |
30 | 21 | python-version: ${{ matrix.python-version }} |
31 | | - |
32 | | - # Poetry bootstrap taken from |
33 | | - # https://jacobian.org/til/github-actions-poetry/ |
34 | | - |
35 | | - - name: cache poetry install |
36 | | - uses: actions/cache@v2 |
37 | | - with: |
38 | | - path: ~/.local |
39 | | - key: poetry-1.7.1-py${{ matrix.python-version }} |
40 | | - - uses: snok/install-poetry@v1 |
41 | | - with: |
42 | | - version: 1.7.1 |
43 | | - virtualenvs-create: true |
44 | | - virtualenvs-in-project: true |
45 | | - - name: cache deps |
46 | | - id: cache-deps |
47 | | - uses: actions/cache@v2 |
48 | | - with: |
49 | | - path: .venv |
50 | | - key: py${{ matrix.python-version}}deps-${{ hashFiles('**/poetry.lock') }} |
51 | | - - run: poetry install --no-interaction --no-root |
52 | | - if: steps.cache-deps.outputs.cache-hit != 'true' |
53 | | - |
54 | | - - run: poetry install |
55 | | - - run: poetry run pytest -vv |
| 22 | + cache: 'poetry' |
| 23 | + |
| 24 | + - name: Install dependencies |
| 25 | + run: poetry install |
| 26 | + - name: Run MyPy type check |
| 27 | + run: poetry run mypy |
| 28 | + - name: Run tests |
| 29 | + run: poetry run pytest -vv |
0 commit comments