-
Notifications
You must be signed in to change notification settings - Fork 9
/
.gitlab-ci.yml
300 lines (257 loc) · 8.39 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
stages:
- test # this checks the viability of the code
- assets # this builds assets to be included in documentation and distribution binaries
- documentation # this processes the documentation
- test-compat # this runs many additional compatibility tests
variables:
GIT_STRATEGY: clone
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
APPTAINER_DOCKER_TAG: "v3.9.4"
DOCKER_HUB_TAG: "lcsbbiocore/cobrexa.jl"
DOCKER_GHCR_TAG: "ghcr.io/lcsb-biocore/docker/cobrexa.jl"
APPTAINER_GHCR_TAG: "lcsb-biocore/apptainer/cobrexa.jl"
#
# Predefined conditions for triggering jobs
#
.global_trigger_pull_request: &global_trigger_pull_request
rules:
- if: $CI_COMMIT_BRANCH == "develop"
when: never
- if: $CI_COMMIT_BRANCH == "master"
when: never
- if: $CI_PIPELINE_SOURCE == "external_pull_request_event"
.global_trigger_build_doc: &global_trigger_build_doc
rules:
- if: $CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME == "master" && $CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME == "develop"
- if: $CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME == "develop" && $CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME == "next"
- if: $CI_PIPELINE_SOURCE == "external_pull_request_event"
when: never
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_TAG =~ /^v/
.global_trigger_full_tests: &global_trigger_full_tests
rules:
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_TAG =~ /^v/
.global_trigger_compat_tests: &global_trigger_compat_tests
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME == "master"
.global_trigger_test_containers: &global_trigger_test_containers
rules:
- if: $CI_PIPELINE_SOURCE == "external_pull_request_event"
when: never
- if: $CI_COMMIT_BRANCH == "develop"
.global_trigger_release_containers: &global_trigger_release_containers
rules:
- if: $CI_COMMIT_TAG =~ /^v/
#
# Test environment & platform settings
#
.global_dind: &global_dind
image: docker:20.10.12
tags:
- privileged
services:
- name: docker:20.10.12-dind
command: ["--tls=false", "--mtu=1458", "--registry-mirror", "https://docker-registry.lcsb.uni.lu"]
before_script:
- docker login -u $CI_USER_NAME -p $GITLAB_ACCESS_TOKEN $CI_REGISTRY
.global_julia18: &global_julia18
variables:
JULIA_VER: "v1.8.3"
.global_julia16: &global_julia16
variables:
JULIA_VER: "v1.6.0"
.global_env_linux: &global_env_linux
script:
- $ARTENOLIS_SOFT_PATH/julia/$JULIA_VER/bin/julia --inline=yes --check-bounds=yes --color=yes --project=@. -e 'import Pkg; Pkg.test(; coverage = true)'
.global_env_win: &global_env_win
script:
- $global:LASTEXITCODE = 0 # Note the global prefix.
- Invoke-Expression $Env:ARTENOLIS_SOFT_PATH"\julia\"$Env:JULIA_VER"\bin\julia --inline=yes --check-bounds=yes --color=yes --project=@. -e 'import Pkg; Pkg.test(; coverage = true)'"
- exit $LASTEXITCODE
.global_env_win8: &global_env_win8
tags:
- windows8
<<: *global_env_win
.global_env_win10: &global_env_win10
tags:
- windows10
<<: *global_env_win
.global_env_mac: &global_env_mac
tags:
- mac
script:
- $ARTENOLIS_SOFT_PATH_MAC/julia/$JULIA_VER/Contents/Resources/julia/bin/julia --inline=yes --check-bounds=yes --color=yes --project=@. -e 'import Pkg; Pkg.test(; coverage = true)'
.global_build_apptainer: &global_build_apptainer
image:
name: "quay.io/singularity/singularity:$APPTAINER_DOCKER_TAG"
# the image entrypoint is the singularity binary by default
entrypoint: ["/bin/sh", "-c"]
tags:
- privileged
#
# TESTS
#
# The "basic" required test that gets triggered for the basic testing, runs in
# any available docker and current julia
#
docker:julia1.8:
stage: test
image: $CI_REGISTRY/r3/docker/julia-custom
script:
- julia --check-bounds=yes --inline=yes --project=@. -e "import Pkg; Pkg.test(; coverage = true)"
after_script:
- julia --project=test/coverage test/coverage/coverage-summary.jl
<<: *global_trigger_pull_request
#
# The required compatibility test to pass on branches&tags before the docs get
# built & deployed
#
linux:julia1.8:
stage: test
tags:
- slave01
<<: *global_trigger_full_tests
<<: *global_julia18
<<: *global_env_linux
linux:julia1.6:
stage: test
tags:
- slave02
<<: *global_trigger_full_tests
<<: *global_julia16
<<: *global_env_linux
#
# Additional platform&environment compatibility tests
#
windows8:julia1.8:
stage: test-compat
<<: *global_trigger_compat_tests
<<: *global_julia18
<<: *global_env_win8
windows10:julia1.8:
stage: test-compat
<<: *global_trigger_compat_tests
<<: *global_julia18
<<: *global_env_win10
mac:julia1.8:
stage: test-compat
<<: *global_trigger_compat_tests
<<: *global_julia18
<<: *global_env_mac
windows8:julia1.6:
stage: test-compat
<<: *global_trigger_compat_tests
<<: *global_julia16
<<: *global_env_win8
windows10:julia1.6:
stage: test-compat
<<: *global_trigger_compat_tests
<<: *global_julia16
<<: *global_env_win10
mac:julia1.6:
stage: test-compat
<<: *global_trigger_compat_tests
<<: *global_julia16
<<: *global_env_mac
#
# ASSETS
#
# This builds the development history gif using gource, and some containers.
#
gource:
stage: assets
needs: [] # allow faster start
script:
- docker run -v "$PWD":/visualization $CI_REGISTRY/r3/docker/gource
artifacts:
paths: ['output.gif']
expire_in: 1 year
<<: *global_trigger_build_doc
<<: *global_dind
apptainer-test:
stage: assets
script: |
alias apptainer=singularity
apptainer build cobrexa-test.sif cobrexa.def
<<: *global_build_apptainer
<<: *global_trigger_test_containers
apptainer-release:
stage: assets
script:
- |
# build the container
alias apptainer=singularity
apptainer build cobrexa.sif cobrexa.def
- |
# push to GHCR
alias apptainer=singularity
export SINGULARITY_DOCKER_USERNAME="$GITHUB_ACCESS_USERNAME"
export SINGULARITY_DOCKER_PASSWORD="$GITHUB_ACCESS_TOKEN"
apptainer push cobrexa.sif "oras://ghcr.io/$APPTAINER_GHCR_TAG:latest"
apptainer push cobrexa.sif "oras://ghcr.io/$APPTAINER_GHCR_TAG:$CI_COMMIT_TAG"
<<: *global_build_apptainer
<<: *global_trigger_release_containers
docker-test:
stage: assets
script:
- docker build -t "$DOCKER_HUB_TAG:testing" .
<<: *global_dind
<<: *global_trigger_test_containers
docker-release:
stage: assets
script:
- docker build -t "$DOCKER_HUB_TAG:latest" .
# alias and push to docker hub
- docker tag "$DOCKER_HUB_TAG:latest" "$DOCKER_HUB_TAG:$CI_COMMIT_TAG"
- echo "$DOCKER_IO_ACCESS_TOKEN" | docker login --username "$DOCKER_IO_USER" --password-stdin
- docker push "$DOCKER_HUB_TAG:latest"
- docker push "$DOCKER_HUB_TAG:$CI_COMMIT_TAG"
# make 2 extra aliases and push to GHCR
- docker tag "$DOCKER_HUB_TAG:latest" "$DOCKER_GHCR_TAG:latest"
- docker tag "$DOCKER_HUB_TAG:latest" "$DOCKER_GHCR_TAG:$CI_COMMIT_TAG"
- echo "$GITHUB_ACCESS_TOKEN" | docker login ghcr.io --username "$GITHUB_ACCESS_USERNAME" --password-stdin
- docker push "$DOCKER_GHCR_TAG:latest"
- docker push "$DOCKER_GHCR_TAG:$CI_COMMIT_TAG"
<<: *global_dind
<<: *global_trigger_release_containers
#
# DOCUMENTATION
#
pages:
stage: documentation
dependencies:
- gource
# Note: This dependency is also implied by the stage ordering, but let's
# be sure. As of Nov 2021, the assets are not used directly, but referred
# to externally from the docs.
image: $CI_REGISTRY/r3/docker/julia-custom
script:
# resolve and build packages from the docs/Project.toml file
- julia --project=docs -e 'using Pkg; Pkg.resolve(); Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate();'
# build and deploy docs (this doesn't upload the gource animation asset)
- julia --project=docs --color=yes docs/make.jl
# move to the directory to be picked up by Gitlab pages (with assets)
- mv docs/build public
artifacts:
paths:
- public
<<: *global_trigger_build_doc
#
# EXTERNAL REPOSITORIES
#
# This trigger the test pipeline in external repo as defined by gitlab
# variables.
#
trigger:
stage: test-compat
image: curlimages/curl
tags:
- privileged
script:
- curl --silent --output /dev/null -X POST -F token=$EXTERNAL_REPO_TOKEN -F ref=$EXTERNAL_REPO_BRANCH $EXTERNAL_REPO
<<: *global_trigger_full_tests