This repository has been archived by the owner on Jul 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
242 lines (219 loc) · 7.57 KB
/
.gitlab-ci.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
stages:
- lint
- image
- test
- demo
- release
default:
tags:
- docker
variables:
CONTAINER_COMMIT_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
CONTAINER_LATEST_IMAGE: $CI_REGISTRY_IMAGE:latest
CI_RUNNER_ARCHITECTURE: amd64
CI_RUNNER_JOBMAXNPROCS: 8
# jobs
ruff:
stage: lint
image: dolfinx/dev-env:current
script:
- pip install ruff
- ruff check .
mypy:
stage: lint
image: dolfinx/dev-env:current
script:
- pip install mypy
- mypy .
.image build:
stage: image
image: docker:latest
variables:
TARGET_PLATFORM: linux/$TARGET_ARCH
script:
- echo CONTAINER_COMMIT_IMAGE = "$CONTAINER_COMMIT_IMAGE"
- echo CONTAINER_LATEST_IMAGE = "$CONTAINER_LATEST_IMAGE"
- echo DOLFINY_IMAGE_BUILDARGS = "$DOLFINY_IMAGE_BUILDARGS"
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker buildx create
--driver=docker-container
--name=multi
--platform="$TARGET_PLATFORM"
--bootstrap
- docker buildx build
--cache-to=type=inline
--cache-from=type=registry,ref="$CONTAINER_COMMIT_IMAGE-$TARGET_ARCH"
--cache-from=type=registry,ref="$CONTAINER_LATEST_IMAGE-$TARGET_ARCH"
--tag="$CONTAINER_COMMIT_IMAGE-$TARGET_ARCH"
--pull
--load
--builder=multi --platform="$TARGET_PLATFORM" $DOLFINY_IMAGE_BUILDARGS
--file docker/Dockerfile
.
- docker push "$CONTAINER_COMMIT_IMAGE-$TARGET_ARCH"
rules:
- if: ($CI_RUNNER_ARCHITECTURE == $TARGET_ARCH)
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_PIPELINE_SOURCE == "schedule")
- exists:
- Dockerfile
when: manual
allow_failure: true
image build:
extends: .image build
parallel:
matrix:
- TARGET_ARCH: [amd64, arm64]
image release:
stage: release
image: docker:latest
script:
- echo "Gitlab registry -- login, tag, manifest and push"
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CONTAINER_COMMIT_IMAGE-amd64
- docker pull $CONTAINER_COMMIT_IMAGE-arm64
- docker manifest create $CONTAINER_COMMIT_IMAGE $CONTAINER_COMMIT_IMAGE-amd64 $CONTAINER_COMMIT_IMAGE-arm64
- docker manifest push $CONTAINER_COMMIT_IMAGE
- docker manifest create $CONTAINER_LATEST_IMAGE $CONTAINER_COMMIT_IMAGE-amd64 $CONTAINER_COMMIT_IMAGE-arm64
- docker manifest push $CONTAINER_LATEST_IMAGE
- echo "DockerHub registry -- login, tag, manifest and push"
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD
- docker tag $CONTAINER_COMMIT_IMAGE-amd64 $DOCKERHUB_COMMIT_IMAGE-amd64
- docker tag $CONTAINER_COMMIT_IMAGE-arm64 $DOCKERHUB_COMMIT_IMAGE-arm64
- docker push $DOCKERHUB_COMMIT_IMAGE-amd64
- docker push $DOCKERHUB_COMMIT_IMAGE-arm64
- docker manifest create $DOCKERHUB_COMMIT_IMAGE $DOCKERHUB_COMMIT_IMAGE-amd64 $DOCKERHUB_COMMIT_IMAGE-arm64
- docker manifest push $DOCKERHUB_COMMIT_IMAGE
- echo "DockerHub registry -- pull and test"
- docker manifest inspect $DOCKERHUB_COMMIT_IMAGE
- docker run --platform linux/amd64 $DOCKERHUB_COMMIT_IMAGE uname -m > amd64.txt
- grep -q "x86_64" amd64.txt
- docker run --platform linux/arm64 $DOCKERHUB_COMMIT_IMAGE uname -m > arm64.txt
- grep -q "aarch64" arm64.txt
rules:
- if: $DOLFINY_IMAGE_RELEASE == "no"
when: never
- if: $CI_COMMIT_TAG
variables:
DOCKERHUB_COMMIT_IMAGE: dolfiny/dolfiny:$CI_COMMIT_TAG
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule")
variables:
DOCKERHUB_COMMIT_IMAGE: dolfiny/dolfiny:nightly
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH)
variables:
DOCKERHUB_COMMIT_IMAGE: dolfiny/dolfiny:latest
wheel release:
stage: release
image: dolfinx/dev-env:current
variables:
PYPI_PACKAGES_URL: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi
script:
- pip3 install build twine
- python3 -m build
- python3 -m twine upload -u gitlab-ci-token -p ${CI_JOB_TOKEN} --repository-url ${PYPI_PACKAGES_URL} dist/*
only:
- tags
.install_template:
image: $CONTAINER_COMMIT_IMAGE-$CI_RUNNER_ARCHITECTURE
.test_template:
stage: test
extends: .install_template
artifacts:
name: "$CI_PROJECT_NAME-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG-artifacts"
paths:
- "test/*/*"
expire_in: 1 week
test/unit/serial:
extends: .test_template
script:
- cd test/unit
- python3 -u -m pytest -n $CI_RUNNER_JOBMAXNPROCS -vsx .
test/unit/parallel:
extends: .test_template
script:
- cd test/unit
- mpirun -n $CI_RUNNER_JOBMAXNPROCS python3 -u -m pytest -vsx .
test/convergence:
extends: .test_template
script:
- cd test/convergence
- python3 -u -m pytest -n $CI_RUNNER_JOBMAXNPROCS -m 'convergence' -vsx .
- python3 -u -m pytest -n $CI_RUNNER_JOBMAXNPROCS -m 'postprocess' -vsx .
rules:
- if: ($DOLFINY_TEST_CONVERGENCE == "yes")
- exists:
- "test/convergence/*.py"
when: manual
allow_failure: true
.demo_template:
stage: demo
extends: .install_template
rules:
- if: ($CI_PIPELINE_SOURCE == "merge_request_event")
- if: ($CI_PIPELINE_SOURCE == "schedule")
- if: ($CI_PIPELINE_SOURCE == "push")
changes:
- "demo/*/*.py"
- exists:
- "demo/*/*.py"
when: manual
allow_failure: true
artifacts:
name: "$CI_PROJECT_NAME-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG-artifacts"
paths:
- "demo/*/*"
expire_in: 1 week
demo/bingham:
extends: .demo_template
script:
- cd demo/bingham
- mpirun -n 4 python3 bingham_block.py
- mpirun -n 4 python3 bingham_lm_block.py
demo/beam:
extends: .demo_template
script:
- cd demo/beam
- mpirun -n 4 python3 beam_curved_finitestrain_bstar.py
- mpirun -n 1 python3 beam_curved_finitestrain_bstar.py
- mpirun -n 4 python3 beam_curved_finitestrain_bzero.py
- mpirun -n 1 python3 beam_curved_finitestrain_bzero.py
demo/vsolid:
extends: .demo_template
script:
- cd demo/vsolid
- mpirun -n 4 python3 duffing.py
- mpirun -n 4 python3 solid_disp_tda.py
- mpirun -n 4 python3 solid_dispstress_tda.py
- mpirun -n 4 python3 solid_velostress_tda.py
demo/plasticity:
extends: .demo_template
script:
- cd demo/plasticity
- mpirun -n 4 python3 solid_plasticity_monolithic.py
demo/plasticity_rankine:
extends: .demo_template
script:
- cd demo/plasticity_rankine
- mpirun -n 4 python3 rankine.py
demo/spectral:
extends: .demo_template
script:
- cd demo/spectral
- mpirun -n 4 python3 spectral_elasticity.py
demo/continuation:
extends: .demo_template
script:
- cd demo/continuation
- mpirun -n 1 python3 continuation_planartruss.py
- mpirun -n 1 python3 continuation_planartruss_disp.py
- mpirun -n 1 python3 continuation_spatialtruss.py
- mpirun -n 1 python3 continuation_stardome.py
- mpirun -n 1 python3 continuation_schwedler.py
demo/tdnns:
extends: .demo_template
script:
- cd demo/tdnns
- mpirun -n 4 python3 solid_tdnns_2d_cantilever.py
- mpirun -n 4 python3 solid_tdnns_3d_cantilever.py
- mpirun -n 4 python3 solid_tdnns_3d_spanner.py
- mpirun -n 4 python3 solid_displ_3d_spanner.py
- mpirun -n 4 python3 solid_mixed_3d_spanner.py