-
Notifications
You must be signed in to change notification settings - Fork 66
349 lines (336 loc) · 12.2 KB
/
buildtest.yml
File metadata and controls
349 lines (336 loc) · 12.2 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
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
name: buildtest
on:
pull_request:
branches:
- main
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
gcc13_assertions_build:
runs-on: ubuntu-latest
container:
image: ghcr.io/4c-multiphysics/4c-dependencies-ubuntu24.04:35e0657d
options: --user root --env OMPI_ALLOW_RUN_AS_ROOT=1 --env OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
defaults:
run:
shell: bash
outputs:
test-chunks: ${{ steps.set-matrix.outputs.chunk-array }}
steps:
- uses: actions/checkout@v6
- name: Check docker hash
uses: ./.github/actions/compute-and-check-dependencies-hash
- uses: ./.github/actions/build_4C
with:
cmake-preset: docker_assertions
build-targets: full
build-directory: ${{ github.workspace }}/build
use-ccache: "true"
- uses: ./.github/actions/upload_directory
name: Upload 4C build
with:
directory: ${{ github.workspace }}/build
retention-days: 1
name: gcc13_assertions_build
- uses: ./.github/actions/chunk_test_suite
id: set-matrix
with:
build-directory: ${{ github.workspace }}/build
source-directory: ${{ github.workspace }}
number-of-chunks: 15
junit-report-artifact-name: gcc13_assertions_test_report.xml
gcc13_assertions_test:
needs: gcc13_assertions_build
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
container:
image: ghcr.io/4c-multiphysics/4c-dependencies-ubuntu24.04:35e0657d
options: --user root --env OMPI_ALLOW_RUN_AS_ROOT=1 --env OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
strategy:
fail-fast: false
matrix:
test-chunk: ${{fromJson(needs.gcc13_assertions_build.outputs.test-chunks)}}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
- name: Check docker hash
uses: ./.github/actions/compute-and-check-dependencies-hash
- name: Setup developer environment for testing
run: |
cd $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE
- uses: ./.github/actions/download_directory
with:
name: gcc13_assertions_build
destination: ${{ github.workspace }}/build
- name: Test
run: |
cd $GITHUB_WORKSPACE/build
ctest -I $TEST_CHUNK -j `nproc` --output-on-failure --output-junit $GITHUB_WORKSPACE/gcc13_assertions_test_report-$TEST_CHUNK.xml
env:
TEST_CHUNK: ${{ matrix.test-chunk }}
- name: Upload test report
if: success() || failure()
uses: actions/upload-artifact@v7
with:
name: gcc13_assertions_test_report-${{ matrix.test-chunk }}.xml
path: |
${{ github.workspace }}/gcc13_assertions_test_report-${{ matrix.test-chunk }}.xml
retention-days: 1
gcc13_assertions_test_report:
needs: gcc13_assertions_test
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' && (success() || failure())
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: .github
- uses: ./.github/actions/merge_junit_report_artifacts
with:
junit-report-base-name: gcc13_assertions_test_report
retention-days: 1
clang18_build:
runs-on: ubuntu-latest
container:
image: ghcr.io/4c-multiphysics/4c-dependencies-ubuntu24.04:35e0657d
options: --user root --env OMPI_ALLOW_RUN_AS_ROOT=1 --env OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
defaults:
run:
shell: bash
outputs:
cache-key: ${{ steps.build-4C.outputs.cache-key }}
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
steps:
# Due to a bug in runner action the variables $GITHUB_WORKSPACE and ${{ github.workspace }} are different inside a container. https://github.com/actions/runner/issues/2058
# The repo gets cloned to `/__w/4C/4C` ($GITHUB_WORKSPACE) while ${{ github.workspace }} points to `/home/runner/work/4C/4C`.`
# Use $GITHUB_WORKSPACE instead of ${{ github.workspace }}
- uses: actions/checkout@v6
- name: Check docker hash
uses: ./.github/actions/compute-and-check-dependencies-hash
- uses: ./.github/actions/build_4C
id: build-4C
with:
cmake-preset: docker_clang
build-targets: full
build-directory: ${{ github.workspace }}/build
use-ccache: "true"
- uses: ./.github/actions/upload_directory
name: Upload 4C build
with:
directory: ${{ github.workspace }}/build
retention-days: 1
name: clang18_build
- name: Upload ccache dir as artifact
uses: ./.github/actions/upload_directory
with:
directory: ${{ env.CCACHE_DIR }}
retention-days: 1
name: clang18_build_ccache
- name: Upload 4C schema
uses: actions/upload-artifact@v7
with:
name: ${{ github.job }}-schema
path: |
${{ github.workspace }}/build/4C_schema.json
retention-days: 1
- name: Upload 4C metadata
uses: actions/upload-artifact@v7
with:
name: ${{ github.job }}-metadata
path: |
${{ github.workspace }}/build/4C_metadata.yaml
retention-days: 1
clang18_test_minimal:
needs: clang18_build
runs-on: ubuntu-latest
container:
image: ghcr.io/4c-multiphysics/4c-dependencies-ubuntu24.04:35e0657d
options: --user root --env OMPI_ALLOW_RUN_AS_ROOT=1 --env OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
- name: Check docker hash
uses: ./.github/actions/compute-and-check-dependencies-hash
- name: Setup developer environment for testing
run: |
cd $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE
- uses: ./.github/actions/download_directory
with:
name: clang18_build
destination: ${{ github.workspace }}/build
- name: Test
run: |
cd $GITHUB_WORKSPACE/build
ctest -L minimal -j `nproc` --output-on-failure
clang18_test_install:
needs: clang18_build
runs-on: ubuntu-latest
container:
image: ghcr.io/4c-multiphysics/4c-dependencies-ubuntu24.04:35e0657d
options: --user root --env OMPI_ALLOW_RUN_AS_ROOT=1 --env OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
defaults:
run:
shell: bash
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
steps:
- uses: actions/checkout@v6
- name: Check docker hash
uses: ./.github/actions/compute-and-check-dependencies-hash
- name: Setup developer environment for testing
run: |
cd $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE
- uses: ./.github/actions/download_directory
with:
name: clang18_build_ccache
destination: ${{ env.CCACHE_DIR }}
- name: Install ccache
run: |
apt update
apt install -y ccache
- uses: ./.github/actions/build_4C
with:
cmake-preset: docker_clang
build-targets: install
build-directory: ${{ github.workspace }}/build
use-ccache: "true"
restore-ccache: "false" # do not restore the ccache from the Github cache
cache-key: ${{needs.clang18_build.outputs.cache-key}}
- name: Test the installation
run: |
cd $GITHUB_WORKSPACE/build/tests/install_test
sh test_install.sh
clang18_verify_schema:
needs: clang18_build
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: clang18_build-schema
path: ${{ github.workspace }}
- name: Validate all input files against schema
run: |
cd $GITHUB_WORKSPACE
${{ github.workspace }}/utilities/set_up_dev_env.sh
source ${{ github.workspace }}/utilities/python-venv/bin/activate
shopt -s globstar nullglob
validate-test-files --schema ${{ github.workspace }}/4C_schema.json **/*.4C.yaml **/*.4C.yml **/*.4C.json
gcc13_no_optional_dependencies_build:
runs-on: ubuntu-latest
container:
image: ghcr.io/4c-multiphysics/4c-dependencies-ubuntu24.04:35e0657d
options: --user root --env OMPI_ALLOW_RUN_AS_ROOT=1 --env OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
defaults:
run:
shell: bash
outputs:
test-chunks: ${{ steps.set-matrix.outputs.chunk-array }}
steps:
- uses: actions/checkout@v6
- name: Check docker hash
uses: ./.github/actions/compute-and-check-dependencies-hash
- uses: ./.github/actions/build_4C
with:
cmake-preset: docker_no_optional_dependencies
build-targets: full
build-directory: ${{ github.workspace }}/build
use-ccache: "true"
- uses: ./.github/actions/upload_directory
name: Upload 4C build
with:
directory: ${{ github.workspace }}/build
retention-days: 1
name: gcc13_no_optional_dependencies_build
- uses: ./.github/actions/chunk_test_suite
id: set-matrix
with:
build-directory: ${{ github.workspace }}/build
source-directory: ${{ github.workspace }}
number-of-chunks: 15
junit-report-artifact-name: gcc13_no_optional_dependencies_test_report.xml
gcc13_no_optional_dependencies_test:
needs: gcc13_no_optional_dependencies_build
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
container:
image: ghcr.io/4c-multiphysics/4c-dependencies-ubuntu24.04:35e0657d
options: --user root --env OMPI_ALLOW_RUN_AS_ROOT=1 --env OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
test-chunk: ${{fromJson(needs.gcc13_no_optional_dependencies_build.outputs.test-chunks)}}
steps:
- uses: actions/checkout@v6
- name: Check docker hash
uses: ./.github/actions/compute-and-check-dependencies-hash
- name: Setup developer environment for testing
run: |
cd $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE
- uses: ./.github/actions/download_directory
with:
name: gcc13_no_optional_dependencies_build
destination: ${{ github.workspace }}/build
- name: Test
run: |
cd $GITHUB_WORKSPACE/build
ctest -I $TEST_CHUNK -j `nproc` --output-on-failure --output-junit $GITHUB_WORKSPACE/gcc13_no_optional_dependencies_test_report-$TEST_CHUNK.xml
env:
TEST_CHUNK: ${{ matrix.test-chunk }}
- name: Upload test report
if: success() || failure()
uses: actions/upload-artifact@v7
with:
name: gcc13_no_optional_dependencies_test_report-${{ matrix.test-chunk }}.xml
path: |
${{ github.workspace }}/gcc13_no_optional_dependencies_test_report-${{ matrix.test-chunk }}.xml
retention-days: 1
gcc13_no_optional_dependencies_test_report:
needs: gcc13_no_optional_dependencies_test
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' && (success() || failure())
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: .github
- uses: ./.github/actions/merge_junit_report_artifacts
with:
junit-report-base-name: gcc13_no_optional_dependencies_test_report
retention-days: 1
ensure_all_tests_pass:
needs:
- gcc13_assertions_test
- gcc13_assertions_test_report
- gcc13_assertions_build
- clang18_build
- clang18_test_minimal
- clang18_test_install
- clang18_verify_schema
- gcc13_no_optional_dependencies_build
- gcc13_no_optional_dependencies_test
- gcc13_no_optional_dependencies_test_report
runs-on: ubuntu-latest
if: always() && github.ref != 'refs/heads/main'
steps:
- name: Check for successful builds and tests
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}