-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy path.gitlab-ci.yml
133 lines (110 loc) · 3.8 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
stages:
- test
- release
cache:
paths:
- .gradle/wrapper
- .gradle/caches
.job-template: &job-template
artifacts:
name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
paths:
- tor-android-binary/build/outputs/aar
- tor-android-binary/src/main/libs
- external/include
- external/lib
- external/test
expire_in: 1 week
when: always
after_script:
- echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs"
# this file changes every time but should not be cached
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
- rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
.setup-template: &setup-template
- export LC_ALL=C.UTF-8
- export DEBIAN_FRONTEND=noninteractive
- echo Etc/UTC > /etc/timezone
- echo 'quiet "1";'
'APT::Install-Recommends "0";'
'APT::Install-Suggests "0";'
'APT::Acquire::Retries "20";'
'APT::Get::Assume-Yes "true";'
'Dpkg::Use-Pty "0";'
> /etc/apt/apt.conf.d/99gitlab
- apt-get update
- apt-get -qy dist-upgrade
- apt-get -qy install
autoconf
autogen
automake
autopoint
autotools-dev
gettext-base
git
libtool
make
patch
pkg-config
- export GRADLE_USER_HOME=$PWD/.gradle
- git clone --depth=1 --branch=0.4 https://gitlab.com/fdroid/sdkmanager.git
- git -C sdkmanager checkout -B master b5a5640fc4cdc151696b2d27a5886119ebd3a8b7
- ndkVersion=$(sed -En 's,NDK_REQUIRED_REVISION *:?= *([0-9.]+).*,\1,p' external/Makefile)
- ./sdkmanager/sdkmanager.py "ndk;$ndkVersion"
- 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
.test-template: &test-template
stage: test
image: registry.gitlab.com/fdroid/ci-images-client:latest
<<: *job-template
script:
- *setup-template
- export V=0
- ./tor-droid-make.sh fetch -c
- ./tor-droid-make.sh build -a $AVD_ARCH
- for f in tor-android-binary/src/main/libs/*/libtor.so; do sha256sum $f; done
- for f in external/lib/*/libtor.so; do sha256sum $f; done
- 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
# test-slow too flaky https://gitlab.torproject.org/tpo/core/tor/-/issues/32340
- for f in test test-memwipe; do
printf "\n\n------------------------------------------\n$f\n";
adb -e push external/test/$AVD_ARCH/$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:
<<: *test-template
no-accel 24 default armeabi-v7a:
<<: *test-template
release:
stage: release
image: debian:buster
<<: *job-template
script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes
default-jdk-headless
lib32stdc++6
lib32z1
python3-requests
tar
- export ANDROID_HOME=/opt/android-sdk
- mkdir -p $ANDROID_HOME/licenses
- printf "\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > $ANDROID_HOME/licenses/android-sdk-license
- *setup-template
- ./sdkmanager/sdkmanager.py "tools;26.1.1"
- git clean -fdx
- ./tor-droid-make.sh release -f
- cd tor-android-binary/build/outputs/aar
- for f in *.*; do sha256sum $f; done