-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy path.gitlab-ci.yml
282 lines (248 loc) · 8.43 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
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
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
- if: $CI_PIPELINE_SOURCE == "schedule"
when: always
- if: $CI_PIPELINE_SOURCE == "web"
when: always
- when: never
variables:
ANOD_DEFAULT_SANDBOX_DIR: /it/wave
HOST: x86_64-linux
stages:
- build
default:
before_script: |
echo "before script executing..."
#######################
## colored execution ##
#######################
exec() {
# dark green + $ + command line + grey
echo -e "\e[0;32m\$ $@\e[0;37m"
$@
# save the result
res=$?
# back to normal output
echo -e -n "\e[0m"
# make sure we translate the exit code
return $res
}
# Enable generic CI for building with Anod
cmd="generic_anod_ci"
# generic anod ci requires --continuous-builder-mode when not run in a
# MR context
if [[ $CI_PIPELINE_SOURCE != "merge_request_event" ]]; then
cmd="$cmd --continuous-builder-mode"
fi
exec eval $cmd
echo "sourcing the generic CI environment"
. /tmp/ci_env.sh
# generic_anod_ci modifies the rebuild strategy of anod.
# Set it back to full, so we do not rebuild the packages depending
# on gnatcoll-core and contained in GNAT.
exec anod tune --full
exec anod vcs --list
################
# JOB TEMPLATE #
################
.job_template:
services:
- image:pe-base
- cpu:4
interruptible: true
########
# JOBS #
########
build_doc:
services:
- image:pe-base
- cpu:2
stage: build
script:
- anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
- anod build --latest gnatcoll-core-doc
- mv $ANOD_DEFAULT_SANDBOX_DIR/x86_64-linux/gnatcoll-core-doc/install doc-build
artifacts:
when:
always
paths:
- doc-build
build_and_test_windows:
services:
- image:e3-windows-2022
- platform:x86_64-windows-2022
- cpu:2
- mem:8
- disk:100
stage: build
script:
- anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
- anod build --latest gnatcoll-core
- anod test --latest gnatcoll-core -Qexternal
- working_dir=$(anod info test gnatcoll-core --show working_dir -Qexternal)
- results_dir=$working_dir/results/new
- e3-testsuite-report
--failure-exit-code 1
--xunit-output $CI_PROJECT_DIR/test.xml
--xunit-name gnatcoll-core
$results_dir || FAILED=true
# We previously prevented the pipeline from halting if a test failed, to make
# sure all tests were run. If a test failed now we exit with a non-zero code
- if [ "$FAILED" = "true" ]; then echo "There was at least one testcase failure" && exit 1; fi
allow_failure: true
artifacts:
when:
always
paths:
- test.xml
reports:
junit: test.xml
build_and_test_aarch64_linux:
services:
- image:e3-aarch64-linux
- cpu:4
- platform:aarch64-linux
stage: build
script:
- anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
- anod build --latest gnatcoll-core
- anod test --latest gnatcoll-core -Qexternal
- e3-testsuite-report
--failure-exit-code 1
--xunit-output $CI_PROJECT_DIR/test.xml
--xunit-name gnatcoll-core
$ANOD_DEFAULT_SANDBOX_DIR/aarch64-linux/gnatcoll-core_external_test/results/new/ || FAILED=true
# We previously prevented the pipeline from halting if a test failed, to make
# sure all tests were run. If a test failed now we exit with a non-zero code
- if [ "$FAILED" = "true" ]; then echo "There was at least one testcase failure" && exit 1; fi
allow_failure: true
artifacts:
when:
always
paths:
- test.xml
reports:
junit: test.xml
build_debug_mode_x86_64_linux:
extends: .job_template
stage: build
script:
- anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
- anod build --latest gnatcoll-core -Qdbg
build_and_test_x86_linux:
extends: .job_template
stage: build
script:
- cp /it/e3/lib/python3.11/site-packages/e3/os/data/rlimit-x86_64-linux /it/e3/lib/python3.11/site-packages/e3/os/data/rlimit-x86-linux
- anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
- anod build --latest --build=x86-linux gnatcoll-core
- anod test --latest --build=x86-linux gnatcoll-core -Qexternal
- e3-testsuite-report
--failure-exit-code 1
--xunit-output $CI_PROJECT_DIR/test.xml
--xunit-name gnatcoll-core
$ANOD_DEFAULT_SANDBOX_DIR/x86-linux/gnatcoll-core_external_test/results/new/ || FAILED=true
# We previously prevented the pipeline from halting if a test failed, to make
# sure all tests were run. If a test failed now we exit with a non-zero code
- if [ "$FAILED" = "true" ]; then echo "There was at least one testcase failure" && exit 1; fi
artifacts:
when:
always
paths:
- test.xml
reports:
junit: test.xml
.build_and_test_x86_64_linux_template:
extends: .job_template
stage: build
script:
- anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
- anod build --latest gnatcoll-core $BUILD_ARGS
- anod test --latest gnatcoll-core $TEST_ARGS
- e3-testsuite-report
--failure-exit-code 1
--xunit-output $CI_PROJECT_DIR/test.xml
--xunit-name gnatcoll-core
$ANOD_DEFAULT_SANDBOX_DIR/$HOST/$TEST_DIR/results/new/ || FAILED=true
# We previously prevented the pipeline from halting if a test failed, to make
# sure all tests were run. If a test failed now we exit with a non-zero code
- if [ "$FAILED" = "true" ]; then echo "There was at least one testcase failure" && exit 1; fi
artifacts:
when:
always
paths:
- test.xml
reports:
junit: test.xml
build_and_test_x86_64_linux:
extends: .build_and_test_x86_64_linux_template
variables:
BUILD_ARGS: ""
TEST_ARGS: -Qexternal
TEST_DIR: gnatcoll-core_external_test
FATAL_ERRORS: true
build_and_test_x86_64_linux_llvm:
extends: .build_and_test_x86_64_linux_template
allow_failure: true
variables:
BUILD_ARGS: -Qcompiler=gnat-llvm
TEST_ARGS: -Qcompiler=gnat-llvm
TEST_DIR: gnatcoll-core_gnat-llvm_test
FATAL_ERRORS: false
build_and_test_x86_64_linux_valgrind:
extends: .build_and_test_x86_64_linux_template
allow_failure: true
variables:
BUILD_ARGS: ""
TEST_ARGS: -Qvalgrind
TEST_DIR: gnatcoll-core_valgrind_test
FATAL_ERRORS: false # TODO: set to True once all the leaks have been fixed
build_and_test_coverage:
extends: .job_template
stage: build
script:
- anybadge -l Coverage -v "Under Construction" -f coverage.svg -c steelblue
- anybadge -l "Tests Passing" -v "Error" -f test-count.svg -c red
- anod vcs --add-repo gnatcoll-core $CI_PROJECT_DIR
- anod build --latest gnatcoll-core -Qcoverage
- anod test --latest gnatcoll-core -Qcoverage
- e3-testsuite-report
--failure-exit-code 1
--xunit-output $CI_PROJECT_DIR/test-coverage.xml
--xunit-name gnatcoll-core
$ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core_coverage_test/results/new/ || FAILED=true
# Create test count badge
- cd $CI_PROJECT_DIR
- rm test-count.svg # remove placeholder error badge
- create_xunit_badge --xunit_reports test-coverage.xml
# Move coverage reports and log coverage summaries
- mkdir $CI_PROJECT_DIR/coverage
- mv $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core_coverage_test/results/new/coverage-xml $CI_PROJECT_DIR/coverage/xml
- mv $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core_coverage_test/results/new/coverage-dhtml $CI_PROJECT_DIR/coverage/dhtml
- mv $ANOD_DEFAULT_SANDBOX_DIR/$HOST/gnatcoll-core_coverage_test/results/new/coverage-cobertura $CI_PROJECT_DIR/coverage/cobertura
- echo_coverage_stats --coverage-file $CI_PROJECT_DIR/coverage/xml/index.xml
- publish-pages ./coverage/dhtml/ --job
# We previously prevented the pipeline from halting if a test failed, to make
# sure all tests were run. If a test failed now we exit with a non-zero code
- if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
coverage: '/^Stmt Coverage:\s+(\d+\.\d+\%) \(\d+ \/ \d+\)$/'
allow_failure: true
artifacts:
when:
always
paths:
- $PACKAGE
- test-coverage.xml
- coverage.svg
- test-count.svg
- coverage/xml
- coverage/dhtml
- coverage/cobertura
reports:
junit: test-coverage.xml
coverage_report:
coverage_format: cobertura
path: coverage/cobertura/cobertura.xml
interruptible: true