forked from guardianproject/NetCipher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
81 lines (71 loc) · 2.56 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
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`
- echo y | sdkmanager
"platforms;android-${ANDROID_COMPILE_SDK}"
"build-tools;23.0.3"
"build-tools;24.0.1" > /dev/null
.test-template: &test-template
artifacts:
name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
paths:
- "logcat.txt"
- "*/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
allow_failure: true
.connected-template: &connected-template
script:
- ./gradlew assembleDebug
- echo y | sdkmanager "platforms;android-$AVD_SDK" > /dev/null
- if ! avdmanager list avd | grep "Name. avd$AVD_SDK$"; then
rm -rf ~/.android/avd $ANDROID_HOME/system-images;
echo y | sdkmanager "$AVD_PACKAGE" > /dev/null;
echo no | avdmanager create avd --name avd$AVD_SDK --tag "$AVD_TAG" --package "$AVD_PACKAGE";
avdmanager list avd;
fi
- emulator64-arm -avd avd$AVD_SDK -no-audio -no-window -no-snapstorage &
- wait-for-emulator
- adb shell input keyevent 82 &
- ./gradlew connectedCheck || (adb -e logcat -d '*:E' > logcat.txt; exit 1)
connected24:
retry: 1
<<: *test-template
variables:
AVD_SDK: "24"
AVD_TAG: "default"
AVD_PACKAGE: "system-images;android-${AVD_SDK};${AVD_TAG};armeabi-v7a"
<<: *connected-template
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/