This repository has been archived by the owner on Nov 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
288 lines (265 loc) · 7.4 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
# ${CARGO}
# ${CI_COMMIT_TAG}
# ${HARBOR_PASSWORD}
# ${HARBOR_REGISTRY_URL}
# ${HARBOR_USERNAME}
# ${RELEASE}
# ${RUST_VERSION}
# ${VERSION}
# BEGIN job-specific configuration
default:
cache:
key: ${CI_PROJECT_PATH_SLUG}
paths:
- /usr/local/cargo/registry
image: core-harbor.playpod.ir/library/rust-build:${RUST_VERSION}
# .default-rule: &default-rule
# only:
# - merge-requests
.target_1: &target_1
variables:
ARCHVARIANT: amd64
STRIP: strip
TARGET: x86_64-unknown-linux-musl
.target_2: &target_2
variables:
ARCHVARIANT: arm64
STRIP: aarch64-linux-gnu-strip
TARGET: aarch64-unknown-linux-musl
.target_3: &target_3
variables:
ARCHVARIANT: armv7
STRIP: arm-linux-gnueabihf-strip
TARGET: armv7-unknown-linux-musleabihf
rust_build:
after_script:
- docker logout ${HARBOR_REGISTRY_URL}
allow_failure: false
before_script:
- echo '${HARBOR_PASSWORD}' | docker login --password-stdin ${HARBOR_REGISTRY_URL} --username ${HARBOR_USERNAME}
dependencies: []
# extends:
# - .default-rule
image: ${HARBOR_REGISTRY_URL}/proxy_cache/library/docker:18.09.9-git
needs: []
script:
- docker pull ${HARBOR_REGISTRY_URL}/library/rust-build:${RUST_VERSION} || true
- docker build \
--build-arg RUST_VERSION=${RUST_VERSION} \
--cache-from ${HARBOR_REGISTRY_URL}/library/rust-build:${RUST_VERSION} \
--pull \
--tag ${HARBOR_REGISTRY_URL}/library/rust-build:${RUST_VERSION} \
.
- docker push ${HARBOR_REGISTRY_URL}/library/rust-build
services:
- ${HARBOR_REGISTRY_URL}/proxy_cache/library/docker:18.09.9-dind
stage: rust_build
variables:
CARGO: cargo
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://127.0.0.1:2375
DOCKER_TLS_CERTDIR: ''
RELEASE: --release
RUST_VERSION: 1.60.0-bullseye
VERSION: ${CI_COMMIT_TAG}
when: manual
.build: &build
allow_failure: false
artifacts:
expire_in: 1 week
paths:
- release
# public: false
# extends:
# - .default-rule
script:
- make release
services:
- ${HARBOR_REGISTRY_URL}/proxy_cache/library/docker:18.09.9-dind
stage: build
variables:
CARGO: cargo
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://127.0.0.1:2375
DOCKER_TLS_CERTDIR: ''
RELEASE: --release
RUST_VERSION: 1.60.0-bullseye
VERSION: ${CI_COMMIT_TAG}
when: manual
.test: &test
allow_failure: true
# extends:
# - .default-rule
script:
- make test
stage: test
variables:
CARGO: cargo
RELEASE: --release
RUST_VERSION: 1.60.0-bullseye
VERSION: ${CI_COMMIT_TAG}
when: manual
.coverage: &coverage
allow_failure: true
artifacts:
expire_in: 1 week
paths:
- coverage
reports:
cobertura: coverage.xml
# public: false
# extends:
# - .default-rule
script:
- make coverage
stage: coverage
variables:
CARGO: cargo
GRCOV_COVERAGE_TYPE: cobertura
RELEASE: --release
RUST_VERSION: 1.60.0-bullseye
VERSION: ${CI_COMMIT_TAG}
when: manual
.upload: &upload
allow_failure: false
# extends:
# - .default-rule
image: curlimages/curl:7.78.0
script:
- curl --header 'JOB-TOKEN: ${CI_JOB_TOKEN}' --upload-file release/${PACKAGE}-${VERSION}-${ARCHVARIANT} ${PACKAGE_REGISTRY_URL}/${PACKAGE}-${VERSION}-${ARCHVARIANT}
- curl --header 'JOB-TOKEN: ${CI_JOB_TOKEN}' --upload-file release/${PACKAGE}-${VERSION}-${ARCHVARIANT}.sha256 ${PACKAGE_REGISTRY_URL}/${PACKAGE}-${VERSION}-${ARCHVARIANT}.sha256
stage: upload
variables:
CARGO: cargo
PACKAGE_REGISTRY_URL: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE}/${VERSION}
RELEASE: --release
RUST_VERSION: 1.60.0-bullseye
VERSION: ${CI_COMMIT_TAG}
when: manual
.release: &release
allow_failure: false
# extends:
# - .default-rule
image: registry.gitlab.com/gitlab-org/release-cli:latest
release:
assets:
links:
# -
# name: ${PACKAGE}-${VERSION}-${ARCHVARIANT}
# url: ${PACKAGE_REGISTRY_URL}/${PACKAGE}-${VERSION}-${ARCHVARIANT}
# -
# name: ${PACKAGE}-${VERSION}-${ARCHVARIANT}.sha256
# url: ${PACKAGE_REGISTRY_URL}/${PACKAGE}-${VERSION}-${ARCHVARIANT}.sha256
-
name: ${PACKAGE}-${VERSION}-arm64
url: ${PACKAGE_REGISTRY_URL}/${PACKAGE}-${VERSION}-arm64
-
name: ${PACKAGE}-${VERSION}-arm64.sha256
url: ${PACKAGE_REGISTRY_URL}/${PACKAGE}-${VERSION}-arm64.sha256
-
name: ${PACKAGE}-${VERSION}-armv7
url: ${PACKAGE_REGISTRY_URL}/${PACKAGE}-${VERSION}-armv7
-
name: ${PACKAGE}-${VERSION}-armv7.sha256
url: ${PACKAGE_REGISTRY_URL}/${PACKAGE}-${VERSION}-armv7.sha256
-
name: ${PACKAGE}-${VERSION}-amd64
url: ${PACKAGE_REGISTRY_URL}/${PACKAGE}-${VERSION}-amd64
-
name: ${PACKAGE}-${VERSION}-amd64.sha256
url: ${PACKAGE_REGISTRY_URL}/${PACKAGE}-${VERSION}-amd64.sha256
description: CHANGELOG.md
name: Release ${VERSION}
tag_name: ${VERSION}
script:
- echo 'running release_job'
stage: release
variables:
CARGO: cargo
PACKAGE_REGISTRY_URL: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE}/${VERSION}
RELEASE: --release
RUST_VERSION: 1.60.0-bullseye
VERSION: ${CI_COMMIT_TAG}
when: manual
.documentation: &documentation
allow_failure: false
artifacts:
expire_in: 1 week
paths:
- documentation
# public: false
# extends:
# - .default-rule
script:
- make doc
stage: documentation
variables:
CARGO: cargo
RELEASE: --release
RUST_VERSION: 1.60.0-bullseye
VERSION: ${CI_COMMIT_TAG}
when: manual
.pages:
allow_failure: false
artifacts:
paths:
- public
# public: false
# extends:
# - .default-rule
script:
- mkdir public
- mv coverage public
- mv documentation public
stage: pages
variables:
CARGO: cargo
RELEASE: --release
RUST_VERSION: 1.60.0-bullseye
VERSION: ${CI_COMMIT_TAG}
when: manual
# DEPLOY
.deploy: &deploy
allow_failure: false
# extends:
# - .default-rule
image: docker:20.10.7
script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
- docker pull ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${RUST_VERSION} || true
- docker build --cache-from ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${RUST_VERSION} --filename ${DOCKERFILE} --tag ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${CI_COMMIT_SHA} --tag ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:latest .
- docker push ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${CI_COMMIT_SHA}
- docker push ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${RUST_VERSION}
# - mkdir -p '${MOUNT_POINT}'
# - docker run --volume ${MOUNT_POINT}:/mnt ${IMAGE_NAME} /mnt/script/to/run/tests
services:
- docker:20.10.7-dind-rootless
stage: deploy
variables:
CARGO: cargo
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://127.0.0.1:2376
DOCKER_TLS_CERTDIR:
# MOUNT_POINT: /builds/${CI_PROJECT_PATH}/mnt
# MOUNT_POINT: ${CI_PROJECT_DIR}/mnt
RELEASE: --release
RUST_VERSION: 1.60.0-bullseye
VERSION: ${CI_COMMIT_TAG}
when: manual
# END job-specific configuration
# BEGIN project-specific configuration
# END project-specific configuration
# BEGIN actual pipeline definition
stages:
- rust_build
- build
- test
- coverage
- upload
- release
- documentation
- pages
- deploy
include:
- local: fip_api/.gitlab-ci.yml
# END actual pipeline definition