-
-
Notifications
You must be signed in to change notification settings - Fork 186
/
.gitlab-ci.yml
176 lines (153 loc) · 5.04 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
image: registry.gitlab.com/fdroid/ci-images-client:latest
cache:
paths:
- .gradle/wrapper
- .gradle/caches
stages:
- test
- deploy
before_script:
- export GRADLE_USER_HOME=$PWD/.gradle
- export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' libnetcipher/build.gradle`
- alias sdkmanager="sdkmanager --no_https"
- echo y | sdkmanager
"platforms;android-${ANDROID_COMPILE_SDK}"
"$(sed -nE 's,.*buildToolsVersion *.([0-9.]+).*,build-tools;\1,p' libnetcipher/build.gradle)"
"build-tools;23.0.3" > /dev/null
.test-template: &test-template
artifacts:
name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
paths:
- "logcat.txt"
- "tor.log"
- "syslog"
- "*/build/reports"
- "*/build/outputs/*ml"
- "*/build/outputs/apk"
expire_in: 1 week
when: on_failure
after_script:
- echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs"
# Run the most important first. Then we can decide whether to ignore
# the style tests if the rest of the more meaningful tests pass.
test:
stage: test
<<: *test-template
script:
# print lint errors/warnings to build log
- sed -i 's,\s*textReport .*,\ttextReport true,g' */build.gradle
# 'assemble' everything and run all checks that do not require a device/emulator
- ./gradlew build -PdisablePreDex
# test release process
- ./gradlew jarRelease -PdisablePreDex
errorprone:
stage: test
script:
- for f in */build.gradle; do cat tools/errorprone.gradle >> $f; done
- ./gradlew assembleDebug -PdisablePreDex
.connected-template: &connected-template
retry: 2
script:
- ./gradlew assembleDebug
- 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
- alias sdkmanager
- ls -l ~/.android
- if [ $AVD_SDK -ge 24 ]; then
set -x;
apt-get update;
apt-get -qy install jq netcat-openbsd tor --no-install-recommends;
service tor start;
while ! nc -w 1 localhost 9050; do echo "waiting for proxy port..."; sleep 1; done;
while ! curl --proxy socks5://localhost:9050 --location https://check.torproject.org/api/ip | jq --exit-status '.IsTor'; do echo 'waiting for tor...'; sleep 1; done;
set +x;
fi
- adb start-server
- start-emulator
- wait-for-emulator
- adb devices
- adb shell input keyevent 82 &
# these tests only work in Android Studio, not from command line :-|
- export EXCLUDES="--exclude-task :netcipher-conscrypt:connectedDebugAndroidTest --exclude-task :netcipher-webkit:connectedDebugAndroidTest"
- ./gradlew connectedCheck $EXCLUDES
|| ./gradlew connectedCheck $EXCLUDES
|| ./gradlew connectedCheck $EXCLUDES
|| (adb -e logcat -d > logcat.txt; exit 1)
connected 22 default armeabi-v7a:
<<: *test-template
<<: *connected-template
.kvm-template: &kvm-template
tags:
- fdroid
- kvm
<<: *test-template
<<: *connected-template
connected 17 default x86:
<<: *kvm-template
allow_failure: true
connected 18 default x86:
<<: *kvm-template
allow_failure: true
only:
- master@guardianproject/netcipher
connected 21 default x86:
<<: *kvm-template
only:
- master@guardianproject/netcipher
connected 22 default x86:
<<: *kvm-template
only:
- master@guardianproject/netcipher
connected 25 default x86:
<<: *kvm-template
connected 26 google_apis x86:
<<: *kvm-template
only:
- master@guardianproject/netcipher
connected 27 google_apis_playstore x86:
<<: *kvm-template
connected 29 default x86_64:
<<: *kvm-template
allow_failure: true
retry:
when:
- api_failure
- runner_system_failure
jarRelease:
stage: deploy
artifacts:
name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
paths:
- "logcat.txt"
- "*/build/libs"
- "*/build/reports"
- "*/build/outputs/*ml"
- "*/build/outputs/apk"
expire_in: 1 week
when: always
script:
- ./make-release-build
pages:
stage: deploy
artifacts:
paths:
- public
script:
- ./gradlew javadoc
- test -d public || mkdir public
- printf '<!DOCTYPE html>\n\n<html><body><h1>NetCipher Javadoc</h1><ul>' > public/index.html
- for f in */build/docs/javadoc; do
libname=`echo $f | cut -d / -f 1`;
printf "<li><a href=\"$libname\/\">$libname</a></li>" >> public/index.html;
cp -a $f public/$libname;
done
- printf '</ul></body></html>' >> public/index.html
after_script:
# 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/
- (cp /var/log/tor/log tor.log; chmod a+r tor.log) || true
- (cp /var/log/syslog syslog; chmod a+r syslog) || true