-
Notifications
You must be signed in to change notification settings - Fork 33
396 lines (331 loc) · 12.1 KB
/
ci_pipeline.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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
name: CI pipeline for pySDC
on:
push:
pull_request:
schedule:
- cron: '1 5 * * 1'
jobs:
lint:
runs-on: ubuntu-latest
env:
YML: 'etc/environment-lint.yml'
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ${{ env.YML }}
create-args: >-
python=3.10
- name: Code reformatting with black
run: |
black pySDC --check --diff --color
- name: Linting with flakeheaven
run: |
flakeheaven lint --benchmark pySDC
# mirror_to_gitlab:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v1
# - name: Mirror
# uses: jakob-fritz/github2lab_action@main
# env:
# MODE: 'mirror' # Either 'mirror', 'get_status', or 'both'
# GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
# FORCE_PUSH: "true"
# GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
# GITLAB_PROJECT_ID: "3525"
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
user_cpu_tests_linux:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.8', '3.9', '3.10']
env: ['base', 'fenics', 'mpi4py', 'petsc']
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: "etc/environment-${{ matrix.env }}.yml"
create-args: >-
python=${{ matrix.python }}
- name: Run pytest for CPU stuff
run: |
echo "print('Loading sitecustomize.py...')
import coverage
coverage.process_startup() " > sitecustomize.py
coverage run -m pytest --continue-on-collection-errors -v --durations=0 pySDC/tests -m ${{ matrix.env }}
- name: Make coverage report
run: |
mv data data_${{ matrix.python }}
coverage combine
mv .coverage coverage_${{ matrix.env }}_${{ matrix.python }}.dat
- name: Uploading artifacts
uses: actions/upload-artifact@v3
if: matrix.python == '3.10'
with:
name: cpu-test-artifacts
path: |
data_3.10
coverage_${{ matrix.env }}_3.10.dat
user_libpressio_tests:
runs-on: ubuntu-latest
container:
image: brownbaerchen/libpressio:amd64_2
volumes:
- ${{ github.workspace }}:/pySDC
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install pySDC and pytest
run: |
source /pySDC/pySDC/projects/compression/Docker/install_pySDC.sh
- name: Run pytest
run: |
source /opt/spack/share/spack/setup-env.sh
spack load libpressio
coverage run -m pytest --continue-on-collection-errors -v --durations=0 pySDC/tests -m libpressio
- name: Make coverage report
run: |
source /opt/spack/share/spack/setup-env.sh
spack load libpressio
mv data data_libpressio
coverage combine
mv .coverage coverage_libpressio_3.10.dat
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: cpu-test-artifacts
path: |
data_libpressio
coverage_libpressio_3.10.dat
user_monodomain_tests_linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: "pySDC/projects/Monodomain/etc/environment-monodomain.yml"
create-args: >-
python=3.10
- name: Compile C++ ionic models
env:
IONIC_MODELS_PATH: "pySDC/projects/Monodomain/problem_classes/ionicmodels/cpp"
run: |
c++ -O3 -Wall -shared -std=c++11 -fPIC -fvisibility=hidden $(python3 -m pybind11 --includes) ${IONIC_MODELS_PATH}/bindings_definitions.cpp -o ${IONIC_MODELS_PATH}/ionicmodels$(python3-config --extension-suffix)
- name: Run pytest for CPU stuff
run: |
echo "print('Loading sitecustomize.py...')
import coverage
coverage.process_startup() " > sitecustomize.py
coverage run -m pytest --continue-on-collection-errors -v --durations=0 pySDC/tests -m monodomain
- name: Make coverage report
run: |
mv data data_monodomain
coverage combine
mv .coverage coverage_monodomain_3.10.dat
- name: Uploading artifacts
uses: actions/upload-artifact@v3
with:
name: cpu-test-artifacts
path: |
data_monodomain
coverage_monodomain_3.10.dat
# user_cpu_tests_macos:
# runs-on: macos-12
#
# strategy:
# matrix:
# env: ['base', 'fenics', 'mpi4py', 'petsc']
#
# defaults:
# run:
# shell: bash -l {0}
#
# steps:
# - name: Checkout
# uses: actions/checkout@v3
#
# - name: Install Conda environment with Micromamba
# uses: mamba-org/setup-micromamba@v1
# with:
# environment-file: "etc/environment-${{ matrix.env }}.yml"
#
# - name: Run pytest for CPU stuff
# run: |
# pytest --continue-on-collection-errors -v --durations=0 pySDC/tests -m ${{ matrix.env }}
# wait_for_gitlab:
# runs-on: ubuntu-latest
# needs:
# - mirror_to_gitlab
# steps:
# - name: Wait
# uses: jakob-fritz/github2lab_action@main
# env:
# MODE: 'get_status' # Either 'mirror', 'get_status', or 'both'
# GITLAB_TOKEN: ${{ secrets.GITLAB_SECRET_H }}
# FORCE_PUSH: "true"
# GITLAB_HOSTNAME: "codebase.helmholtz.cloud"
# GITLAB_PROJECT_ID: "3525"
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # - name: Get and prepare artifacts
# # run: |
# # pipeline_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/repository/commits/${{ github.head_ref || github.ref_name }}" | jq '.last_pipeline.id')
# # job_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/pipelines/$pipeline_id/jobs" | jq '.[] | select( .name == "bundle" ) | select( .status == "success" ) | .id')
# # curl --output artifacts.zip "https://gitlab.hzdr.de/api/v4/projects/3525/jobs/$job_id/artifacts"
# # rm -rf data
# # unzip artifacts.zip
# # ls -ratl
post-processing:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Parallel-in-Time'}}
needs:
- lint
- user_cpu_tests_linux
- user_libpressio_tests
- user_monodomain_tests_linux
# - wait_for_gitlab
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: "etc/environment-base.yml"
- name: Downloading artifacts
uses: actions/download-artifact@v3
with:
path: .
- name: Prepare artifacts
run: |
ls -artl cpu-test-artifacts
cp cpu-test-artifacts/data_3.10/* data/.
python -m coverage combine cpu-test-artifacts/coverage_*_3.10.dat
python -m coverage xml
python -m coverage html
- name: Generate Coverage badge
run: |
pip install genbadge[all]
genbadge coverage -i coverage.xml -o htmlcov/coverage-badge.svg
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
# - name: Generate benchmark report
# uses: pancetta/github-action-benchmark@v1
# if: ${{ (!contains(github.event.head_commit.message, '[CI-no-benchmarks]')) && (github.event_name == 'push') }}
# with:
# name: pySDC Benchmark with pytest-benchmark
# tool: 'pytest'
# output-file-path: benchmarks/output.json
# auto-push: false
# skip-fetch-gh-pages: true
# benchmark-data-dir-path: bench/${{ github.head_ref || github.ref_name }}
# github-token: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Push benchmark data
# uses: dmnemec/copy_file_to_another_repo_action@main
# if: "!contains(github.event.head_commit.message, '[CI-no-benchmarks]')"
# env:
# API_TOKEN_GITHUB: ${{ secrets.BENCHMARK_BOT }}
# with:
# source_file: 'bench/${{ github.head_ref || github.ref_name }}'
# destination_repo: 'Parallel-in-Time/pySDC-benchmarks'
# user_email: '[email protected]'
# user_name: 'pancetta'
- name: Build html I
run: |
chmod u+x ./docs/update_apidocs.sh
./docs/update_apidocs.sh
sphinx-build -b html docs/source docs/build/html
mkdir -p docs/build/html/coverage
mv htmlcov/* docs/build/html/coverage/.
# - name: Build html II
# if: "!contains(github.event.head_commit.message, '[CI-no-benchmarks]')"
# run: |
# mkdir -p docs/build/html/benchmarks
# cp -r bench/${{ github.head_ref || github.ref_name }}/* docs/build/html/benchmarks/.
- name: Store docs
uses: actions/upload-artifact@v3
with:
name: docs
path: docs/build/html
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
if: ${{ github.event_name == 'push' && github.repository_owner == 'Parallel-in-Time' && github.ref == 'refs/heads/master' }}
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/build/html # The folder the action should deploy.
# spawn_gitlab_and_postprocess:
# runs-on: ubuntu-latest
#
## needs:
## - lint
#
# defaults:
# run:
# shell: bash -l {0}
#
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# ref: ${{ github.event.pull_request.head.sha }}
#
# - name: Checkout benchmark repository
# uses: actions/checkout@v3
# if: ${{ github.event_name == 'push' }}
# with:
# repository: Parallel-in-Time/pySDC-benchmarks
# token: ${{ secrets.BENCHMARK_BOT }}
# path: bench
# ref: main
#
# - name: Install Conda environment with Micromamba
# uses: mamba-org/provision-with-micromamba@main
# with:
# environment-file: etc/environment-base.yml
#
# - name: Mirror + trigger CI
# uses: SvanBoxel/gitlab-mirror-and-ci-action@master
# with:
# args: "https://gitlab.hzdr.de/r.speck/pysdc"
# env:
# FORCE_PUSH: "true"
# GITLAB_HOSTNAME: "gitlab.hzdr.de"
# GITLAB_USERNAME: ${{ secrets.GITLAB_SECRET_USER }}
# GITLAB_PASSWORD: ${{ secrets.GITLAB_SECRET_PASS }}
# GITLAB_PROJECT_ID: "3525"
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Get and prepare artifacts
# run: |
# pipeline_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/repository/commits/${{ github.head_ref || github.ref_name }}" | jq '.last_pipeline.id')
# job_id=$(curl --header "PRIVATE-TOKEN: ${{ secrets.GITLAB_SECRET_H }}" --silent "https://gitlab.hzdr.de/api/v4/projects/3525/pipelines/$pipeline_id/jobs" | jq '.[] | select( .name == "bundle" ) | select( .status == "success" ) | .id')
# curl --output artifacts.zip "https://gitlab.hzdr.de/api/v4/projects/3525/jobs/$job_id/artifacts"
# rm -rf data
# unzip artifacts.zip
#