forked from pybop-team/PyBOP
-
Notifications
You must be signed in to change notification settings - Fork 0
217 lines (180 loc) · 6.31 KB
/
test_on_pull_request.yaml
File metadata and controls
217 lines (180 loc) · 6.31 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Pull Request
on:
workflow_dispatch:
pull_request:
# Add colors to nox/pytest
env:
FORCE_COLOR: 3
concurrency:
# github.workflow: name of the workflow, so that we don't cancel other workflows
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# Cancel in-progress runs when a new workflow with the same group name is triggered
# This avoids workflow runs on both pushes and PRs
cancel-in-progress: true
jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.11
- name: Check formatting with pre-commit
run: |
python -m pip install pre-commit
pre-commit run ruff
integration_tests:
needs: style
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.12", "3.13"]
name: Integration tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip nox[uv]
- name: Integration tests
run: |
nox -s integration
unit_tests:
needs: style
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-15-intel, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
exclude: # We run the coverage tests on macOS (arm64) with Python 3.12
- os: macos-latest
python-version: "3.12"
name: Unit tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip nox[uv]
- name: Unit tests
run: |
nox -s unit
example_scripts:
needs: style
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.12"]
name: Test examples (${{ matrix.os }} / Python ${{ matrix.python-version }})
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip nox[uv]
- name: Run examples
run: |
nox -s examples
example_notebooks:
needs: style
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
python-version: ["3.12"]
name: Test notebooks (${{ matrix.os }} / Python ${{ matrix.python-version }})
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip nox[uv] openpyxl ipywidgets
- name: Run notebooks
run: |
nox -s notebooks
# Quick benchmarks on macOS (arm64)
benchmarks:
needs: style
runs-on: macos-latest
strategy:
fail-fast: false
name: Benchmarks
steps:
- name: Check out PyBOP repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 2
persist-credentials: false
- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.12
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip asv[virtualenv]
- name: Run quick benchmarks
shell: bash
run: |
asv machine --machine "GitHubRunner"
asv run --machine "GitHubRunner" --quick --show-stderr
# Runs only on macOS (arm64) with Python 3.12
check_coverage:
needs: style
runs-on: macos-latest
strategy:
fail-fast: false
name: Coverage tests (macos-latest / Python 3.12)
steps:
- name: Check out PyBOP repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python 3.12
id: setup-python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.12
cache: 'pip'
cache-dependency-path: setup.py
- name: Install dependencies
run: python -m pip install --upgrade pip nox[uv]
- name: Run coverage tests for macos-latest with Python 3.12 and generate report
run: nox -s coverage
- name: Upload coverage report
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}