-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
341 lines (295 loc) · 8.28 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
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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
include:
project: TankerHQ/gitlab-ci-files
file: /common.yml
ref: 2022-09-05-258
variables:
SDK_NATIVE_CONAN_REFERENCE: tanker/latest-stable@
RUBY_3_4: 3.4.1
RUBY_3_3: 3.3.6
RUBY_3_2: 3.2.6
RUBY_3_2_LEGACY: 3.2.2
PROFILE_LINUX: --profile linux-x86_64 shared no-http-backend
PROFILE_MAC_X86: --profile macos-x86_64 shared no-http-backend
PROFILE_MAC_ARM: --profile macos-armv8 shared no-http-backend
RBENV_VERSION: $RUBY_3_4
############
# Workflow #
############
workflow:
rules:
# web pipelines for releases only
- if: $CI_PIPELINE_SOURCE == "web" && $SDK_RUBY_RELEASE_VERSION !~ /\A\d+\.\d+\.\d+(\.(alpha|beta)\.\d+)?\z/
when: never
- if: !reference [.if-invalid-native-conan-reference, if]
when: never
- if: '$CI_MERGE_REQUEST_TITLE =~ /.*\[preview].*/'
variables:
CONAN_REMOTE: "artifactory-preview"
- when: always
variables:
CONAN_REMOTE: "artifactory"
###########
# Default #
###########
default:
before_script:
- poetry -V
- poetry run python -m pip install --upgrade pip
- poetry install
- poetry run python --version
image: registry.gitlab.com/tankerhq/docker/sdk-ruby:latest
##########
# Stages #
##########
stages:
- lint
- prepare
- check
- deploy
#############################
# Default settings override #
#############################
.before-script/download-artifacts:
before_script:
- poetry -V
- poetry run python -m pip install --upgrade pip
- poetry install
- poetry run python --version
- poetry run python run-ci.py download-artifacts --project-id=$UPSTREAM_PROJECT_ID --pipeline-id=$UPSTREAM_PIPELINE_ID --job-name=$UPSTREAM_JOB_NAME
.before-script/rbenv-path:
before_script:
- poetry -V
- poetry run python -m pip install --upgrade pip
- poetry install
- poetry run python --version
- export PATH=$HOME/.rbenv/shims:$PATH
- rbenv version
.before-script/rbenv-path-download-artifacts:
before_script:
- !reference [.before-script/rbenv-path, before_script]
- poetry run python run-ci.py download-artifacts --project-id=$UPSTREAM_PROJECT_ID --pipeline-id=$UPSTREAM_PIPELINE_ID --job-name=$UPSTREAM_JOB_NAME
#################
# Extend blocks #
#################
.release-artifacts:
artifacts:
paths:
- vendor/tanker
##############
# lint stage #
##############
# Prevent the pipeline from passing unless the lint job is started manually
# There is no way to require _one of_ the manual checks job,
# it's all blocking or nothing blocks the pipeline. So we require manual lint instead
lint:
rules:
- !reference [.rules/mr/auto, rules]
- !reference [.rules/push-master, rules]
stage: lint
extends:
- .tags/linux
- .before-script/rbenv-path
script:
- poetry run python run-ci.py lint
tags: !reference [.tags/linux, tags]
#################
# prepare stage #
#################
.rules/prepare:
rules:
- !reference [.rules/web/auto, rules]
- !reference [.rules/mr/manual, rules]
- !reference [.rules/deploy-pipeline, rules]
.prepare:
stage: prepare
extends:
- .before-script/rbenv-path
- .rules/prepare
- .release-artifacts
script:
- poetry run python run-ci.py --isolate-conan-user-home --remote $CONAN_REMOTE prepare --use-tanker=deployed --tanker-ref $SDK_NATIVE_CONAN_REFERENCE $TANKER_PROFILES
prepare/linux:
extends:
- .prepare
variables:
TANKER_PROFILES: $PROFILE_LINUX
tags: !reference [.tags/linux, tags]
prepare/macos/x86_64:
extends:
- .tags/macos/x86_64
- .prepare
variables:
TANKER_PROFILES: $PROFILE_MAC_X86
prepare/macos/arm:
extends:
- .tags/macos/arm
- .prepare
variables:
RBENV_VERSION: $RUBY_3_2_LEGACY
TANKER_PROFILES: $PROFILE_MAC_ARM
###############
# check stage #
###############
.check/native-from-sources:
stage: check
extends:
- .rules/native-from-sources
- .before-script/rbenv-path
dependencies: []
script:
- poetry run python run-ci.py --isolate-conan-user-home --remote $CONAN_REMOTE prepare --use-tanker=same-as-branch $TANKER_PROFILES
- poetry run python run-ci.py --isolate-conan-user-home --remote $CONAN_REMOTE build --test
check/native-from-sources/linux/3.2:
extends:
- .check/native-from-sources
variables:
RBENV_VERSION: $RUBY_3_2
TANKER_PROFILES: $PROFILE_LINUX
tags: !reference [.tags/compilation-linux, tags]
check/native-from-sources/linux/3.3:
extends:
- .check/native-from-sources
variables:
RBENV_VERSION: $RUBY_3_3
TANKER_PROFILES: $PROFILE_LINUX
tags: !reference [.tags/compilation-linux, tags]
check/native-from-sources/linux/3.4:
extends:
- .check/native-from-sources
variables:
RBENV_VERSION: $RUBY_3_4
TANKER_PROFILES: $PROFILE_LINUX
tags: !reference [.tags/compilation-linux, tags]
check/native-from-sources/macos/x86_64:
extends:
- .tags/macos/x86_64
- .check/native-from-sources
variables:
TANKER_PROFILES: $PROFILE_MAC_X86
check/native-from-sources/macos/arm:
extends:
- .tags/macos/arm
- .check/native-from-sources
variables:
RBENV_VERSION: $RUBY_3_2_LEGACY
TANKER_PROFILES: $PROFILE_MAC_ARM
.rules/check/deployed-native:
rules:
- !reference [.rules/mr/manual, rules]
- !reference [.rules/web/auto, rules]
.check/deployed-native:
stage: check
extends:
- .before-script/rbenv-path
- .rules/check/deployed-native
script:
- poetry run python run-ci.py --isolate-conan-user-home --remote $CONAN_REMOTE build --test
check/deployed-native/linux/3.2:
extends:
- .check/deployed-native
variables:
RBENV_VERSION: $RUBY_3_2
TANKER_PROFILES: $PROFILE_LINUX
needs:
- prepare/linux
tags: !reference [.tags/linux, tags]
check/deployed-native/linux/3.3:
extends:
- .check/deployed-native
variables:
RBENV_VERSION: $RUBY_3_3
TANKER_PROFILES: $PROFILE_LINUX
needs:
- prepare/linux
tags: !reference [.tags/linux, tags]
check/deployed-native/linux/3.4:
extends:
- .check/deployed-native
variables:
RBENV_VERSION: $RUBY_3_4
TANKER_PROFILES: $PROFILE_LINUX
needs:
- prepare/linux
tags: !reference [.tags/linux, tags]
check/deployed-native/macos/x86_64:
extends:
- .tags/macos/x86_64
- .check/deployed-native
variables:
TANKER_PROFILES: $PROFILE_MAC_X86
needs:
- prepare/macos/x86_64
check/deployed-native/macos/arm:
extends:
- .tags/macos/arm
- .check/deployed-native
variables:
RBENV_VERSION: $RUBY_3_2_LEGACY
TANKER_PROFILES: $PROFILE_MAC_ARM
needs:
- prepare/macos/arm
.check/downstream:
stage: check
extends:
- .before-script/rbenv-path-download-artifacts
dependencies: []
script:
- poetry run python run-ci.py --isolate-conan-user-home --remote $CONAN_REMOTE prepare --use-tanker=upstream $TANKER_PROFILES
- poetry run python run-ci.py --isolate-conan-user-home --remote $CONAN_REMOTE build --test
check/downstream/linux/3.2:
extends:
- .check/downstream
- .rules/check/downstream/linux
variables:
RBENV_VERSION: $RUBY_3_2
TANKER_PROFILES: $PROFILE_LINUX
tags: !reference [.tags/linux, tags]
check/downstream/linux/3.3:
extends:
- .check/downstream
- .rules/check/downstream/linux
variables:
RBENV_VERSION: $RUBY_3_3
TANKER_PROFILES: $PROFILE_LINUX
tags: !reference [.tags/linux, tags]
check/downstream/linux/3.4:
extends:
- .check/downstream
- .rules/check/downstream/linux
variables:
RBENV_VERSION: $RUBY_3_4
TANKER_PROFILES: $PROFILE_LINUX
tags: !reference [.tags/linux, tags]
check/downstream/macos/x86_64:
extends:
- .tags/macos/x86_64
- .check/downstream
- .rules/check/downstream/macos/x86_64
variables:
TANKER_PROFILES: $PROFILE_MAC_X86
check/downstream/macos/arm:
extends:
- .tags/macos/arm
- .check/downstream
- .rules/check/downstream/macos/arm
variables:
RBENV_VERSION: $RUBY_3_2_LEGACY
TANKER_PROFILES: $PROFILE_MAC_ARM
################
# deploy stage #
################
deploy:
stage: deploy
extends:
- .rules/deploy/ruby
- .before-script/rbenv-path
script:
- poetry run python run-ci.py deploy --version $SDK_RUBY_RELEASE_VERSION
needs:
- prepare/linux
- prepare/macos/x86_64
- prepare/macos/arm
release:
description: sdk-ruby v$SDK_RUBY_RELEASE_VERSION
tag_name: v$SDK_RUBY_RELEASE_VERSION
tags: !reference [.tags/linux, tags]