forked from pybamm-team/PyBaMM
-
Notifications
You must be signed in to change notification settings - Fork 0
301 lines (247 loc) · 9.45 KB
/
run_periodic_tests.yml
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# Run all unit tests and integration tests for all Python versions
# and platforms at 3am UTC every day and on PRs to the main branch
name: Scheduled
on:
workflow_dispatch:
pull_request:
branches:
- main
# Run every day at 3 am UTC
schedule:
- cron: "0 3 * * *"
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:
run_unit_tests:
name: Unit tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, macos-14, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
# Exclude Python 3.12 from unit tests since we run it in the coverage jobs
exclude:
- os: ubuntu-latest
python-version: "3.12"
steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4
- name: Install Linux system dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install gfortran gcc graphviz pandoc libopenblas-dev texlive-latex-extra dvipng
- name: Install macOS system dependencies
if: matrix.os == 'macos-12' || matrix.os == 'macos-14'
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_COLOR: 1
# Speed up CI
NONINTERACTIVE: 1
# sometimes gfortran cannot be found, so reinstall gcc just to be sure
run: |
brew analytics off
brew install graphviz libomp
brew reinstall gcc
- name: Install Windows system dependencies
if: matrix.os == 'windows-latest'
run: choco install graphviz --version=8.0.5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install nox
run: python -m pip install nox
- name: Install SuiteSparse and SUNDIALS on GNU/Linux and macOS
timeout-minutes: 10
if: matrix.os != 'windows-latest'
run: python -m nox -s pybamm-requires
- name: Run unit tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
run: python -m nox -s unit
check_coverage:
runs-on: ubuntu-latest
name: Coverage tests (ubuntu-latest / Python 3.12)
steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4
- name: Install Linux system dependencies
run: |
sudo apt-get update
sudo apt-get install gfortran gcc graphviz pandoc libopenblas-dev texlive-latex-extra dvipng
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install nox
run: python -m pip install nox
- name: Install SuiteSparse and SUNDIALS on GNU/Linux
timeout-minutes: 10
run: python -m nox -s pybamm-requires
- name: Run unit tests for Ubuntu with Python 3.12 and generate coverage report
run: python -m nox -s coverage
- name: Upload coverage report
uses: codecov/[email protected]
if: github.repository == 'pybamm-team/PyBaMM'
with:
token: ${{ secrets.CODECOV_TOKEN }}
run_integration_tests:
name: Integration tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, macos-14, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4
- name: Install Linux system dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install gfortran gcc graphviz pandoc libopenblas-dev texlive-latex-extra dvipng
- name: Install macOS system dependencies
if: matrix.os == 'macos-12' || matrix.os == 'macos-14'
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_COLOR: 1
# Speed up CI
NONINTERACTIVE: 1
# sometimes gfortran cannot be found, so reinstall gcc just to be sure
run: |
brew analytics off
brew install graphviz
brew reinstall gcc
- name: Install Windows system dependencies
if: matrix.os == 'windows-latest'
run: choco install graphviz --version=8.0.5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install nox
run: python -m pip install nox
- name: Install SuiteSparse and SUNDIALS on GNU/Linux and macOS
timeout-minutes: 10
if: matrix.os != 'windows-latest'
run: python -m nox -s pybamm-requires
- name: Run integration tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
run: python -m nox -s integration
# Skips IDAKLU module compilation for speedups, which is already tested in other jobs.
run_doctests:
runs-on: ubuntu-latest
name: Doctests (ubuntu-latest / Python 3.11)
steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Linux system dependencies
run: |
sudo apt-get update
sudo apt-get install graphviz pandoc libopenblas-dev texlive-latex-extra dvipng
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install nox
run: python -m pip install nox
- name: Install docs dependencies and run doctests for GNU/Linux
run: python -m nox -s doctests
- name: Check if the documentation can be built for GNU/Linux
run: python -m nox -s docs
run_example_tests:
runs-on: ubuntu-latest
name: Example notebooks (ubuntu-latest / Python 3.12)
steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4
- name: Install Linux system dependencies
run: |
sudo apt-get update
sudo apt-get install gfortran gcc graphviz pandoc libopenblas-dev texlive-latex-extra dvipng
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install nox
run: python -m pip install nox
- name: Install SuiteSparse and SUNDIALS on GNU/Linux
timeout-minutes: 10
run: python -m nox -s pybamm-requires
- name: Run example notebooks tests for GNU/Linux with Python 3.12
run: python -m nox -s examples
run_scripts_tests:
runs-on: ubuntu-latest
name: Example scripts (ubuntu-latest / Python 3.12)
steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4
- name: Install Linux system dependencies
run: |
sudo apt-get update
sudo apt install gfortran gcc graphviz libopenblas-dev texlive-latex-extra dvipng
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install nox
run: python -m pip install nox
- name: Install SuiteSparse and SUNDIALS on GNU/Linux
timeout-minutes: 10
run: python -m nox -s pybamm-requires
- name: Run example scripts tests for GNU/Linux with Python 3.12
run: python -m nox -s scripts
# M-series Mac Mini
build-apple-mseries:
if: github.repository_owner == 'pybamm-team'
runs-on: [self-hosted, macOS, ARM64]
env:
GITHUB_PATH: ${PYENV_ROOT/bin:$PATH}
LD_LIBRARY_PATH: $HOME/.local/lib
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4
- name: Install Python & create virtualenv
shell: bash
run: |
eval "$(pyenv init -)"
pyenv install ${{ matrix.python-version }} -s
pyenv virtualenv ${{ matrix.python-version }} pybamm-${{ matrix.python-version }}
- name: Install build-time dependencies & run unit tests for M-series macOS runner
shell: bash
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
NONINTERACTIVE: 1
run: |
eval "$(pyenv init -)"
pyenv activate pybamm-${{ matrix.python-version }}
python -m pip install --upgrade pip nox
python -m nox -s pybamm-requires -- --force
python -m nox -s unit
- name: Run integration tests for M-series macOS runner
run: |
eval "$(pyenv init -)"
pyenv activate pybamm-${{ matrix.python-version }}
python -m nox -s integration
- name: Uninstall pyenv-virtualenv & Python
if: always()
shell: bash
run: |
eval "$(pyenv init -)"
pyenv activate pybamm-${{ matrix.python-version }}
pyenv uninstall -f $( python --version )