forked from AdaCore/ada_language_server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
180 lines (157 loc) · 5.66 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
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
cpus: 16
disk: 80
image: systemgtk
save-component: 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
# 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
# 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
# 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
image: systemgtk
cpus: 4
disk: 80
rules:
# Does not work on edge
- 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
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: manual
allow_failure: true
als-cov:
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
# 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 the report file for debugging the CI integration
- coverage/cobertura.xml
vscode-extension:
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 $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