forked from torproject/tor
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml.disabled
394 lines (358 loc) · 12.1 KB
/
.gitlab-ci.yml.disabled
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
####
# DO NOT EDIT THIS FILE IN MASTER. ONLY EDIT IT IN THE OLDEST SUPPORTED
# BRANCH, THEN MERGE FORWARD.
####
# This file controls how gitlab validates Tor commits and merge requests.
#
# It is primarily based on a set of scripts and configurations by
# Hans-Christoph Steiner. It only copies parts of those scripts and
# configurations for now. If you want a new piece of functionality
# (more debians, more fedoras, android support) then you shouldn't
# start from scratch: have a look at the original ticket, at
# https://gitlab.torproject.org/tpo/core/tor/-/issues/32193 !
#
# The file to copy from is
# https://gitlab.torproject.org/tpo/core/tor/-/merge_requests/96/diffs#diff-content-587d266bb27a4dc3022bbed44dfa19849df3044c
#
# Having said that, if there is anything really stupid here, don't
# blame it on Hans-Christoph! Tor probably added it on their own.
#
# Copyright 2020, The Tor Project, Inc.
# See LICENSE for licence information.
# These variables are set everywhere, unconditionally.
variables:
TERM: "ansi"
DEBUG_CI: "yes"
# This template is for exporting ephemeral things from the scripts. By
# convention we expect our scripts to copy stuff into artifacts/, rather than
# having a big list of files that be treated as artifacts.
.artifacts-template: &artifacts-template
artifacts:
name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
expire_in: 1 week
when: always
paths:
- artifacts/
# This template is used for x86-64 builds.
.x86-64-template: &x86-64-template
tags:
- amd64
- physical
# This template should be usable on any system that's based on apt.
.apt-template: &apt-template |
export LC_ALL=C.UTF-8
echo Etc/UTC > /etc/timezone
mkdir -p apt-cache
export APT_CACHE_DIR="$(pwd)/apt-cache"
rm -f /etc/apt/apt.conf.d/docker-clean
echo 'quiet "1";' \
'Acquire::Retries "20";' \
'APT::Install-Recommends "0";' \
'APT::Install-Suggests "0";' \
'Acquire::Retries "20";' \
'APT::Get::Assume-Yes "true";' \
'Dpkg::Use-Pty "0";' \
"Dir::Cache::Archives \"${APT_CACHE_DIR}\"; " \
>> /etc/apt/apt.conf.d/99gitlab
apt-get update -qq
apt-get upgrade -qy
# This template sets us up for Debian system in particular.
.debian-template: &debian-template
<<: *artifacts-template
<<: *x86-64-template
variables:
DEBIAN_FRONTEND: "noninteractive"
# TODO: Using "cache" in this way speeds up our downloads. It would be
# even better, though, to start with a pre-upgraded debian image.
#
# TODO: Will we have to do this differently once we have more than one
# debian version that we're using?
cache:
key: apt
paths:
- apt-cache
before_script:
- *apt-template
# Install patches unconditionally.
- apt-get install
apt-utils
automake
build-essential
ca-certificates
file
git
libevent-dev
liblzma-dev
libscrypt-dev
libseccomp-dev
libssl-dev
pkg-config
python3
zlib1g-dev
# Install patches that we only need for some use cases.
- if [ "$ASCIIDOC" = yes ]; then apt-get install asciidoc xmlto; fi
- if [ "$DOXYGEN" = yes ]; then apt-get install doxygen; fi
- if [ "$STEM" = yes ]; then apt-get install timelimit; fi
- if [ "$CC" = clang ]; then apt-get install clang; fi
- if [ "$NSS" = yes ]; then apt-get install libnss3 libnss3-dev; fi
# llvm-symbolizer for sanitizer backtrace
- if [ "$HARDENING" = yes ]; then apt-get install llvm; fi
# TODO: This next line should not be debian-only.
- if [ "$STEM" = yes ]; then git clone --depth 1 https://gitlab.torproject.org/tpo/network-health/stem.git ; export STEM_PATH="$(pwd)/stem"; fi
# TODO: This next line should not be debian-only.
- if [ "$CHUTNEY" = yes ]; then git clone --depth 1 https://gitlab.torproject.org/tpo/core/chutney.git ; export CHUTNEY_PATH="$(pwd)/chutney"; fi
- if [ "$TRACING" = yes ]; then apt install liblttng-ust-dev; fi
# Minimal check on debian: just make, make check.
#
debian-minimal:
image: debian:bullseye
<<: *debian-template
script:
- ./scripts/ci/ci-driver.sh
# Minimal check on debian/i386: just make, make check.
#
debian-i386-minimal:
image: i386/debian:bullseye
<<: *debian-template
script:
- ./scripts/ci/ci-driver.sh
tags:
- physical
#####
# Run "make check" with a hardened clang on debian stable. This takes
# care of a hardening check, and a compile-with-clang check.
#
# TODO: This will be faster once we merge #40098 and #40099.
debian-hardened:
image: debian:bullseye
<<: *debian-template
variables:
ALL_BUGS_ARE_FATAL: "yes"
HARDENING: "yes"
CC: "clang"
script:
- ./scripts/ci/ci-driver.sh
#####
# Distcheck on debian stable
debian-distcheck:
image: debian:bullseye
<<: *debian-template
variables:
DISTCHECK: "yes"
CHECK: "no"
script:
- ./scripts/ci/ci-driver.sh
#####
# Documentation tests on debian stable: doxygen and asciidoc.
debian-docs:
image: debian:bullseye
<<: *debian-template
variables:
DOXYGEN: "yes"
ASCIIDOC: "yes"
CHECK: "no"
RUN_STAGE_BUILD: "no"
script:
- ./scripts/ci/ci-driver.sh
#####
# Integration tests on debian stable: chutney and stem.
#
# TODO: It would be cool if this target didn't have to re-build tor, and
# could instead re-use Tor from debian-minimal. That can be done
# with the 'artifacts' mechanism, in theory, but it would be good to
# avoid having to have a system with hundreds of artifacts.
debian-integration:
image: debian:bullseye
<<: *debian-template
variables:
CHECK: "no"
CHUTNEY: "yes"
CHUTNEY_MAKE_TARGET: "test-network-all"
STEM: "yes"
ALL_BUGS_ARE_FATAL: "yes"
script:
- ./scripts/ci/ci-driver.sh
#####
# Tracing build on Debian stable.
debian-tracing:
image: debian:bullseye
<<: *debian-template
variables:
TRACING: "yes"
CHECK: "no"
DISTCHECK: "yes"
script:
- ./scripts/ci/ci-driver.sh
#####
# No-authority mode
debian-disable-dirauth:
image: debian:bullseye
<<: *debian-template
variables:
DISABLE_DIRAUTH: "yes"
script:
- ./scripts/ci/ci-driver.sh
#####
# No-relay mode
debian-disable-relay:
image: debian:bullseye
<<: *debian-template
variables:
DISABLE_RELAY: "yes"
script:
- ./scripts/ci/ci-driver.sh
#####
# GPL licensed mode, enables pow module
debian-gpl:
image: debian:buster
<<: *debian-template
variables:
GPL: "yes"
script:
- ./scripts/ci/ci-driver.sh
#####
# NSS check on debian
debian-nss:
image: debian:bullseye
<<: *debian-template
variables:
NSS: "yes"
script:
- ./scripts/ci/ci-driver.sh
#####
# Debian packaging triggers for maintenance branches
debian-packaging-0.4.5:
stage: deploy
trigger:
project: tpo/core/debian/tor
branch: debian-0.4.5
rules:
- if: $CI_PROJECT_NAMESPACE == "tpo/core" &&
$CI_COMMIT_BRANCH == "maint-0.4.5"
debian-packaging-0.4.6:
stage: deploy
trigger:
project: tpo/core/debian/tor
branch: debian-0.4.6
rules:
- if: $CI_PROJECT_NAMESPACE == "tpo/core" &&
$CI_COMMIT_BRANCH == "maint-0.4.6"
#####
# Run tests written in Rust, and run clippy on all Rust code here.
rust-latest:
image: rust:latest
<<: *debian-template
script:
- apt-get install llvm-dev libclang-dev clang
- rustup show
- cargo build --locked --verbose
- cargo test --verbose
- rustup component add clippy
- rustup show
- cargo clippy --all-features --all-targets -- -D warnings
after_script:
- cargo clean
# cppcheck static analyzer
cppcheck:
image: debian:bullseye
script:
- *apt-template
- apt-get install cppcheck
- find src -name '*.[ch]' | sort
| cppcheck --file-list=- --max-configs=50
--enable=information,performance,portability,unusedFunction
#####
# Android builds have a very different setup than desktop OSes since
# it is a cross-compile and tests must run in the emulator.
.android-template: &android-template
image: registry.gitlab.com/fdroid/ci-images-client:latest
variables:
DEBIAN_FRONTEND: noninteractive
before_script:
- *apt-template
- apt-get install autoconf automake ca-certificates curl gzip make libtinfo5 libtool pkg-config tar unzip wget
script:
- export AVD_SDK=`echo $CI_JOB_NAME | awk '{print $2}'`
- export AVD_TAG=`echo $CI_JOB_NAME | awk '{print $3}'`
- export AVD_ARCH=`echo $CI_JOB_NAME | awk '{print $4}'`
- export AVD_PACKAGE="system-images;android-${AVD_SDK};${AVD_TAG};${AVD_ARCH}"
- echo $AVD_PACKAGE
- ndk=android-ndk-`echo $CI_JOB_NAME | awk '{print $5}'`
- export ANDROID_NDK_HOME=/opt/$ndk
- export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
- ndk_zip="${ndk}-linux-x86_64.zip"
- wget --quiet --tries=0 https://dl.google.com/android/repository/$ndk_zip
- unzip -qq -d /opt $ndk_zip
- export ABI=$AVD_ARCH
- test $ABI = "armeabi-v7a"
&& { host_triplet=armv7a-linux-androideabi; alt_triplet=arm-linux-androideabi; arch=arm; path_triplet=$alt_triplet; }
- test $ABI = "arm64-v8a"
&& { host_triplet=aarch64-linux-androideabi; alt_triplet=$host_triplet; arch=arm64; path_triplet=$host_triplet; }
- test $ABI = "x86"
&& { host_triplet=i686-linux-android; alt_triplet=$host_triplet; arch=$ABI; path_triplet=$ABI; }
- test $ABI = "x86_64"
&& { host_triplet=$ABI-linux-android; alt_triplet=$host_triplet; arch=$ABI; path_triplet=$ABI; }
- platform=21
- export CC=${host_triplet}${platform}-clang
- mkdir -p external
- export EXTERNAL_ROOT=`pwd`/external
# if using an old NDK, then more configuration is needed
- if ! which $CC; then
export CC="${alt_triplet}-gcc --sysroot=$ANDROID_NDK_HOME/platforms/android-$platform/arch-$arch -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$alt_triplet -isystem $ANDROID_NDK_HOME/sysroot/usr/include";
export CFLAGS=-D__ANDROID_API__=$platform
export PATH=$ANDROID_NDK_HOME/toolchains/${alt_triplet}-4.9/prebuilt/linux-x86_64/bin:$PATH;
fi
- openssl_version=`echo $CI_JOB_NAME | awk '{print $6}'`
- mkdir openssl
- curl --silent --location https://www.openssl.org/source/openssl-${openssl_version}.tar.gz
| tar -xz --directory=openssl --strip-components=1
- cd openssl
- ./Configure no-shared android-$arch -D__ANDROID_API__=$platform
--prefix=$EXTERNAL_ROOT --openssldir=$EXTERNAL_ROOT
- make install_dev
- cd ..
- mkdir libevent
- curl --silent --location https://github.com/libevent/libevent/archive/release-2.1.12-stable.tar.gz
| tar -xz --directory=libevent --strip-components=1
- cd libevent
- ./autogen.sh
- ./configure
LDFLAGS="-L$EXTERNAL_ROOT/lib"
CFLAGS="-I$EXTERNAL_ROOT/include"
--host="${alt_triplet}"
--disable-libevent-regress
--disable-samples
--disable-shared
--prefix=$EXTERNAL_ROOT
- make install
- cd ..
- ./autogen.sh
- ./configure
--host="$host_triplet"
--enable-android
--enable-static-libevent --with-libevent-dir=$EXTERNAL_ROOT
--enable-static-openssl --with-openssl-dir=$EXTERNAL_ROOT
--prefix=$EXTERNAL_ROOT
- grep -E '^# *define +ENABLE_OPENSSL +1$' orconfig.h
- grep -E '^# *define +HAVE_TLS_METHOD +1$' orconfig.h
- make install
- adb start-server
- start-emulator
- wait-for-emulator
- adb devices
- adb shell input keyevent 82 &
# adb shell on older emulators didn't pass the return value, so we need tricks
# https://stackoverflow.com/a/58452689
- EXITVALUE=0
- cd src/test
- for f in test test-memwipe test-slow; do
printf "\n\n------------------------------------------\n$f\n";
adb -e push $f /data/local/tmp/;
adb -e shell "cd /data/local/tmp; ./$f"'; echo -n $? > '"$f.result";
test `adb -e shell "cat /data/local/tmp/$f.result"` = "0" || EXITVALUE=1;
done
- exit $EXITVALUE
no-accel 22 default x86_64 r21e 1.1.1l:
<<: *android-template
no-accel 24 default armeabi-v7a r21e 1.1.1l:
<<: *android-template