-
Notifications
You must be signed in to change notification settings - Fork 34
226 lines (216 loc) · 7.73 KB
/
buildtest.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
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:28cfb9d0
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@v4
- 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_4C_build
with:
build-directory: ${{ github.workspace }}/build
retention-days: 1
- 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:28cfb9d0
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@v4
- 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_4C_build
with:
build-job: 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@v4
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@v4
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:28cfb9d0
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 }}
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@v4
- 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_4C_build
with:
build-directory: ${{ github.workspace }}/build
retention-days: 1
- name: Upload 4C schema
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-schema
path: |
${{ github.workspace }}/build/4C_schema.json
retention-days: 1
clang18_test_minimal:
needs: clang18_build
runs-on: ubuntu-latest
container:
image: ghcr.io/4c-multiphysics/4c-dependencies-ubuntu24.04:28cfb9d0
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@v4
- 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_4C_build
with:
build-job: 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:28cfb9d0
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@v4
- 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/build_4C
with:
cmake-preset: docker_clang
build-targets: install
build-directory: ${{ github.workspace }}/build
use-ccache: "true"
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@v4
- uses: actions/download-artifact@v4
with:
name: clang18_build-schema
path: ${{ github.workspace }}
- name: json-yaml-validate
uses: GrantBirki/json-yaml-validate@v3.2.1
with:
base_dir: .
json_schema: ${{ github.workspace }}/4C_schema.json
yaml_as_json: true
ajv_strict_mode: false
json_schema_version: draft-2020-12
yaml_extension: .4C.yaml
yaml_extension_short: .4C.yml
json_extension: .4C.json
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]
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) }}