-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
325 lines (287 loc) · 10.5 KB
/
.gitlab-ci.yml
File metadata and controls
325 lines (287 loc) · 10.5 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
stages:
- build
- test
- optional
- check
include:
# Issue check
- component: $CI_SERVER_FQDN/eng/gitlab-templates/check-issue@~latest
# pre-commit
- component: $CI_SERVER_FQDN/eng/gitlab-templates/pre-commit@~latest
inputs:
on-diff: true
stage: check
# Build
- component: $CI_SERVER_FQDN/eng/gitlab-templates/build@~latest
inputs:
anod-args: run build_$ACI_TRACK
artifacts: [vscode-extension-npm-deps-*-*.tar.gz]
cpus: 16
disk: 80
image: systemgtk
windows: true
windows-cpus: 8
# 8GB of memory leads to heap exhaustion during compilation. We need more.
windows-mem: 16
save-component: true
save-anod-logs: true
# Offline sentinel build/test of vscode-extension
- component: $CI_SERVER_FQDN/eng/gitlab-templates/build@~latest
inputs:
job-name: offline-sentinel
anod-args: run offline_sentinel
needs: [build:linux]
cpus: 4
disk: 80
image: systemgtk
save-anod-logs: true
# Testing of the ALS
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
inputs:
job-name: als
anod-args: run test_als_$ACI_TRACK
image: systemgtk
disk: 80
windows: true
# Testing of the ALS with coverage
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
inputs:
job-name: als-cov
anod-args: run test_als_cov_$ACI_TRACK --latest
image: systemgtk
disk: 80
# This job needs to rebuild ALS in coverage mode, so it doesn't need to
# depend on the build job. The following will get it to run in parallel
# with the build job.
needs: []
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == "schedule"
# Testing of the VSCode extension
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
inputs:
job-name: vscode-extension
anod-args: run test_vscode_extension_$ACI_TRACK
image: systemgtk
windows: true
# 8GB of memory leads to heap exhaustion during compilation. We need more.
windows-mem: 16
# Integration testsuite
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
inputs:
job-name: integration-testsuite
# Here we would like to use --latest as to reduce issues from unavailable
# components, but we can't because it breaks the transfer of built
# components between jobs using anod-copy-components.
anod-args: run test_integration_testsuite
artifacts: [integration-testsuite-npm-deps-*-*.tar.gz]
image: systemgtk
cpus: 4
disk: 80
windows: true
windows-cpus: 4
rules:
# integration-testsuite cannot work with edge builds
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_TARGET_BRANCH_NAME == 'edge'
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_TARGET_BRANCH_NAME != 'edge'
allow_failure: true
# Optional testing of GNAT Studio
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
inputs:
job-name: gs
anod-args: run build_test_gs_$ACI_TRACK
image: systemgtk
disk: 80
stage: optional
windows: true
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: manual
allow_failure: true
.build:common:
after_script:
- . /tmp/ci_env.sh
# Copy the NPM artifacts archive
- bs=$(anod info vscode-extension --show working_dir -Q mono-plat,npm-online,npm-package)
- |
cp "$bs/tmp"/vscode-extension-npm-deps-*-*.tar.gz "$CI_PROJECT_DIR"
.integration-testsuite:common:
after_script:
- . /tmp/ci_env.sh
# Copy the NPM artifacts archive
- bs=$(anod info test integration-testsuite --show working_dir -Q run-tools=vscode,cleanup-mode=none,mono-plat,npm-online,npm-package)
- |
cp "$bs/tmp"/integration-testsuite-npm-deps-*-*.tar.gz "$CI_PROJECT_DIR"
# Prepare dir for Cobertura reports
- mkdir -v "$CI_PROJECT_DIR/coverage"
# Process coverage reports
- cov_dir="$bs/results/new/ts-coverage"
# Find files called `cobertura-coverage.xml` and process each one to remove
# source path prefixes
- |
find "$cov_dir" -name 'cobertura-coverage.xml' | while read -r f; do
parent_dir=$(basename $(dirname "$f"))
# The cobertura report has relative source paths starting with ../../../test/als/
# so we remove that prefix to make GitLab recognize the sources
prep-cobertura "$f" --relocate-source "../../../test/als/" "$CI_PROJECT_DIR/coverage/$parent_dir"
done
# Compute aggregated global coverage percentage
- print-global-coverage coverage/**/*.xml
coverage: '/^Line Coverage:\s+(\d+\.\d+)$/'
artifacts:
when: always
reports:
coverage_report:
coverage_format: cobertura
path: coverage/*/*.xml
# For debugging purposes, archive also the raw coverage reports
paths:
- coverage/
als-cov:linux:
variables:
RUNNER_AFTER_SCRIPT_TIMEOUT: 10m
after_script:
# Source the env prepared by generic_anod_ci
- cat /tmp/ci_env.sh
- . /tmp/ci_env.sh
- ALS_BUILD_SPACE=$(anod info test als $ACI_TRACK_QUALIFIER -Q coverage --show working_dir)
- RESULTS_DIR=$ALS_BUILD_SPACE/results/new
# Include Anod logs
- cp -rv $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
# Include coverage report
- mkdir -v $CI_PROJECT_DIR/coverage
# save coverage results
- cp -v $RESULTS_DIR/coverage-cobertura/cobertura.xml $CI_PROJECT_DIR/coverage
- cp -r $RESULTS_DIR/coverage-dhtml $CI_PROJECT_DIR/coverage/dhtml
- cp -r $RESULTS_DIR/coverage-xml $CI_PROJECT_DIR/coverage/xml
# display coverage stats for global reporting
- echo_coverage_stats --coverage-file $RESULTS_DIR/coverage-xml/index.xml
# export to gitlab pages
- |
if [[ $CI_PIPELINE_SOURCE = "merge_request_event" ]]; then
target_subdir=MRs/$CI_MERGE_REQUEST_IID
else
target_subdir=$CI_COMMIT_BRANCH
fi
- target_subdir=$target_subdir/ada-coverage
- publish-pages $CI_PROJECT_DIR/coverage/dhtml/ --target-subdir $target_subdir --expires 30
coverage: '/^Stmt Coverage:\s+(\d+\.\d+\%) \(\d+ \/ \d+\)$/'
artifacts:
when: always # Upload on errors too
reports:
junit: xunit-*.xml
coverage_report:
coverage_format: cobertura
path: coverage/cobertura.xml
paths:
- anod-logs/
# Also archive coverage reports as files for other use
- coverage/cobertura.xml
- coverage/xml/
build:linux:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# Enable just the linux build in scheduled pipelines for TypeScript coverage
- if: $CI_PIPELINE_SOURCE == "schedule"
vscode-extension:linux:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# Trigger just the Linux coverage run in scheduled pipelines
- if: $CI_PIPELINE_SOURCE == "schedule"
after_script:
# Source the env prepared by generic_anod_ci
- cat /tmp/ci_env.sh
- . /tmp/ci_env.sh
- VSCODE_BUILD_SPACE=$(anod info test vscode-extension -Q coverage,mono-plat,npm-online,npm-package $ACI_TRACK_QUALIFIER --show working_dir)
# Include Anod logs
- cp -rv $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
# Copy coverage reports
- cp -r $VSCODE_BUILD_SPACE/test/integration/vscode/ada/coverage $CI_PROJECT_DIR
# export to gitlab pages
- |
if [[ $CI_PIPELINE_SOURCE = "merge_request_event" ]]; then
target_subdir=MRs/$CI_MERGE_REQUEST_IID
else
target_subdir=$CI_COMMIT_BRANCH
fi
- target_subdir=$target_subdir/ts-coverage
- publish-pages $CI_PROJECT_DIR/coverage/ --target-subdir $target_subdir --expires 30
# Compute coverage percentage
- line_rate=$(cat $CI_PROJECT_DIR/coverage/cobertura-coverage.xml | grep -o 'line-rate="\([^"]\+\)"' | head -1 | grep -o '[0-9.]\+')
- line_perc=$(python -c "print($line_rate * 100)")
- >
echo "Line Coverage: $line_perc"
# The Cobertura report coming from the VS Code test infra has a <source>
# element specifying the root path of all sources.
#
# This needs to be replaced with the CI_PROJECT_DIR in order for GitLab to
# understand it.
#
# In this sed command we use '|' instead of '/' as a separator for the 's'
# command to avoid interpreting path separators in the pattern and
# replacement.
- sed -e "s|$VSCODE_BUILD_SPACE/test|$CI_PROJECT_DIR|" -i $CI_PROJECT_DIR/coverage/cobertura-coverage.xml
coverage: '/^Line Coverage:\s+(\d+\.\d+)$/'
artifacts:
when: always # Upload on errors too
reports:
junit: xunit-*.xml
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
paths:
- anod-logs/
- coverage/cobertura-coverage.xml
als:windows:
variables:
# In GitLab CI tests timeout more often on Windows, so we multiply
# testsuite timeouts by the following factor
ALS_WAIT_FACTOR: "2"
vscode-extension:windows:
variables:
MOCHA_TIMEOUT: "30000"
integration-testsuite:windows:
variables:
MOCHA_TIMEOUT: "30000"
lsif-ada:
rules:
# It is not useful to generate LSIF data on merge requests since GitLab
# does not provide navigation there. We only need it on the main branch.
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
needs: []
allow_failure: true
services:
- image:pe-base
- mem:4
script:
- generic_anod_ci
- . /tmp/ci_env.sh
# Install lsif-ada
- anod install lsif-ada --latest
- eval $(anod printenv lsif-ada)
# Set up the build env for als
- anod build als --deps-only
- eval $(anod printenv --build-env als)
# Add gnatdoc and spawn which are not set up by the above since they are
# used in source form in Anod
- |
for dep in gnatdoc spawn; do
git -C subprojects clone git@ssh.gitlab.adacore-it.com:eng/ide/$dep.git
GPR_PROJECT_PATH=$PWD/subprojects/$dep/gnat:$GPR_PROJECT_PATH
done
- export GPR_PROJECT_PATH
# Run lsif-ada!
- lsif-ada gnat/lsp_server.gpr >lsif.lsif
artifacts:
reports:
lsif: lsif.lsif
# The following also archives the LSIF dump as a plain file. This can be
# useful for debugging issues in an MR, but it shouldn't be done in the
# actual main branch job because it prevents GitLab from consuming the LSIF
# data.
#
# See https://gitlab.com/gitlab-org/gitlab/-/issues/368395#note_1125694679
# paths:
# - lsif.lsif