|
1 | | -# This workflow will install Python dependencies, run tests and lint with a single version of Python |
| 1 | +# This workflow will install Python dependencies, run tests and lint with all supported Python versions |
2 | 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
3 | 3 |
|
4 | | -name: Python application |
| 4 | +name: Tests |
5 | 5 |
|
6 | 6 | on: |
7 | 7 | push: |
8 | 8 | branches: [ develop ] |
9 | 9 | pull_request: |
10 | 10 | branches: [ develop, main ] |
11 | 11 |
|
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| 15 | + |
| 16 | +defaults: |
| 17 | + run: |
| 18 | + shell: bash -leo pipefail {0} |
| 19 | + |
12 | 20 | jobs: |
13 | 21 | build: |
14 | | - |
15 | | - runs-on: ubuntu-latest |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 26 | + poetry-version: ["1.8.2"] |
| 27 | + os: [ubuntu-latest] |
| 28 | + runs-on: ${{ matrix.os }} |
16 | 29 |
|
17 | 30 | steps: |
18 | 31 | - uses: actions/checkout@v4 |
19 | | - - name: Set up Python 3.10 |
| 32 | + - name: Set up Python ${{ matrix.python-version }} |
20 | 33 | uses: actions/setup-python@v5 |
21 | 34 | with: |
22 | | - python-version: "3.10" |
23 | | - - name: Install Poetry |
| 35 | + python-version: ${{ matrix.python-version }} |
| 36 | + - name: Install Poetry ${{ matrix.poetry-version }} |
24 | 37 | uses: abatilo/actions-poetry@v3 |
25 | 38 | with: |
26 | | - poetry-version: 1.7.1 |
| 39 | + poetry-version: ${{ matrix.poetry-version }} |
| 40 | + - name: Setup a local virtual environment |
| 41 | + run: | |
| 42 | + poetry config virtualenvs.create true --local |
| 43 | + poetry config virtualenvs.in-project true --local |
| 44 | + - uses: actions/cache@v4 |
| 45 | + name: Define a cache for the virtual environment based on the dependencies lock file |
| 46 | + with: |
| 47 | + path: ./.venv |
| 48 | + key: venv-${{ hashFiles('poetry.lock') }} |
27 | 49 | - name: Install dependencies |
28 | 50 | run: | |
29 | 51 | poetry run python -m pip install --upgrade pip |
|
34 | 56 | poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
35 | 57 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
36 | 58 | poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 59 | + - name: Check types with mypy |
| 60 | + run: | |
| 61 | + poetry run mypy cmr tests |
37 | 62 | - name: Test with pytest |
38 | 63 | run: | |
39 | 64 | poetry run pytest |
0 commit comments