blob: 465e69dd35b8180fc610d18d18fdb220b75cb5ec [file] [log] [blame]
Hans-Christoph Steiner8407a8c2017-09-05 18:46:56 +02001image: registry.gitlab.com/fdroid/ci-images-client:latest
Hans-Christoph Steiner91d025c2016-08-08 16:35:46 +02002
3cache:
4 paths:
5 - .gradle/wrapper
6 - .gradle/caches
7
Hans-Christoph Steinera00e48d2017-03-17 12:22:32 +01008before_script:
Hans-Christoph Steiner9e4d1e82017-03-17 12:23:44 +01009 - export GRADLE_USER_HOME=$PWD/.gradle
Hans-Christoph Steinera00e48d2017-03-17 12:22:32 +010010 - 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 +020011 - echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" > /dev/null
Hans-Christoph Steinera00e48d2017-03-17 12:22:32 +010012 - 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 +020013 - echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" > /dev/null
Hans-Christoph Steiner8407a8c2017-09-05 18:46:56 +020014 - apt-get update && apt-get -y install gnupg
Hans-Christoph Steinera00e48d2017-03-17 12:22:32 +010015
Hans-Christoph Steiner684d8242019-01-11 16:06:28 +010016build_on_debian:
17 image: debian:stretch
18 only:
19 - branches
20 variables:
21 ANDROID_HOME: /usr/lib/android-sdk
22 before_script:
23 - echo 'skipping sdkmanager, deps come from apt-get'
24 script:
25 - printf 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";\n'
26 > /etc/apt/apt.conf.d/99no-install-recommends
27 - printf 'APT::Acquire::Retries "20";\n'
28 > /etc/apt/apt.conf.d/99acquire-retries
29 - printf 'APT::Get::Assume-Yes "true";\n'
30 > /etc/apt/apt.conf.d/99assumeyes
31 - apt-get update
32 - apt-get upgrade
33 - apt-get install git wget
34 - apt-get install --install-recommends
35 android-sdk
36 android-sdk-platform-23
37 gradle-debian-helper
38 libgradle-android-plugin-java
39 - wget --no-verbose http://dl.google.com/android/repository/platform-25_r03.zip
40 - unzip -q platform-25_r03.zip
41 - mv android-7.1.1 $ANDROID_HOME/platforms/platform-25
42 - mkdir -p $ANDROID_HOME/licenses/
43 - printf '\n8933bad161af4178b1185d1a37fbf41ea5269c55\n\nd56f5187479451eabf01fb78af6dfcb131a6481e\n'
44 > $ANDROID_HOME/licenses/android-sdk-license
45 - sed -i
46 -e "s,jcenter(),maven { url 'file:///usr/share/maven-repo' },"
47 build.gradle app/build.gradle
48 - mkdir ~/.android
49 - gradle assembleDebug
50 artifacts:
51 name: "${CI_PROJECT_PATH}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_${CI_JOB_NAME}"
52 paths:
53 - app/build/outputs/apk/*-debug.apk
54 expire_in: 1 week
55 when: on_success
56 after_script:
57 - echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs"
58
Hans-Christoph Steiner91d025c2016-08-08 16:35:46 +020059test:
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +020060 only:
61 - branches
Hans-Christoph Steiner91d025c2016-08-08 16:35:46 +020062 script:
Hans-Christoph Steiner8cb5c092017-03-17 12:12:32 +010063 - ./gradlew checkstyle
Hans-Christoph Steiner8213e3b2017-04-21 13:37:21 +020064 - ./gradlew assembleDebug
65 - ./create_ota.sh debug
Hans-Christoph Steiner73474d22018-03-21 17:32:45 +010066 - printf "key.store=${HOME}/.android/debug.keystore\nkey.store.password=android\nkey.alias=androiddebugkey\nkey.alias.password=android\n" > signing.properties
67 - ./create_ota.sh release
Hans-Christoph Steinere40a2502016-08-08 16:36:31 +020068 # always report on lint errors to the build log
69 - sed -i -e 's,textReport .*,textReport true,' app/build.gradle
Hans-Christoph Steiner899f6da2016-08-09 16:33:17 +020070 - ./gradlew build || {
Hans-Christoph Steiner91d025c2016-08-08 16:35:46 +020071 for log in app/build/reports/*ests/*/*ml; do
72 echo "read $log here:";
73 cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com;
74 done;
75 exit 1;
76 }
Hans-Christoph Steiner03c1cd52017-04-24 11:14:32 +020077 - echo "use versionCode that is known to exist on f-droid.org for test:"
Hans-Christoph Steinerbedc6642018-03-21 17:32:11 +010078 - sed -i 's,versionCode="[^"]*",versionCode="2070",' app/src/main/AndroidManifest.xml
Hans-Christoph Steiner8213e3b2017-04-21 13:37:21 +020079 - ./create_ota.sh release binaries
Hans-Christoph Steiner1c37c352018-06-28 10:53:28 +020080 artifacts:
Hans-Christoph Steiner684d8242019-01-11 16:06:28 +010081 name: "${CI_PROJECT_PATH}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_${CI_JOB_NAME}"
Hans-Christoph Steiner1c37c352018-06-28 10:53:28 +020082 paths:
83 - app/build/distributions/*-debug.zip
84 expire_in: 2 months
85 when: on_success
86 after_script:
87 - echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs"
Hans-Christoph Steiner0887baf2016-08-10 11:59:12 +020088
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +020089.connected-template: &connected-template
Hans-Christoph Steiner0887baf2016-08-10 11:59:12 +020090 script:
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +020091 - ./gradlew assembleDebug
92 - echo y | sdkmanager "platforms;android-$AVD_SDK" > /dev/null
93 - if ! avdmanager list avd | grep "Name. avd$AVD_SDK$"; then
94 rm -rf ~/.android/avd $ANDROID_HOME/system-images;
95 echo y | sdkmanager "$AVD_PACKAGE" > /dev/null;
96 echo no | avdmanager create avd --name avd$AVD_SDK --tag "$AVD_TAG" --package "$AVD_PACKAGE";
97 avdmanager list avd;
98 fi
99 - emulator64-arm -avd avd$AVD_SDK -no-audio -no-window -no-snapstorage &
100 - wait-for-emulator
Hans-Christoph Steiner0887baf2016-08-10 11:59:12 +0200101 - adb shell input keyevent 82 &
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +0200102 - ./gradlew connectedCheck || (adb -e logcat -d '*:E' > logcat.txt; exit 1)
Hans-Christoph Steiner0887baf2016-08-10 11:59:12 +0200103
104connected24:
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +0200105 only:
106 - branches
Hans-Christoph Steiner0887baf2016-08-10 11:59:12 +0200107 variables:
108 AVD_SDK: "24"
Hans-Christoph Steiner48c77d32018-06-28 10:51:08 +0200109 AVD_TAG: "default"
110 AVD_PACKAGE: "system-images;android-${AVD_SDK};${AVD_TAG};armeabi-v7a"
111 <<: *connected-template
Hans-Christoph Steiner9e4d1e82017-03-17 12:23:44 +0100112
113after_script:
Hans-Christoph Steiner0887baf2016-08-10 11:59:12 +0200114 # this file changes every time but should not be cached
115 - rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
116 - rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/