forked from LCSB-BioCore/GigaSOM.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
186 lines (159 loc) · 5.22 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
stages:
- test
- assets
variables:
GIT_STRATEGY: clone
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
APPTAINER_DOCKER_TAG: "v3.9.4"
DOCKER_HUB_TAG: "lcsbbiocore/gigasom.jl"
DOCKER_GHCR_TAG: "ghcr.io/lcsb-biocore/docker/gigasom.jl"
APPTAINER_GHCR_TAG: "lcsb-biocore/apptainer/gigasom.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_full_tests: &global_trigger_full_tests
rules:
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_BRANCH == "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_julia17: &global_julia17
variables:
JULIA_VER: "v1.7.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_win10: &global_env_win10
tags:
- windows10
<<: *global_env_win
.global_env_mac: &global_env_mac
tags:
- mac
script:
- $ARTENOLIS_SOFT_PATH/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.7:
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.7:
stage: test
tags:
- slave01
<<: *global_trigger_full_tests
<<: *global_julia17
<<: *global_env_linux
#
# Additional platform&environment compatibility tests
#
windows10:julia1.7:
stage: test
<<: *global_trigger_full_tests
<<: *global_julia17
<<: *global_env_win10
mac:julia1.7:
stage: test
<<: *global_trigger_full_tests
<<: *global_julia17
<<: *global_env_mac
#
# CONTAINERS
#
apptainer-test:
stage: assets
script: |
alias apptainer=singularity
apptainer build gigasom-test.sif gigasom.def
<<: *global_build_apptainer
<<: *global_trigger_test_containers
apptainer-release:
stage: assets
script:
- |
# build the container
alias apptainer=singularity
apptainer build gigasom.sif gigasom.def
- |
# push to GHCR
alias apptainer=singularity
export SINGULARITY_DOCKER_USERNAME="$GITHUB_ACCESS_USERNAME"
export SINGULARITY_DOCKER_PASSWORD="$GITHUB_ACCESS_TOKEN"
apptainer push gigasom.sif "oras://ghcr.io/$APPTAINER_GHCR_TAG:latest"
apptainer push gigasom.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