forked from bitcoinfibre/bitcoinfibre
-
Notifications
You must be signed in to change notification settings - Fork 10
/
.gitlab-ci.yml
299 lines (276 loc) · 8.06 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
variables:
UBUNTU_BUILDER: $DOCKER_REGISTRY/satellite/bitcoinsatellite/ubuntu-builder:$CI_COMMIT_SHA
FEDORA_BUILDER: $DOCKER_REGISTRY/satellite/bitcoinsatellite/fedora-builder:$CI_COMMIT_SHA
CENTOS_BUILDER: $DOCKER_REGISTRY/satellite/bitcoinsatellite/centos-builder:$CI_COMMIT_SHA
I686_BUILDER: $DOCKER_REGISTRY/satellite/bitcoinsatellite/i686-builder:$CI_COMMIT_SHA
ARM_BUILDER: $DOCKER_REGISTRY/satellite/bitcoinsatellite/arm-builder:$CI_COMMIT_SHA
builders:
image: docker
stage: .pre
tags:
- cloud
services:
- docker:20.10.12-dind
before_script:
- echo "$CI_BUILD_TOKEN" | docker login -u gitlab-ci-token --password-stdin $DOCKER_REGISTRY
parallel:
matrix:
- BUILDER: ["ubuntu-builder", "fedora-builder", "centos-builder", "i686-builder", "arm-builder"]
variables:
IMAGE: $DOCKER_REGISTRY/satellite/bitcoinsatellite/$BUILDER
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://localhost:2375
DOCKER_TLS_CERTDIR: ""
timeout: 2h
script:
- docker pull $IMAGE:$CI_COMMIT_REF_SLUG || docker pull $IMAGE:latest || true
- >
docker build
-f docker/$BUILDER.docker
--cache-from $IMAGE:$CI_COMMIT_REF_SLUG
--cache-from $IMAGE:latest
--build-arg BUILDKIT_INLINE_CACHE=1
-t $IMAGE:$CI_COMMIT_SHA
-t $IMAGE:$CI_COMMIT_REF_SLUG
-t $IMAGE:latest
.
- docker push $IMAGE:$CI_COMMIT_SHA
- docker push $IMAGE:$CI_COMMIT_REF_SLUG
- if [ $CI_COMMIT_BRANCH == "master" ]; then docker push $IMAGE:latest; fi
.build:
stage: build
tags:
- cloud
variables:
CCACHE_DIR: $CI_PROJECT_DIR/.ccache/
cache:
key: ${CI_JOB_NAME}
paths:
- $CCACHE_DIR
before_script:
- mkdir -p $CCACHE_DIR
.build:x86:gcc:
extends: .build
script:
- ./autogen.sh
- mkdir build && cd build
- if [ -z "$CI_COMMIT_TAG" ]; then export CONFIG_FLAGS="--disable-wallet --with-gui=no"; fi
- ../configure $CONFIG_FLAGS
- make
- make check
build:x86:ubuntu:
extends: .build:x86:gcc
image: $UBUNTU_BUILDER
build:x86:fedora:
extends: .build:x86:gcc
image: $FEDORA_BUILDER
build:x86:centos:
extends: .build:x86:gcc
image: $CENTOS_BUILDER
build:x86:clang:
extends: .build
image: $UBUNTU_BUILDER
script:
- ./autogen.sh
- mkdir build && cd build
- CC=clang CXX=clang++ ../configure --disable-wallet --with-gui=no
- make
- make check
.build:cross:
extends: .build
image: $ARM_BUILDER
script:
- ./autogen.sh
- mkdir build && cd build
- if [ -z "$CI_COMMIT_TAG" ]; then export CONFIG_FLAGS="--disable-wallet --with-gui=no"; fi
- ../configure --prefix=/src/depends/$HOST --enable-glibc-back-compat --enable-reduce-exports $CONFIG_FLAGS
- make
artifacts:
paths:
- build/src/test/test_bitcoin
- build/src/bench/bench_bitcoin
expire_in: 10 minutes
build:aarch64:
extends: .build:cross
variables:
HOST: "aarch64-linux-gnu"
build:armhf:
extends: .build:cross
variables:
HOST: "arm-linux-gnueabihf"
build:i686:
extends: .build:cross
image: $I686_BUILDER
variables:
HOST: "i686-pc-linux-gnu"
# Run cross-build tests on the deb-packer runner, which has qemu-user support.
.test:cross:
image: $ARM_BUILDER
stage: test
tags:
- cloud
test:aarch64:
extends: .test:cross
needs:
- build:aarch64
script:
- qemu-aarch64 -L /usr/aarch64-linux-gnu build/src/test/test_bitcoin
- qemu-aarch64 -L /usr/aarch64-linux-gnu build/src/bench/bench_bitcoin -sanity-check -priority-level=high
test:armhf:
extends: .test:cross
needs:
- build:armhf
script:
- qemu-arm -L /usr/arm-linux-gnueabihf build/src/test/test_bitcoin
- qemu-arm -L /usr/arm-linux-gnueabihf build/src/bench/bench_bitcoin -sanity-check -priority-level=high
test:i686:
extends: .test:cross
image: $I686_BUILDER
needs:
- build:i686
script:
- build/src/test/test_bitcoin
- build/src/bench/bench_bitcoin -sanity-check -priority-level=high
.pkg-build:
stage: build
timeout: 36h
only:
variables:
- $CI_COMMIT_TAG =~ /^v(\d+\.)(\d+)-satellite(\d+\.)(\d+\.)(\d+)$/
# Build Debian packages using pbuilder
# Make sure to:
# - Define the PBUILDER_CACHE_DIR env var to control the pbuilder cache
# directory used within the deb-packer container. Change it to a directory
# within $CI_PROJECT_DIR such that it can ultimately be cached via Gitlab CI.
# - Cache the apt and ccache directories separately per pbuilder target.
# - Use separate artifacts archive names for each pbuilder target so that they
# don't overwrite each other on the aptly job.
# - Use option --aptly to enable Blockstream's Aptly repository as an apt
# package source on pbuilder builds. This is used to download libdb4.8
# dependencies directly from the Aptly repository.
# - Use option --aptly-test so that this job does not ship the build products to
# the Aptly server yet. Wait to upload the packages on the deploy stage.
deb-packages:
extends: .pkg-build
tags:
- deb-packer
parallel:
matrix:
- TARGET: [
"bullseye-amd64",
"bullseye-i386",
"bullseye-arm64",
"bullseye-armhf",
"buster-amd64",
"buster-i386",
"buster-arm64",
"raspbian-bullseye-armhf"
]
variables:
PBUILDER_CACHE_DIR: $CI_PROJECT_DIR/cache/pbuilder
ARTIFACTS_DIR: $CI_PROJECT_DIR/artifacts/
cache:
key: "pbuilder-$TARGET"
paths:
- $PBUILDER_CACHE_DIR/aptcache/
- $PBUILDER_CACHE_DIR/ccache/
- $PBUILDER_CACHE_DIR/$TARGET-base.tgz
script:
- >
blocksat-build
-p bitcoin-satellite
$CI_COMMIT_TAG
--pbuilder
--pbuilder-target $TARGET
--aptly
--aptly-test
-o $ARTIFACTS_DIR
artifacts:
name: "pbuilder-$TARGET"
paths:
- $ARTIFACTS_DIR
rpm-packages:
extends: .pkg-build
tags:
- rpm-packer
parallel:
matrix:
- TARGET: [
"fedora-37-x86_64",
"fedora-38-x86_64",
]
script:
- blocksat-build -p bitcoin-satellite $CI_COMMIT_TAG --mock --mock-target $TARGET
# The Debian binary packages built locally by the "deb-packages" job are shipped
# directly to the Aptly server (see the "aptly" job). In contrast, the Ubuntu
# binary packages are built remotely on Launchpad based on the source package.
# Hence, it is not necessary to build the Ubuntu packages locally. Nevertheless,
# for testing purposes, run the build and make sure it succeeds.
ubuntu-packages:
extends: .pkg-build
tags:
- deb-packer
image: $DOCKER_REGISTRY/satellite/blocksat-packages/ubuntu-packer
only:
variables:
- $CI_COMMIT_TAG =~ /^v(\d+\.)(\d+)-satellite(\d+\.)(\d+\.)(\d+)$/
- $CI_COMMIT_TAG =~ /^v(\d+\.)(\d+)-satellite(\d+\.)(\d+\.)(\d+)-rc$/
parallel:
matrix:
- TARGET: [
"jammy-amd64",
"jammy-arm64",
"jammy-armhf",
"focal-amd64",
"focal-arm64",
"focal-armhf"
]
variables:
PBUILDER_CACHE_DIR: $CI_PROJECT_DIR/cache/pbuilder
ARTIFACTS_DIR: $CI_PROJECT_DIR/artifacts/
cache:
key: "pbuilder-ubuntu-$TARGET"
paths:
- $PBUILDER_CACHE_DIR/aptcache/
- $PBUILDER_CACHE_DIR/ccache/
- $PBUILDER_CACHE_DIR/$TARGET-base.tgz
script:
- >
blocksat-build
-p bitcoin-satellite
$CI_COMMIT_TAG
--pbuilder
--pbuilder-target $TARGET
-o $ARTIFACTS_DIR
artifacts:
name: "pbuilder-ubuntu-$TARGET"
paths:
- $ARTIFACTS_DIR
.pkg-upload:
stage: deploy
dependencies: []
when: manual
only:
variables:
- $CI_COMMIT_TAG =~ /^v(\d+\.)(\d+)-satellite(\d+\.)(\d+\.)(\d+)$/
aptly:
extends: .pkg-upload
tags:
- deb-packer
dependencies:
- deb-packages
script:
- blocksat-aptly upload artifacts/
launchpad:
extends: .pkg-upload
tags:
- deb-packer
script:
- blocksat-build -p bitcoin-satellite --upload $CI_COMMIT_TAG --launchpad-target jammy focal
copr:
extends: .pkg-upload
tags:
- rpm-packer
script:
- sed -i "/\"epel-7-x86_64\",/d" /src/blocksat-packages/config/build_info.json
- blocksat-build -p bitcoin-satellite --upload $CI_COMMIT_TAG --mock-target fedora-38-x86_64 fedora-37-x86_64