-
Notifications
You must be signed in to change notification settings - Fork 345
129 lines (121 loc) · 4.23 KB
/
pytest.yaml
File metadata and controls
129 lines (121 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Run mypy and pytest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'main'
- 'release/*'
tags:
- 'v*'
pull_request:
merge_group:
branches: ['main']
permissions:
contents: read
jobs:
pytestmypy:
runs-on: ${{ matrix.os }}
strategy:
# don't stop other jobs if one fails
# this is often due to network issues
# and or flaky tests
# and the time lost in such cases
# is bigger than the gain from canceling the job
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13", "3.14"]
min-version: [false]
include:
- os: ubuntu-latest
python-version: "3.11"
min-version: true
exclude:
- os: ubuntu-latest
python-version: "3.11"
- os: windows-latest
python-version: "3.11"
- os: windows-latest
python-version: "3.13"
- os: windows-latest
python-version: "3.14"
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
# we need full history with tags for the version number
fetch-depth: '0'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml
requirements.txt
- name: upgrade pip setuptools wheel
run: python -m pip install --upgrade pip setuptools wheel
shell: bash
- name: install qcodes with minimum requirements
run: |
pip install uv
uv pip compile pyproject.toml --extra test --resolution=lowest-direct --output-file min-requirements.txt
pip install -r min-requirements.txt
pip install .[test]
echo "PYTEST_OPT=-Wignore" >> $GITHUB_ENV
if: ${{ matrix.min-version }}
- name: install qcodes
run: |
pip install .[test] -c requirements.txt
echo "PYTEST_OPT=" >> $GITHUB_ENV
if: ${{ !matrix.min-version }}
- name: Get Pyright Version
id: pyright-version
run: |
PYRIGHT_VERSION=$(jq -r '.devDependencies.pyright' < package.json)
echo $PYRIGHT_VERSION
echo "version=$PYRIGHT_VERSION" >> $GITHUB_OUTPUT
working-directory: .github
shell: bash
# below we use always to ensure that the steps are run
# even if the previous steps fail. This allows users to get feedback
# from both typechecking and tests even if one of them fails.
- name: Run Pyright
uses: jakebailey/pyright-action@6cabc0f01c4994be48fd45cd9dbacdd6e1ee6e5e # v2.3.3
with:
version: ${{ steps.pyright-version.outputs.version }}
if: ${{ !matrix.min-version && always() }}
id: pyright
- name: Run Mypy
run: mypy -p qcodes
if: ${{ !matrix.min-version && always() }}
id: mypy
- name: Run parallel tests
if: ${{ always() }}
run: |
pytest -m "not serial" --cov --cov-report xml --hypothesis-profile ci --durations=20 $PYTEST_OPT tests
id: parallel_tests
# a subset of the tests fails when run in parallel on Windows so run those in serial here
- name: Run serial tests
if: ${{ always() }}
run: |
pytest -m "serial" -n 0 --dist no --cov --cov-report xml --cov-append --hypothesis-profile ci $PYTEST_OPT tests
id: serial_tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
files: ./coverage.xml
env_vars: OS,PYTHON
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ github.event_name != 'merge_group' }}
# we don't trigger coverage from merge groups since that would
# make twice the number of coverage reports be uploded from a given commit