-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
230 lines (211 loc) · 5.16 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
include:
- https://gitlab.com/Linaro/tuxpkg/-/raw/main/gitlab-ci-pipeline.yml
- template: Security/SAST.gitlab-ci.yml
variables:
SAST_EXCLUDED_PATHS: spec, test, tests, tmp, public
TUXPKG_PROJECT: tuxrun
#############
# templates #
#############
.job:
image: registry.gitlab.com/linaro/tuxpkg:ci-debian
before_script:
- apt update && apt install -y python3-pip virtualenv python3-virtualenv python3-venv python3-ruamel.yaml
- python3 -m venv $HOME/.foo-venv
- source $HOME/.foo-venv/bin/activate
- python3 -m pip install mkdocs-material tuxpkg ruamel.yaml # FIXME not in Debian
script:
- make $CI_JOB_NAME
######
# CI #
######
ci-image-integration:
stage: .pre
image: docker:20.10-dind
services:
- name: docker:20.10-dind
variables:
DOCKER_DRIVER: overlay2
script:
- 'docker build -t $CI_REGISTRY_IMAGE/ci-integration -f Dockerfile.ci-integration .'
- 'docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY'
- 'docker push $CI_REGISTRY_IMAGE/ci-integration'
only:
refs:
- master
changes:
- Dockerfile.ci-integration
###############################
# tuxrun-dispatcher container #
###############################
.docker:
image: docker:20.10-dind
services:
- name: docker:20.10-dind
variables:
before_script:
# FIXME: We are using hack to build aarch64 container since lava-distcher from gitlab pipelin
# for LAVA project is not multiarch
- if [ $TAG_APPEND == "-arm64" ]; then sed -i "s|amd64/lava-dispatcher|aarch64/lava-dispatcher|g" Dockerfile.tuxrun-dispatcher; fi
- docker info
- docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- export tag="linaro/tuxrun-dispatcher:${CI_COMMIT_TAG}${TAG_APPEND}"
- export latest="linaro/tuxrun-dispatcher:latest${TAG_APPEND}"
script:
- docker build --pull --tag "${tag}" --tag "${latest}" -f Dockerfile.tuxrun-dispatcher .
- docker push "${tag}"
- docker push "${latest}"
variables:
DOCKER_DRIVER: overlay2
docker-amd64:
extends: .docker
stage: build
variables:
TAG_APPEND: -amd64
only:
- tags
docker-arm64:
extends: .docker
stage: build
tags:
- saas-linux-medium-arm64
variables:
TAG_APPEND: -arm64
only:
- tags
.docker-master:
extends: .docker
stage: build
variables:
IMAGE_NAME: "linaro/tuxrun-dispatcher:master"
script:
- docker build --pull --tag "${IMAGE_NAME}${TAG_APPEND}" -f Dockerfile.tuxrun-dispatcher .
- docker push "${IMAGE_NAME}${TAG_APPEND}"
only:
- master
docker-master-amd64:
extends: .docker-master
stage: build
variables:
TAG_APPEND: -amd64
docker-master-arm64:
extends: .docker-master
stage: build
tags:
- saas-linux-medium-arm64
variables:
TAG_APPEND: -arm64
publish-dockerhub:
extends: .docker
stage: deploy
variables:
DOCKER_CLI_EXPERIMENTAL: "enabled"
script:
- docker manifest create "${tag}" "${tag}-amd64" "${tag}-arm64"
- docker manifest create "${latest}" "${latest}-amd64" "${latest}-arm64"
- docker manifest push "${tag}"
- docker manifest push "${latest}"
only:
- tags
publish-master-dockerhub:
extends: .docker
stage: deploy
variables:
DOCKER_CLI_EXPERIMENTAL: "enabled"
IMAGE_NAME: "linaro/tuxrun-dispatcher:master"
script:
- docker manifest create "${IMAGE_NAME}" "${IMAGE_NAME}-amd64" "${IMAGE_NAME}-arm64"
- docker manifest push "${IMAGE_NAME}"
only:
- master
########
# test #
########
stylecheck:
extends: .job
stage: test
typecheck:
extends: .job
stage: test
spellcheck:
extends: .job
stage: test
###############
# integration #
###############
integration:
extends: .job
image: $CI_REGISTRY_IMAGE/ci-integration
stage: test
cache:
paths: [/root/.cache/tuxrun]
script:
- PYTHONPATH=. python3 test/integration.py --device $DEVICE --tests $TEST
parallel:
matrix:
#- DEVICE:
# - qemu-arm64
# - qemu-arm64be
# - qemu-mips64
# - qemu-mips64el
# - qemu-ppc32
# - qemu-ppc64
# - qemu-ppc64le
# - qemu-s390
# - qemu-sparc64
# - qemu-x86_64
# TEST:
# - ltp-fcntl-locktests ltp-fsx ltp-fs_perms_simple ltp-smoke
# - ltp-fs_bind
# - ltp-nptl
## FIXME ltp-nptl takes forever on some qemus; ignore that jobs for now
- DEVICE:
- qemu-armv5
# - qemu-armv7
# - qemu-armv7be
# - qemu-i386
# - qemu-mips32
# - qemu-mips32el
# - qemu-riscv64
TEST:
# - ltp-fcntl-locktests ltp-fsx ltp-fs_perms_simple ltp-smoke
# - ltp-fs_bind
- ltp-smoke
#########
# Build #
#########
doc:
extends: .job
stage: build
artifacts:
paths:
- public
###########
# deploy #
###########
pages:
extends: .job
stage: deploy
needs:
- doc
- repository
artifacts:
paths:
- public
only:
- tags
script:
- cp -r dist/repo public/packages/
# trigger packages.tuxsuite.com on release
trigger_tuxsuite:
stage: .post
image: $CI_REGISTRY_IMAGE/ci-integration
before_script:
- apt update
- apt install -y curl
script:
- "curl -X POST -F token=$TUXSUITE_PACKAGES_TRIGGER_TOKEN -F ref=master https://gitlab.com/api/v4/projects/13070238/trigger/pipeline"
only:
- tags
needs:
- pages