/
.gitlab-ci.yml
208 lines (178 loc) · 5.61 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
include:
- project: eng/libadalang/libadalang
file: /utils/gitlab-ci-common.yml
variables:
PACKAGE_BASENAME: langkit.tar.gz
PACKAGE_ABSOLUTE_NAME: $CI_PROJECT_DIR/$PACKAGE_BASENAME
PACKAGE_REPOSITORY_PROJECT: eng/libadalang/ci-packages
LIBADALANG_GIT: https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/eng/libadalang/libadalang
stages:
- stage1 # langkit_build, continuous_builder
- stage2 # langkit_test, libadalang_build_and_test
- stage3 # package, executed regardless of testing
- stage4 # CB, executed regardless of the rest
###############
# CHECK_ISSUE #
###############
check_issue:
extends: .check_issue
stage: stage1
#########
# BUILD #
#########
langkit_build:
extends: .basic
rules:
# Run this for merge requests, scheduled pipelines, and pipelines started
# from the Web interface (sometimes necessary to manually restart a
# scheduled pipeline).
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_PIPELINE_SOURCE == "web"'
# Also run it after a "master" branch update so that the "package" step has
# its dependencies satisfied.
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == "master"'
services:
- image:sandbox
- cpu:8
- mem:16
stage: stage1
script:
- !reference [.script_snippets, setup]
- cd /it/wave
# Build using anod
- anod vcs --add-repo langkit $CI_PROJECT_DIR
- anod build --minimal adasat
- anod build --minimal langkit_support
- anod build --minimal langkit
# Create the langkit package
- tar czf $PACKAGE_ABSOLUTE_NAME -C /
it/wave/x86_64-linux/langkit_support/install
it/wave/x86_64-linux/langkit/install
artifacts:
paths:
- $PACKAGE_BASENAME
########
# TEST #
########
langkit_test:
extends: .basic
services:
- image:sandbox
- cpu:8
- mem:16
stage: stage2
rules:
# We are not interested in running tests in CIs that just
# rebuild the artifact
- if: $CI_REBUILD_ARTIFACT
when: never
# Run this for merge requests only
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: on_success
script:
- !reference [.script_snippets, setup]
# Unpack langkit
- tar zxf $PACKAGE_ABSOLUTE_NAME -C /
- rm $PACKAGE_ABSOLUTE_NAME
# Run the testsuite
- cd /it/wave
- mkdir -p fingerprints
- anod vcs --add-repo langkit $CI_PROJECT_DIR
- touch fingerprints/x86_64-linux.adasat.install.json.assume-unchanged
- touch fingerprints/x86_64-linux.langkit_support.install.json.assume-unchanged
- touch fingerprints/x86_64-linux.langkit.install.json.assume-unchanged
- anod test --minimal langkit
# Produce a XUnit report for GitLab
- e3-testsuite-report
--failure-exit-code 1
--xunit-output $CI_PROJECT_DIR/xunit_output.xml
--xunit-name Langkit
x86_64-linux/langkit_test/results/new/
artifacts:
when: always
paths:
- xunit_output.xml
reports:
junit: xunit_output.xml
#############################
# LIBADALANG BUILD AND TEST #
#############################
libadalang_build_and_test:
extends: .basic
services:
- image:sandbox
- cpu:8
- mem:16
stage: stage2
rules:
# Run this for merge requests only
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- !reference [.script_snippets, setup]
# Unpack langkit
- tar zxf $PACKAGE_ABSOLUTE_NAME -C /
- rm $PACKAGE_ABSOLUTE_NAME
# Get libadalang. Use this branch if it's a "/sync/" branch.
- cd /tmp
- LAL_BRANCH=master
- if [[ $CI_COMMIT_BRANCH =~ ^sync/ ]]; then
LAL_BRANCH=$CI_COMMIT_BRANCH;
elif [[ $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ ^sync/ ]]; then
LAL_BRANCH=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME;
fi
- git clone $LIBADALANG_GIT -b $LAL_BRANCH
# Build and test libadalang
- cd /it/wave
- mkdir -p fingerprints
- anod vcs --add-repo libadalang /tmp/libadalang
- touch fingerprints/x86_64-linux.langkit_support.install.json.assume-unchanged
- touch fingerprints/x86_64-linux.langkit.install.json.assume-unchanged
- anod build --minimal libadalang
- anod build --minimal laldoc
- anod build --minimal libadalang-doc
- anod build --minimal libadalang_for_customers
- anod test --minimal libadalang
# Produce a XUnit report for GitLab
- e3-testsuite-report
--failure-exit-code 1
--xunit-output $CI_PROJECT_DIR/xunit_output.xml
--xunit-name Libadalang
x86_64-linux/libadalang_test/results/new/;
artifacts:
when: always
paths:
- xunit_output.xml
reports:
junit: xunit_output.xml
###########
# PACKAGE #
###########
# This job uploads the package to the package registry.
# This is launched only for CIs on the master branch.
package:
services:
- image:e3
stage: stage3
needs: [langkit_build] # Do not wait for jobs in stage2 (i.e. tests)
rules:
# Store the artifact for "master" branch updates and scheduled pipelines
# only. Also do it to run for pipelines started from the Web interface
# (see related comment in the langkit_build job).
- if: '$CI_COMMIT_REF_NAME != "master"'
when: never
- if: '$CI_PIPELINE_SOURCE == "push"'
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_PIPELINE_SOURCE == "web"'
script:
- export PATH=/it/e3/bin:$PATH
- unset GITLAB_TOKEN
# Upload the package
- upload_generic_package $PACKAGE_REPOSITORY_PROJECT $PACKAGE_ABSOLUTE_NAME
######
# CB #
######
continuous_builder:
extends: .cb
stage: stage4
needs: []