Debian Codegraph @

.github/workflows/reusable-pytest.yml

raw
1 name: pytest
2 on:
3 workflow_call:
4
5 permissions: {}
6
7 jobs:
8 pytest:
9 name: Run tests
10 runs-on: ${{ matrix.os }}-latest
11 env:
12 PYTEST_ADDOPTS: "--run-integration --showlocals -vv --durations=10 --reruns 5 --only-rerun subprocess.CalledProcessError"
13 strategy:
14 fail-fast: false
15 matrix:
16 os:
17 - ubuntu
18 - macos
19 - windows
20 py:
21 - "pypy3.10-v7.3.19"
22 - "pypy3.11-v7.3.19"
23 - "3.15"
24 - "3.14"
25 - "3.13"
26 - "3.12"
27 - "3.11"
28 - "3.10"
29 tox-target:
30 - "tox"
31 - "min"
32
33 continue-on-error: >- # jobs not required in branch protection
34 ${{
35 (
36 startsWith(matrix.py, 'pypy')
37 && matrix.os == 'windows'
38 )
39 && true
40 || false
41 }}
42
43 steps:
44 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
45 with:
46 fetch-depth: 0
47 persist-credentials: false
48
49 - name: Setup uv
50 uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
51
52 - name: Install tox (uv)
53 run: uv tool install tox --with tox-uv
54
55 - name: Setup python for test ${{ matrix.py }}
56 uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
57 with:
58 python-version: ${{ matrix.py }}
59 allow-prereleases: true
60
61 - name: Run test suite via tox
62 if: matrix.tox-target == 'tox'
63 shell: bash
64 run: |
65 PYTHON_VERSION=$PYTHON_VERSION_RAW
66 BASE=${PYTHON_VERSION%-*}
67 tox -vv --notest -e $BASE
68 tox -e $BASE --skip-pkg-install
69 env:
70 PYTHON_VERSION_RAW: ${{ matrix.py }}
71
72 - name: Run minimum version test
73 if: matrix.tox-target == 'min'
74 shell: bash
75 run: |
76 PYTHON_VERSION=$PYTHON_VERSION_RAW
77 BASE=${PYTHON_VERSION%-*}
78 tox -e $TOX_TARGET-$BASE
79 env:
80 PYTHON_VERSION_RAW: ${{ matrix.py }}
81 TOX_TARGET: ${{ matrix.tox-target }}
82
83 - name: Run path test
84 if: matrix.tox-target == 'tox' && matrix.py == '3.10'
85 run: tox -e path
86
87 - name: Combine coverage files
88 if: always()
89 run: tox -e coverage
90
91 - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
92 if: always()
93 env:
94 PYTHON: ${{ matrix.python }}
95 with:
96 files: .tox/coverage.xml
97 flags: tests
98 env_vars: PYTHON
99 name: ${{ matrix.py }} - ${{ matrix.os }} - ${{ matrix.tox-target }}