-
Notifications
You must be signed in to change notification settings - Fork 0
335 lines (309 loc) · 10.4 KB
/
reusable_test_framework.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
name: 'Build, install and test Arcane Framework'
on:
workflow_call:
inputs:
image:
description: 'Docker image for the workflow'
type: string
required: true
compilo_name:
description: 'Compiler name (gcc, clang)'
type: string
required: false
default: 'gcc'
compilo_version:
description: 'Compiler version (12, 16, ...)'
type: string
required: false
default: ''
mpi:
description: 'MPI (OMPI, MPICH)'
type: string
required: false
default: 'OMPI'
cuda:
description: 'CUDA version (cuda-XXX or false)'
type: string
required: false
default: 'false'
use_acpp:
description: 'Use AdaptiveCPP ?'
type: boolean
required: false
default: false
type_build:
description: 'Type of build (Debug, Check, Release)'
type: string
required: false
default: 'Release'
cmake_additionnal_args:
description: 'Additionnal arguments for configure'
type: string
required: false
default: ''
verbose:
description: 'Add verbose args for make/ninja'
type: boolean
required: false
default: false
ccache_debug_mode:
description: 'Activate CCache debug mode'
type: boolean
required: false
default: false
with_samples:
description: 'Compile samples too ? Require install_dir.'
type: boolean
required: false
default: true
with_rand_script:
description: 'Disabling randomly selected packages ?'
type: boolean
required: false
default: false
execute_tests:
description: 'Execute tests ?'
type: boolean
required: false
default: true
excluded_tests:
description: 'Regex with exclude tests'
type: string
required: false
default: ''
excluded_tests_with_labels:
description: 'Labels of exclude tests'
type: string
required: false
default: ''
ctest_additionnal_args:
description: 'Additionnal arguments for testing'
type: string
required: false
default: ''
use_cache:
description: 'Use cache ? (true/false)'
type: string
required: false
default: 'true'
cache_key_prefix:
description: 'Cache key prefix'
type: string
required: false
default: 'aio'
env:
# OpenMPI
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
# To tell OpenMPI we may use more processus than available cores
OMPI_MCA_rmaps_base_oversubscribe : true
jobs:
build-install-test:
name: 'Build, install and test Arcane Framework'
runs-on: ubuntu-latest
container:
image: ${{inputs.image}}
steps:
- name: Display CPU infos
shell: bash
run: |
cat /proc/cpuinfo
- name: Display disks infos
shell: bash
run: |
df -h
- name: Define environment paths
shell: bash
run: |
echo "SOURCE_DIR=${GITHUB_WORKSPACE}/framework" >> $GITHUB_ENV
echo "BUILD_DIR=${GITHUB_WORKSPACE}/build" >> $GITHUB_ENV
echo "INSTALL_DIR=${GITHUB_WORKSPACE}/install" >> $GITHUB_ENV
echo "LOG_DIR=${GITHUB_WORKSPACE}/log" >> $GITHUB_ENV
echo "CT_RESULT_DIR=${GITHUB_WORKSPACE}/test" >> $GITHUB_ENV
if [[ "${{ inputs.use_cache }}" == "true" ]]; then
echo "CCACHE_DIR=${GITHUB_WORKSPACE}/ccache" >> $GITHUB_ENV
else
echo "CCACHE_DIR=" >> $GITHUB_ENV
fi
- name: Create paths
shell: bash
run: |
mkdir ${{ env.SOURCE_DIR }} \
${{ env.BUILD_DIR }} \
${{ env.INSTALL_DIR }} \
${{ env.LOG_DIR }} \
${{ env.CT_RESULT_DIR }}
if [[ "${{ inputs.use_cache }}" == "true" ]]; then
mkdir ${{ env.CCACHE_DIR }}
fi
- name: Set MPICH as default MPI
if: "${{ inputs.mpi == 'MPICH' }}"
shell: bash
run: |
source /root/scripts/use_mpich.sh
- name: Set OpenMPI as default MPI
if: "${{ inputs.mpi == 'OMPI' }}"
shell: bash
run: |
source /root/scripts/use_openmpi.sh
- name: Set C++ compiler
shell: bash
run: |
if [[ "${{ inputs.compilo_version }}" == "" ]]; then
source /root/scripts/use_${{inputs.compilo_name}}.sh
else
source /root/scripts/use_${{inputs.compilo_name}}-${{inputs.compilo_version}}.sh
fi
- name: Set CUDA
if: "${{ inputs.cuda != 'false' }}"
shell: bash
run: |
source /root/scripts/use_${{inputs.cuda}}.sh
- name: Get date
shell: bash
run: |
echo "m_date=$(/bin/date -u '+%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Get cache for ccache tool
if: "${{ inputs.use_cache == 'true' }}"
uses: actions/cache@v4
with:
path: ${{env.CCACHE_DIR}}
key: ${{ inputs.cache_key_prefix }}-${{ env.m_date }}-${{ github.run_number }}
restore-keys: ${{ inputs.cache_key_prefix }}-
- name: Checkout framework
uses: actions/checkout@v4
with:
path: ${{ env.SOURCE_DIR }}
submodules: true
- name: Disabling randomly selected packages
if: ${{ inputs.with_rand_script }}
shell: bash
run: |
chmod u+x ${{ env.SOURCE_DIR }}/.github/scripts/rand_pkg.sh
MRAND=$(${{ env.SOURCE_DIR }}/.github/scripts/rand_pkg.sh)
echo "$MRAND"
echo "M_RAND=$MRAND" >> $GITHUB_ENV
- name: Display disks infos and size of directories
shell: bash
run: |
df -h
dum(){
DIR="${1:-0}"
CMDD=$(du -ahc --time --max-depth=1 "${DIR}")
grep -E -- '$(echo "${CMDD}" | tail -n1)|$' <(echo "${CMDD}" | sort -h)
}
echo "::group::SOURCE_DIR :"
dum "${{ env.SOURCE_DIR }}"
echo "::endgroup::"
echo "::group::BUILD_DIR :"
dum "${{ env.BUILD_DIR }}"
echo "::endgroup::"
echo "::group::INSTALL_DIR :"
dum "${{ env.INSTALL_DIR }}"
echo "::endgroup::"
echo "::group::LOG_DIR :"
dum "${{ env.LOG_DIR }}"
echo "::endgroup::"
echo "::group::CT_RESULT_DIR :"
dum "${{ env.CT_RESULT_DIR }}"
echo "::endgroup::"
if [[ "${{ inputs.use_cache }}" == "true" ]]; then
echo "::group::CCACHE_DIR :"
dum "${{ env.CCACHE_DIR }}"
echo "::endgroup::"
fi
- name: Build and install framework
uses: arcaneframework/gh_actions/build_install_framework@v2.2.0
with:
source_dir: ${{ env.SOURCE_DIR }}
build_dir: ${{ env.BUILD_DIR }}
install_dir: ${{ env.INSTALL_DIR }}
log_dir: ${{ env.LOG_DIR }}
cache_dir: ${{ env.CCACHE_DIR }}
max_size_cache_dir: 1G
ccache_debug_mode: ${{ inputs.ccache_debug_mode }}
cmake_additionnal_args: '${{ env.CMAKE_ADD_ARGS }} ${{ inputs.cmake_additionnal_args }} ${{ env.M_RAND }}'
verbose: ${{ inputs.verbose }}
type_build: ${{ inputs.type_build }}
compilo: ${{ inputs.compilo_name }}
with_cuda: ${{ inputs.cuda != 'false' }}
with_acpp: ${{ inputs.use_acpp }}
with_samples: ${{ inputs.with_samples }}
- name: Upload log artifact
if: ${{ failure() || inputs.ccache_debug_mode == 'true' }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.cache_key_prefix }}-log_config_build-artifact
path: ${{ env.LOG_DIR }}
retention-days: 7
- name: Display disks infos and size of directories
shell: bash
run: |
df -h
dum(){
DIR="${1:-0}"
CMDD=$(du -ahc --time --max-depth=1 "${DIR}")
grep -E -- '$(echo "${CMDD}" | tail -n1)|$' <(echo "${CMDD}" | sort -h)
}
echo "::group::SOURCE_DIR :"
dum "${{ env.SOURCE_DIR }}"
echo "::endgroup::"
echo "::group::BUILD_DIR :"
dum "${{ env.BUILD_DIR }}"
echo "::endgroup::"
echo "::group::INSTALL_DIR :"
dum "${{ env.INSTALL_DIR }}"
echo "::endgroup::"
echo "::group::LOG_DIR :"
dum "${{ env.LOG_DIR }}"
echo "::endgroup::"
echo "::group::CT_RESULT_DIR :"
dum "${{ env.CT_RESULT_DIR }}"
echo "::endgroup::"
if [[ "${{ inputs.use_cache }}" == "true" ]]; then
echo "::group::CCACHE_DIR :"
dum "${{ env.CCACHE_DIR }}"
echo "::endgroup::"
fi
- name: Test
if: ${{ inputs.execute_tests }}
shell: bash
run: |
mkdir -p ${{ env.CT_RESULT_DIR }}
ARCANE_CHECK=1 ctest --test-dir ${{ env.BUILD_DIR }} --output-junit ${{ env.CT_RESULT_DIR }}/results.xml --output-on-failure -E '${{inputs.excluded_tests}}' -LE '${{inputs.excluded_tests_with_labels}}' ${{inputs.ctest_additionnal_args}}
- name: Display disks infos and size of directories
shell: bash
run: |
df -h
dum(){
DIR="${1:-0}"
CMDD=$(du -ahc --time --max-depth=1 "${DIR}")
grep -E -- '$(echo "${CMDD}" | tail -n1)|$' <(echo "${CMDD}" | sort -h)
}
echo "::group::SOURCE_DIR :"
dum "${{ env.SOURCE_DIR }}"
echo "::endgroup::"
echo "::group::BUILD_DIR :"
dum "${{ env.BUILD_DIR }}"
echo "::endgroup::"
echo "::group::INSTALL_DIR :"
dum "${{ env.INSTALL_DIR }}"
echo "::endgroup::"
echo "::group::LOG_DIR :"
dum "${{ env.LOG_DIR }}"
echo "::endgroup::"
echo "::group::CT_RESULT_DIR :"
dum "${{ env.CT_RESULT_DIR }}"
echo "::endgroup::"
if [[ "${{ inputs.use_cache }}" == "true" ]]; then
echo "::group::CCACHE_DIR :"
dum "${{ env.CCACHE_DIR }}"
echo "::endgroup::"
fi
- name: Upload test artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.cache_key_prefix }}-test-artifact
path: ${{ env.CT_RESULT_DIR }}
retention-days: 7