blob: 23d04ac5a97ebacf507b255f310b72afbcb8174f [file] [log] [blame]
Hans-Christoph Steiner816f0542021-03-08 15:37:26 +01001
2.base:
3 image: registry.gitlab.com/fdroid/ci-images-client:latest
Hans-Christoph Steiner91d025c2016-08-08 16:35:46 +02004
5cache:
6 paths:
7 - .gradle/wrapper
8 - .gradle/caches
9
Hans-Christoph Steinera00e48d2017-03-17 12:22:32 +010010before_script:
Hans-Christoph Steiner9e4d1e82017-03-17 12:23:44 +010011 - export GRADLE_USER_HOME=$PWD/.gradle
Hans-Christoph Steinera00e48d2017-03-17 12:22:32 +010012 - export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle`
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +020013 - echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" > /dev/null
Hans-Christoph Steinera00e48d2017-03-17 12:22:32 +010014 - export ANDROID_BUILD_TOOLS=`sed -n "s,.*buildToolsVersion\s*'\([0-9][0-9.]*\)'.*,\1,p" app/build.gradle`
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +020015 - echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" > /dev/null
Hans-Christoph Steiner8407a8c2017-09-05 18:46:56 +020016 - apt-get update && apt-get -y install gnupg
Hans-Christoph Steinera00e48d2017-03-17 12:22:32 +010017
Hans-Christoph Steiner816f0542021-03-08 15:37:26 +010018.test-template: &test-template
19 extends: .base
20 stage: test
21 artifacts:
22 name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
23 paths:
24 - kernel.log
25 - logcat.txt
26 - app/core*
27 - app/*.log
28 - app/build/reports
29 - app/build/outputs/*ml
30 - app/build/outputs/apk
31 expire_in: 1 week
32 when: on_failure
33 after_script:
34 - echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs"
35
36
Hans-Christoph Steiner684d8242019-01-11 16:06:28 +010037build_on_debian:
38 image: debian:stretch
39 only:
40 - branches
41 variables:
42 ANDROID_HOME: /usr/lib/android-sdk
43 before_script:
44 - echo 'skipping sdkmanager, deps come from apt-get'
45 script:
46 - printf 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";\n'
47 > /etc/apt/apt.conf.d/99no-install-recommends
48 - printf 'APT::Acquire::Retries "20";\n'
49 > /etc/apt/apt.conf.d/99acquire-retries
50 - printf 'APT::Get::Assume-Yes "true";\n'
51 > /etc/apt/apt.conf.d/99assumeyes
52 - apt-get update
53 - apt-get upgrade
54 - apt-get install git wget
55 - apt-get install --install-recommends
56 android-sdk
57 android-sdk-platform-23
58 gradle-debian-helper
59 libgradle-android-plugin-java
60 - wget --no-verbose http://dl.google.com/android/repository/platform-25_r03.zip
61 - unzip -q platform-25_r03.zip
62 - mv android-7.1.1 $ANDROID_HOME/platforms/platform-25
63 - mkdir -p $ANDROID_HOME/licenses/
relan6e5ec522019-02-08 19:27:32 +030064 - echo '24333f8a63b6825ea9c5514f83c2829b004d1fee'
Hans-Christoph Steiner684d8242019-01-11 16:06:28 +010065 > $ANDROID_HOME/licenses/android-sdk-license
66 - sed -i
67 -e "s,jcenter(),maven { url 'file:///usr/share/maven-repo' },"
68 build.gradle app/build.gradle
69 - mkdir ~/.android
70 - gradle assembleDebug
71 artifacts:
72 name: "${CI_PROJECT_PATH}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_${CI_JOB_NAME}"
73 paths:
74 - app/build/outputs/apk/*-debug.apk
75 expire_in: 1 week
76 when: on_success
77 after_script:
78 - echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs"
79
Hans-Christoph Steiner91d025c2016-08-08 16:35:46 +020080test:
Hans-Christoph Steiner816f0542021-03-08 15:37:26 +010081 extends: .base
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +020082 only:
83 - branches
Hans-Christoph Steiner91d025c2016-08-08 16:35:46 +020084 script:
Hans-Christoph Steiner8cb5c092017-03-17 12:12:32 +010085 - ./gradlew checkstyle
Hans-Christoph Steiner8213e3b2017-04-21 13:37:21 +020086 - ./gradlew assembleDebug
87 - ./create_ota.sh debug
Hans-Christoph Steiner73474d22018-03-21 17:32:45 +010088 - printf "key.store=${HOME}/.android/debug.keystore\nkey.store.password=android\nkey.alias=androiddebugkey\nkey.alias.password=android\n" > signing.properties
89 - ./create_ota.sh release
Hans-Christoph Steinere40a2502016-08-08 16:36:31 +020090 # always report on lint errors to the build log
91 - sed -i -e 's,textReport .*,textReport true,' app/build.gradle
Hans-Christoph Steiner899f6da2016-08-09 16:33:17 +020092 - ./gradlew build || {
Hans-Christoph Steiner91d025c2016-08-08 16:35:46 +020093 for log in app/build/reports/*ests/*/*ml; do
94 echo "read $log here:";
95 cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com;
96 done;
97 exit 1;
98 }
Hans-Christoph Steiner03c1cd52017-04-24 11:14:32 +020099 - echo "use versionCode that is known to exist on f-droid.org for test:"
Hans-Christoph Steinere50c32b2019-11-21 09:59:33 +0100100 - apt-get -qy install --no-install-recommends jq
101 - wget --quiet --tries=0 https://f-droid.org/repo/index-v1.jar
102 - versionCode=`unzip -qqc index-v1.jar index-v1.json
103 | jq '.packages."org.fdroid.fdroid.privileged"[0].versionCode'`
104 - sed -i 's,versionCode="[^"]*",versionCode="'$versionCode'",' app/src/main/AndroidManifest.xml
Hans-Christoph Steiner8213e3b2017-04-21 13:37:21 +0200105 - ./create_ota.sh release binaries
Hans-Christoph Steiner1c37c352018-06-28 10:53:28 +0200106 artifacts:
Hans-Christoph Steiner684d8242019-01-11 16:06:28 +0100107 name: "${CI_PROJECT_PATH}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_${CI_JOB_NAME}"
Hans-Christoph Steiner1c37c352018-06-28 10:53:28 +0200108 paths:
109 - app/build/distributions/*-debug.zip
110 expire_in: 2 months
111 when: on_success
112 after_script:
113 - echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs"
Hans-Christoph Steiner0887baf2016-08-10 11:59:12 +0200114
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +0200115.connected-template: &connected-template
Hans-Christoph Steiner816f0542021-03-08 15:37:26 +0100116 extends: .base
Hans-Christoph Steiner0887baf2016-08-10 11:59:12 +0200117 script:
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +0200118 - ./gradlew assembleDebug
Hans-Christoph Steiner816f0542021-03-08 15:37:26 +0100119 - export AVD_SDK=`echo $CI_JOB_NAME | awk '{print $2}'`
120 - export AVD_TAG=`echo $CI_JOB_NAME | awk '{print $3}'`
121 - export AVD_ARCH=`echo $CI_JOB_NAME | awk '{print $4}'`
122 - export AVD_PACKAGE="system-images;android-${AVD_SDK};${AVD_TAG};${AVD_ARCH}"
123 - echo $AVD_PACKAGE
Hans-Christoph Steiner0887baf2016-08-10 11:59:12 +0200124
Hans-Christoph Steiner816f0542021-03-08 15:37:26 +0100125 - adb start-server
126 - start-emulator
127 - wait-for-emulator
128 - adb devices
129 - adb shell input keyevent 82 &
130 - ./gradlew installDebug
131 - ./gradlew connectedCheck
132
133no-accel 22 default x86:
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +0200134 only:
135 - branches
Hans-Christoph Steiner816f0542021-03-08 15:37:26 +0100136 <<: *test-template
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +0200137 <<: *connected-template
Hans-Christoph Steiner9e4d1e82017-03-17 12:23:44 +0100138
139after_script:
Hans-Christoph Steiner0887baf2016-08-10 11:59:12 +0200140 # this file changes every time but should not be cached
141 - rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
142 - rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/