-
Notifications
You must be signed in to change notification settings - Fork 9
/
.gitlab-ci.yml
284 lines (253 loc) · 7.46 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
283
284
include:
- project: eng/gpr/gpr-issues
file: /.gitlab/.gitlab-ci-shared.yml
stages:
- build
- test
- post
.gpr2_test_template:
extends: .test_template
cache:
- key: $CI_COMMIT_REF_SLUG
policy: pull
paths:
- cache
###########
## BUILD ##
###########
build:
extends: .job_template
stage: build
variables:
JOB_SUBPROJECTS: eng/gpr/gprbuild eng/gpr/gprconfig_kb eng/gpr/gprname
cache:
- key: $CI_COMMIT_REF_SLUG
fallback_keys:
- master
paths:
- cache
script:
# Tune to use our build & test plan
- anod tune --plan $CI_PROJECT_DIR/.ci.plan
# if a cached sandbox exists, use it, except for the daily schedule
# where we want to start anew
- if [[ $CI_PIPELINE_SOURCE != "schedule" ]]; then
install_cache full ;
else
rm -rf $CI_PROJECT_DIR/cache ;
fi
# Just build gprbuild/libgpr2/gpr2-bindings
# Full gnat bootstrap is tested though, but in the testing phase
- anod run build
# Save gpr builds and libadalang in cache to speed up a re-build
- mkdir -p $CI_PROJECT_DIR/cache
- rsync -a $SANDBOX/$HOST/*gpr* $CI_PROJECT_DIR/cache/
debug_build:
extends: .job_template
stage: build
variables:
JOB_SUBPROJECTS: eng/gpr/gprconfig_kb
script:
# build gpr2 in debug mode without rebuilding dependencies
- anod build gpr2 -Qdbg
###############################
# CHECK WE CAN BOOTSTRAP GNAT #
###############################
test_bootstrap:
services:
- image:e3
- cpu:16
extends: .gpr2_test_template
allow_failure: false
variables:
JOB_SUBPROJECTS: eng/gpr/gprconfig_kb eng/gpr/gprname
cache:
- key: $CI_COMMIT_REF_SLUG
policy: pull
paths:
- cache
- key: bootstrap-$CI_COMMIT_REF_SLUG
fallback_keys:
- bootstrap-master
paths:
- bootstrap_cache
script:
- install_cache full
- if [[ $CI_PIPELINE_SOURCE != "schedule" && -d $CI_PROJECT_DIR/bootstrap_cache ]]; then
exec rsync -a $CI_PROJECT_DIR/bootstrap_cache/* $SANDBOX/$HOST/ ;
fi
- rm -rf $CI_PROJECT_DIR/bootstrap_cache ;
# JOB_SUBPROJECTS and repos identified by a "depends-on" in the MR are
# locally cloned and used by anod. However git don't preserve timestamps
# which lead to very long rebuild times (gprbuild then considers all sources
# as being modified), so caching the builds is highly ineffective.
# So in order to have a reasonable rebuild, we install a wrapper to gprbuild
# ensuring that -m is enforced for all packages.
- install_build_wrapper() {
bindir=$SANDBOX/$HOST/$1/install/bin ;
exec mv $bindir/gprbuild $bindir/gprbuild-saved ;
echo '#!'$SHELL > $bindir/gprbuild ;
echo 'gprbuild-saved -m $@' >> $bindir/gprbuild ;
exec cat $bindir/gprbuild ;
exec chmod a+x $bindir/gprbuild ;
}
- anod tune --plan $CI_PROJECT_DIR/.ci.plan
- result=0
# Install gprbuild wrappers for the gprbuild bootstrap part
- anod install stable-gprbuild
# - anod install stable-gnat
- install_build_wrapper stable-gprbuild
# - install_build_wrapper stable-gnat
# Build gprbuild
- anod build gprbuild
# install the wrapper for the newly built gprbuild
- install_build_wrapper gprbuild
# and run the gnat bootstrap
- anod run bootstrap || result=$?
- mkdir -p $CI_PROJECT_DIR/bootstrap_cache
# save build for packages that take a long time to build: only a re-build
# will be performed on following runs, which assumably will be faster
# (than the time it takes to save/restore them).
# ??? the build space name is forged in stone here, while we know it can
# change anytime: maybe a hard to maintain choice
- for pkg in libadalang-internal laltools ; do
rsync -a $SANDBOX/$HOST/$pkg $CI_PROJECT_DIR/bootstrap_cache/ ;
done
- exit $result
####################
## GPR2 TESTSUITE ##
####################
test_gpr2:
extends: .gpr2_test_template
script:
- install_cache gnat
- run_testsuite gpr2 -Qfrom_gnat test_gpr2
artifacts:
when:
always
paths:
- testgpr2_result.xml
reports:
junit: testgpr2_result.xml
##############
## COVERAGE ##
##############
test_gpr2_cov:
extends: .gpr2_test_template
script:
- install_cache
- anod tune --full
- anod build gpr2 -Qcoverage
# do a normal testsuite run but save the exit code instead of just exiting
# so that coverage artifacts can be saved and used.
- result=0
- run_testsuite gpr2 -Qcoverage test_gpr2_cov || result=$?
- mkdir $CI_PROJECT_DIR/coverage
# save coverage results
- mv $RESULTS_DIR/coverage-cobertura/cobertura.xml $CI_PROJECT_DIR/coverage/
- mv $RESULTS_DIR/coverage-dhtml $CI_PROJECT_DIR/coverage/dhtml
# display coverage stats for global reporting
- echo_coverage_stats --coverage-file $RESULTS_DIR/coverage-xml/index.xml
# report initial test status code
- exit $result
coverage: '/^Stmt Coverage:\s+(\d+\.\d+\%) \(\d+ \/ \d+\)$/'
artifacts:
when:
always
paths:
- coverage/cobertura.xml
- coverage/dhtml
- testgpr2cov_result.xml
reports:
junit: testgpr2cov_result.xml
coverage_report:
coverage_format: cobertura
path: coverage/cobertura.xml
########################
## GPRBUILD TESTSUITE ##
########################
test_gprbuild:
extends: .gpr2_test_template
variables:
JOB_SUBPROJECTS: eng/gpr/gprbuild-internal
script:
- install_cache gnatall
- run_testsuite gprbuild "" test_gprbuild
artifacts:
when:
always
paths:
- testgprbuild_result.xml
reports:
junit: testgprbuild_result.xml
#########################
## GPRCONFIG TESTSUITE ##
#########################
test_gprconfig:
extends: .gpr2_test_template
variables:
JOB_SUBPROJECTS: eng/gpr/gprbuild-internal
script:
- install_cache
- run_testsuite gprconfig "" test_gprconfig
artifacts:
when:
always
paths:
- testgprconfig_result.xml
reports:
junit: testgprconfig_result.xml
######################
## GPR2LS TESTSUITE ##
######################
test_gpr2ls:
extends: .gpr2_test_template
variables:
JOB_SUBPROJECTS: eng/gpr/gprbuild-internal
script:
- install_cache gnatall
- run_testsuite gprbuild "-Qcheck-gpr2ls" test_gpr2ls
artifacts:
when:
always
paths:
- testgpr2ls_result.xml
reports:
junit: testgpr2ls_result.xml
#############################
## GPR2 BINDINGS TESTSUITE ##
#############################
test_gpr2bindings:
extends: .gpr2_test_template
script:
- install_cache
- anod test gpr2-bindings --minimal
# TODO: adjust this when this testsuite supports e3-testsuite-report
- work_dir=$(anod info test gpr2-bindings --show working_dir)
- OUTPUT=$(sed $work_dir/results/results -e '/.*OK[:]$/d' -e '/.*XFAIL[:]$/d' -e '/^$/d')
- if [ -n "$OUTPUT" ] ; then
echo "the following tests fail:" ;
echo "$OUTPUT" ;
exit 1 ;
fi
####################
## POSTPROCESSING ##
####################
post:
extends: .job_template
stage: post
when: always
script:
# generate badge
- cd $CI_PROJECT_DIR
- rm -f test-count.svg
- if ls test*_result.xml &> /dev/null; then
create_xunit_badge --xunit_reports test*_result.xml ;
else
anybadge -l "Tests Passing" -v "Error" -f test-count.svg -c red ;
fi
artifacts:
when:
always
paths:
- test-count.svg