|
1 |
| -name: Run Python tests |
| 1 | +name: Run Test Suite |
2 | 2 |
|
3 |
| -on: [ push ] |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +defaults: |
| 9 | + run: |
| 10 | + shell: bash |
| 11 | + |
| 12 | +env: |
| 13 | + PIP_DISABLE_PIP_VERSION_CHECK: 1 |
| 14 | + COVERAGE_IGOR_VERBOSE: 1 |
| 15 | + FORCE_COLOR: 1 # pytest output color |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 22 | + cancel-in-progress: true |
4 | 23 |
|
5 | 24 | jobs:
|
6 |
| - build: |
| 25 | + tests: |
| 26 | + name: "${{ matrix.python-version }} on ${{ matrix.os }}" |
| 27 | + runs-on: "${{ matrix.os }}-latest" |
| 28 | + |
| 29 | + continue-on-error: ${{ startsWith(matrix.python-version, '~') }} # Allows unstable Python versions to fail |
7 | 30 |
|
8 |
| - name: Run tests |
9 |
| - runs-on: ubuntu-latest |
10 | 31 | strategy:
|
| 32 | + fail-fast: false |
11 | 33 | matrix:
|
| 34 | + os: |
| 35 | + - ubuntu |
| 36 | + - windows |
| 37 | + - macos |
12 | 38 | python-version: ["3.9", "3.10", "3.11", "3.x"]
|
13 | 39 |
|
14 |
| - |
15 | 40 | steps:
|
16 |
| - - uses: actions/checkout@v3 |
| 41 | + - name: Checkout repository |
| 42 | + uses: actions/checkout@v4 |
17 | 43 |
|
18 | 44 | - name: Set up Python ${{ matrix.python-version }}
|
19 |
| - uses: actions/setup-python@v4 |
| 45 | + uses: actions/setup-python@v5 |
20 | 46 | with:
|
21 | 47 | python-version: ${{ matrix.python-version }}
|
22 | 48 |
|
23 |
| - - name: Install dependencies |
| 49 | + - name: Install Python dependencies |
24 | 50 | run: |
|
25 |
| - python -m pip install -U pip |
26 |
| - python -m pip install -U coverage pytest pytest-cov poetry |
| 51 | + set -xe |
| 52 | + python -m pip install poetry coverage pytest |
27 | 53 | python -m poetry install
|
28 | 54 | python -m poetry self add poetry-plugin-export
|
29 | 55 | python -m poetry export -f requirements.txt --output requirements.txt
|
30 | 56 | python -m pip install -r requirements.txt
|
31 | 57 |
|
32 |
| - - name: Lint with Ruff |
33 |
| - run: | |
34 |
| - python -m pip install -U ruff |
35 |
| - ruff --per-file-ignores="__init__.py:F401" --per-file-ignores="__init__.py:E402" . |
36 |
| - continue-on-error: true |
37 |
| - |
38 | 58 | - name: Test with pytest
|
39 | 59 | run: |
|
40 |
| - coverage run -m pytest -v -s |
| 60 | + set -xe |
| 61 | + python -m pytest -sv |
41 | 62 |
|
42 |
| - - name: Generate Coverage Report |
43 |
| - run: | |
44 |
| - coverage report -m |
| 63 | + check: |
| 64 | + if: always() |
| 65 | + name: Tests Successful |
| 66 | + runs-on: ubuntu-latest |
| 67 | + needs: tests |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: Whether the whole test suite passed |
| 71 | + |
| 72 | + with: |
| 73 | + jobs: ${{ toJSON(needs) }} |
0 commit comments