/
.gitlab-ci.yml
187 lines (159 loc) · 5.85 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
stages:
- build
- test
- check
- run_downstream_ci
issue-check:
services:
- image:e3
stage: check
needs: [] # Do not wait for the other stages to execute
interruptible: true # Cancel job if the branch is pushed
variables: # do not checkout the git repository, not needed
GIT_STRATEGY: none
rules: # Launch only on merge requests
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
script:
- require_issue # launch the verification
.basic-setup:
# Basic invocation of generic_anod_ci.
- generic_anod_ci
- cat /tmp/ci_env.sh
- . /tmp/ci_env.sh
.basic-test-setup:
# Use of generic_anod_ci for the purposes of testing, assuming
# the presence of a package containing the build.
# Unpack the built package
- (cd /tmp && tar -xzf $CI_PROJECT_DIR/wave-build-export.tar.gz)
# Make sure to remove the package, lest it be considered source by anod
- rm $CI_PROJECT_DIR/wave-build-export.tar.gz
# Basic invocation of generic_anod_ci.
- generic_anod_ci
- cat /tmp/ci_env.sh
- . /tmp/ci_env.sh
# Use the packaged components in our sandbox
- anod-copy-components /tmp/wave-build-export $ANOD_DEFAULT_SANDBOX_DIR
# generic_anod_ci sets the resolver to "smart_resolver" - this conflicts
# with our intention to use the pre-build package(s): use the "minimal"
# resolver for this.
- anod tune --minimal --plan /tmp/plans
# Build and test with ANOD
# TODO: add a build and test based on Alire in parallel to this.
build:
services:
- image:systemgtk
- cpu:8
stage: build
interruptible: true
rules:
- if: $CI_PIPELINE_SOURCE == 'push'
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'pipeline'
script:
- !reference [.basic-setup]
- echo -e "\e[0Ksection_start:`date +%s`:build_als[collapsed=true]\r\e[0Kanod build als"
- anod build als $ACI_TRACK_QUALIFIER
- echo -e "\e[0Ksection_end:`date +%s`:build_als\r\e[0K"
- echo -e "\e[0Ksection_start:`date +%s`:build_vscode[collapsed=true]\r\e[0Kanod build vscode-extension"
# We pass --latest here because the vscode-extension will try to download
# the Windows binary (it's a multi-platform extension), and this binary
# might not be available right away.
- anod build vscode-extension $ACI_TRACK_QUALIFIER --minimal --latest
- echo -e "\e[0Ksection_end:`date +%s`:build_vscode\r\e[0K"
# Export the components and make a package out of them
- anod-copy-components --standalone-export $ANOD_DEFAULT_SANDBOX_DIR /tmp/wave-build-export
- (cd /tmp/ && tar -czf $CI_PROJECT_DIR/wave-build-export.tar.gz wave-build-export)
artifacts:
when: on_success
paths:
- wave-build-export.tar.gz
test-als:
services:
- image:systemgtk
- cpu:8
stage: test
interruptible: true
rules:
- if: $CI_PIPELINE_SOURCE == 'push'
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'pipeline'
script:
- !reference [.basic-test-setup]
- echo -e "\e[0Ksection_start:`date +%s`:test_als[collapsed=true]\r\e[0Kanod test als"
# Run ALS tests
- anod test als $ACI_TRACK_QUALIFIER
- ALS_BUILD_SPACE=$(anod info test als $ACI_TRACK_QUALIFIER --show working_dir)
- echo -e "\e[0Ksection_end:`date +%s`:test_als\r\e[0K"
# Job artifacts must be produced in the project directory, so we do it at
# the end of the job to avoid changing Anod checkouts halfway through the
# job and triggering useless rebuilds.
# Process the als test report
- e3-testsuite-report
--failure-exit-code 1
--xunit-output $CI_PROJECT_DIR/als_xunit_output.xml
$ALS_BUILD_SPACE/results/new/ || FAILED=true
# Include Anod logs
- cp -r $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
- if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
artifacts:
when: always # Upload on errors too
reports:
junit: [als_xunit_output.xml]
paths:
- anod-logs/
test-vscode-extension:
services:
- image:systemgtk
- cpu:8
stage: test
interruptible: true
rules:
- if: $CI_PIPELINE_SOURCE == 'push'
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'pipeline'
script:
- !reference [.basic-test-setup]
# Run VSCode extension tests
- echo -e "\e[0Ksection_start:`date +%s`:test_vscode[collapsed=true]\r\e[0Kanod test vscode-extension"
- anod test vscode-extension --qualifier=$ACI_TRACK_QUALIFIER --minimal
- VSCODE_BUILD_SPACE=$(anod info test vscode-extension $ACI_TRACK_QUALIFIER --show working_dir)
- echo -e "\e[0Ksection_end:`date +%s`:test_vscode\r\e[0K"
# Job artifacts must be produced in the project directory, so we do it at
# the end of the job to avoid changing Anod checkouts halfway through the
# job and triggering useless rebuilds.
# Process the vscode-extension test report
- e3-testsuite-report
--failure-exit-code 1
--xunit-output $CI_PROJECT_DIR/vscode_xunit_output.xml
$VSCODE_BUILD_SPACE/results/ || FAILED=true
# Include Anod logs
- cp -r $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
- if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
artifacts:
when: always # Upload on errors too
reports:
junit: [vscode_xunit_output.xml]
paths:
- anod-logs/
.run_ci_common: &run_ci_common
stage: run_downstream_ci
rules:
- if: $CI_PIPELINE_SOURCE == 'push'
when: never
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: manual
allow_failure: true
trigger:
strategy: depend
inherit:
variables: false
variables:
ACI_UPSTREAM_PROJECT_ID: $CI_PROJECT_ID
ACI_UPSTREAM_MERGE_REQUEST_IID: $CI_MERGE_REQUEST_IID
run_gs_ci:
<<: *run_ci_common
trigger:
project: eng/ide/gnatstudio