Hans-Christoph Steiner | 8407a8c | 2017-09-05 18:46:56 +0200 | [diff] [blame] | 1 | image: registry.gitlab.com/fdroid/ci-images-client:latest |
Hans-Christoph Steiner | 91d025c | 2016-08-08 16:35:46 +0200 | [diff] [blame] | 2 | |
| 3 | cache: |
| 4 | paths: |
| 5 | - .gradle/wrapper |
| 6 | - .gradle/caches |
| 7 | |
Hans-Christoph Steiner | a00e48d | 2017-03-17 12:22:32 +0100 | [diff] [blame] | 8 | before_script: |
Hans-Christoph Steiner | 9e4d1e8 | 2017-03-17 12:23:44 +0100 | [diff] [blame] | 9 | - export GRADLE_USER_HOME=$PWD/.gradle |
Hans-Christoph Steiner | a00e48d | 2017-03-17 12:22:32 +0100 | [diff] [blame] | 10 | - export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle` |
Hans-Christoph Steiner | 48c77d3 | 2018-06-28 10:51:08 +0200 | [diff] [blame] | 11 | - echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" > /dev/null |
Hans-Christoph Steiner | a00e48d | 2017-03-17 12:22:32 +0100 | [diff] [blame] | 12 | - export ANDROID_BUILD_TOOLS=`sed -n "s,.*buildToolsVersion\s*'\([0-9][0-9.]*\)'.*,\1,p" app/build.gradle` |
Hans-Christoph Steiner | 48c77d3 | 2018-06-28 10:51:08 +0200 | [diff] [blame] | 13 | - echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" > /dev/null |
Hans-Christoph Steiner | 8407a8c | 2017-09-05 18:46:56 +0200 | [diff] [blame] | 14 | - apt-get update && apt-get -y install gnupg |
Hans-Christoph Steiner | a00e48d | 2017-03-17 12:22:32 +0100 | [diff] [blame] | 15 | |
Hans-Christoph Steiner | 684d824 | 2019-01-11 16:06:28 +0100 | [diff] [blame^] | 16 | build_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 Steiner | 91d025c | 2016-08-08 16:35:46 +0200 | [diff] [blame] | 59 | test: |
Hans-Christoph Steiner | 48c77d3 | 2018-06-28 10:51:08 +0200 | [diff] [blame] | 60 | only: |
| 61 | - branches |
Hans-Christoph Steiner | 91d025c | 2016-08-08 16:35:46 +0200 | [diff] [blame] | 62 | script: |
Hans-Christoph Steiner | 8cb5c09 | 2017-03-17 12:12:32 +0100 | [diff] [blame] | 63 | - ./gradlew checkstyle |
Hans-Christoph Steiner | 8213e3b | 2017-04-21 13:37:21 +0200 | [diff] [blame] | 64 | - ./gradlew assembleDebug |
| 65 | - ./create_ota.sh debug |
Hans-Christoph Steiner | 73474d2 | 2018-03-21 17:32:45 +0100 | [diff] [blame] | 66 | - 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 Steiner | e40a250 | 2016-08-08 16:36:31 +0200 | [diff] [blame] | 68 | # always report on lint errors to the build log |
| 69 | - sed -i -e 's,textReport .*,textReport true,' app/build.gradle |
Hans-Christoph Steiner | 899f6da | 2016-08-09 16:33:17 +0200 | [diff] [blame] | 70 | - ./gradlew build || { |
Hans-Christoph Steiner | 91d025c | 2016-08-08 16:35:46 +0200 | [diff] [blame] | 71 | 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 Steiner | 03c1cd5 | 2017-04-24 11:14:32 +0200 | [diff] [blame] | 77 | - echo "use versionCode that is known to exist on f-droid.org for test:" |
Hans-Christoph Steiner | bedc664 | 2018-03-21 17:32:11 +0100 | [diff] [blame] | 78 | - sed -i 's,versionCode="[^"]*",versionCode="2070",' app/src/main/AndroidManifest.xml |
Hans-Christoph Steiner | 8213e3b | 2017-04-21 13:37:21 +0200 | [diff] [blame] | 79 | - ./create_ota.sh release binaries |
Hans-Christoph Steiner | 1c37c35 | 2018-06-28 10:53:28 +0200 | [diff] [blame] | 80 | artifacts: |
Hans-Christoph Steiner | 684d824 | 2019-01-11 16:06:28 +0100 | [diff] [blame^] | 81 | name: "${CI_PROJECT_PATH}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_${CI_JOB_NAME}" |
Hans-Christoph Steiner | 1c37c35 | 2018-06-28 10:53:28 +0200 | [diff] [blame] | 82 | 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 Steiner | 0887baf | 2016-08-10 11:59:12 +0200 | [diff] [blame] | 88 | |
Hans-Christoph Steiner | 48c77d3 | 2018-06-28 10:51:08 +0200 | [diff] [blame] | 89 | .connected-template: &connected-template |
Hans-Christoph Steiner | 0887baf | 2016-08-10 11:59:12 +0200 | [diff] [blame] | 90 | script: |
Hans-Christoph Steiner | 48c77d3 | 2018-06-28 10:51:08 +0200 | [diff] [blame] | 91 | - ./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 Steiner | 0887baf | 2016-08-10 11:59:12 +0200 | [diff] [blame] | 101 | - adb shell input keyevent 82 & |
Hans-Christoph Steiner | 48c77d3 | 2018-06-28 10:51:08 +0200 | [diff] [blame] | 102 | - ./gradlew connectedCheck || (adb -e logcat -d '*:E' > logcat.txt; exit 1) |
Hans-Christoph Steiner | 0887baf | 2016-08-10 11:59:12 +0200 | [diff] [blame] | 103 | |
| 104 | connected24: |
Hans-Christoph Steiner | 48c77d3 | 2018-06-28 10:51:08 +0200 | [diff] [blame] | 105 | only: |
| 106 | - branches |
Hans-Christoph Steiner | 0887baf | 2016-08-10 11:59:12 +0200 | [diff] [blame] | 107 | variables: |
| 108 | AVD_SDK: "24" |
Hans-Christoph Steiner | 48c77d3 | 2018-06-28 10:51:08 +0200 | [diff] [blame] | 109 | AVD_TAG: "default" |
| 110 | AVD_PACKAGE: "system-images;android-${AVD_SDK};${AVD_TAG};armeabi-v7a" |
| 111 | <<: *connected-template |
Hans-Christoph Steiner | 9e4d1e8 | 2017-03-17 12:23:44 +0100 | [diff] [blame] | 112 | |
| 113 | after_script: |
Hans-Christoph Steiner | 0887baf | 2016-08-10 11:59:12 +0200 | [diff] [blame] | 114 | # 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/ |