-
Notifications
You must be signed in to change notification settings - Fork 38
236 lines (225 loc) · 8.35 KB
/
run-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
name: Run tests and style checks
on:
push:
branches:
- "**"
pull_request:
branches:
- main
schedule:
- cron: "0 7 * * 1"
jobs:
configure-docker:
name: Configure options for Docker image
runs-on: ubuntu-latest
outputs:
dockertag: ${{ steps.dockertag.outputs.tag }}
buildneeded: ${{ steps.diff.outputs.changed }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get main Dockerfile
run: |
git clone https://github.com/bempp/bempp-cl.git bempp-main
cp bempp-main/Dockerfile Dockerfile.old
rm -rf bempp-main
if: github.ref != 'refs/heads/main'
- name: Make dummy old Dockerfile
run: touch Dockerfile.old
if: github.ref == 'refs/heads/main'
- name: compare Dockerfile with old Dockerfile
id: diff
run: |
if diff Dockerfile Dockerfile.old > /dev/null; then
echo "changed=no" >> $GITHUB_OUTPUT
else
echo "changed=yes" >> $GITHUB_OUTPUT
fi
- name: set Docker tag
run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "tag=main" >> $GITHUB_OUTPUT
elif [ "${{ steps.diff.outputs.changed }}" = "yes" ]; then
the_tag=($(echo "${{ github.ref }}" | sha1sum))
echo "tag=$the_tag" >> $GITHUB_OUTPUT
else
echo "tag=main" >> $GITHUB_OUTPUT
fi
id: dockertag
build-and-publish-docker-fenicsx:
name: Build testing docker image with FEniCSx
runs-on: ubuntu-latest
needs:
- configure-docker
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
if: needs.configure-docker.outputs.buildneeded == 'yes'
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: needs.configure-docker.outputs.buildneeded == 'yes'
- name: Build and push testing Docker image with FEniCSx
uses: docker/build-push-action@v2
with:
push: true
tags: bempp/cl-dev-env-with-dolfinx:${{ needs.configure-docker.outputs.dockertag }}
target: bempp-dev-env-with-dolfinx
if: needs.configure-docker.outputs.buildneeded == 'yes'
- name: Push latest tag
uses: docker/build-push-action@v2
with:
push: true
tags: bempp/cl-dev-env-with-dolfinx:latest
target: bempp-dev-env-with-dolfinx
if: ${{ github.repository == 'bempp/bempp-cl' && github.ref == 'refs/heads/main' }}
- name: Build and push testing Docker image with FEniCSx (Numba only version)
uses: docker/build-push-action@v2
with:
push: true
tags: bempp/cl-dev-env-with-dolfinx-numba:${{ needs.configure-docker.outputs.dockertag }}
target: bempp-dev-env-with-dolfinx-numba
if: needs.configure-docker.outputs.buildneeded == 'yes'
- name: Push latest tag (Numba only version)
uses: docker/build-push-action@v2
with:
push: true
tags: bempp/cl-dev-env-with-dolfinx-numba:latest
target: bempp-dev-env-with-dolfinx-numba
if: ${{ github.repository == 'bempp/bempp-cl' && github.ref == 'refs/heads/main' }}
build-and-publish-docker:
name: Build testing docker image
runs-on: ubuntu-latest
needs:
- configure-docker
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
if: needs.configure-docker.outputs.buildneeded == 'yes'
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: needs.configure-docker.outputs.buildneeded == 'yes'
- name: Build and push testing Docker image
uses: docker/build-push-action@v2
with:
push: true
tags: bempp/cl-dev-env:${{ needs.configure-docker.outputs.dockertag }}
target: bempp-dev-env
if: needs.configure-docker.outputs.buildneeded == 'yes'
- name: Push latest tag
uses: docker/build-push-action@v2
with:
push: true
tags: bempp/cl-dev-env:latest
target: bempp-dev-env
if: ${{ github.repository == 'bempp/bempp-cl' && github.ref == 'refs/heads/main' }}
- name: Build and push testing Docker image (Numba only version)
uses: docker/build-push-action@v2
with:
push: true
tags: bempp/cl-dev-env-numba:${{ needs.configure-docker.outputs.dockertag }}
target: bempp-dev-env-numba
if: needs.configure-docker.outputs.buildneeded == 'yes'
- name: Push latest tag (Numba only version)
uses: docker/build-push-action@v2
with:
push: true
tags: bempp/cl-dev-env-numba:latest
target: bempp-dev-env-numba
if: ${{ github.repository == 'bempp/bempp-cl' && github.ref == 'refs/heads/main' }}
style-checks:
name: Run style checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- run: python3 -m pip install .[style]
name: Install Bempp with optional style dependencies
- run: |
python3 -m ruff check bempp_cl
python3 -m ruff check test
python3 -m ruff check examples
python3 -m ruff format --check bempp_cl
python3 -m ruff format --check test
python3 -m ruff format --check examples
name: Run flake8 checks
- run: python3 -m pydocstyle bempp_cl/api
name: Run pydocstyle checks
build-and-test:
name: Build Bempp and run tests
needs:
- configure-docker
- build-and-publish-docker
- style-checks
runs-on: ubuntu-latest
container: bempp/cl-dev-env-numba:${{ needs.configure-docker.outputs.dockertag }}
steps:
- uses: actions/checkout@v4
- run: python3 -m pip install .[test]
name: Install Bempp
- run: python3 -m pytest -n4 --durations=50 test/unit --has-dolfin 0 --has-dolfinx 0 --has-exafmm 1
name: Run Bempp unit tests
build-and-test-with-fenicsx:
name: Build Bempp and run tests with FEniCSx
needs:
- configure-docker
- build-and-publish-docker-fenicsx
- style-checks
runs-on: ubuntu-latest
container: bempp/cl-dev-env-with-dolfinx-numba:${{ needs.configure-docker.outputs.dockertag }}
steps:
- uses: actions/checkout@v4
- run: python3 -m pip install .[test]
name: Install Bempp
- run: python3 -m pytest -n4 --durations=50 test/unit --has-dolfin 0 --has-dolfinx 1 --has-exafmm 1
name: Run Bempp unit tests
large-tests:
name: Run large tests
needs:
- configure-docker
- build-and-publish-docker
- style-checks
runs-on: ubuntu-latest
container: bempp/cl-dev-env-numba:${{ needs.configure-docker.outputs.dockertag }}
steps:
- uses: actions/checkout@v4
- run: python3 -m pip install .[test]
name: Install Bempp
- run: python3 -m pytest --durations=10 test/validation --has-dolfin 0 --has-dolfinx 0 --has-exafmm 1 --skip ci
name: Run Bempp validation tests
run-examples:
name: Run examples
needs:
- configure-docker
- build-and-publish-docker
- style-checks
runs-on: ubuntu-latest
container: bempp/cl-dev-env-numba:${{ needs.configure-docker.outputs.dockertag }}
steps:
- uses: actions/checkout@v4
- run: python3 -m pip install .[test]
name: Install Bempp
- run: python3 -m pytest examples/test.py --has-dolfin 0 --has-dolfinx 0 --has-exafmm 1
name: Run Bempp examples
run-examples-fenicsx:
name: Run examples with FEniCSx
needs:
- configure-docker
- build-and-publish-docker-fenicsx
- style-checks
runs-on: ubuntu-latest
container: bempp/cl-dev-env-with-dolfinx-numba:${{ needs.configure-docker.outputs.dockertag }}
steps:
- uses: actions/checkout@v4
- run: python3 -m pip install .[test]
name: Install Bempp
- run: python3 -m pytest examples/test.py --has-dolfin 0 --has-dolfinx 1 --has-exafmm 1 --dolfin-books-only 1
name: Run Bempp examples