| image: registry.gitlab.com/fdroid/ci-images-client:latest |
| |
| cache: |
| paths: |
| - .gradle/wrapper |
| - .gradle/caches |
| |
| before_script: |
| - export GRADLE_USER_HOME=$PWD/.gradle |
| - export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle` |
| - echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" > /dev/null |
| - export ANDROID_BUILD_TOOLS=`sed -n "s,.*buildToolsVersion\s*'\([0-9][0-9.]*\)'.*,\1,p" app/build.gradle` |
| - echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" > /dev/null |
| - apt-get update && apt-get -y install gnupg |
| |
| build_on_debian: |
| image: debian:stretch |
| only: |
| - branches |
| variables: |
| ANDROID_HOME: /usr/lib/android-sdk |
| before_script: |
| - echo 'skipping sdkmanager, deps come from apt-get' |
| script: |
| - printf 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";\n' |
| > /etc/apt/apt.conf.d/99no-install-recommends |
| - printf 'APT::Acquire::Retries "20";\n' |
| > /etc/apt/apt.conf.d/99acquire-retries |
| - printf 'APT::Get::Assume-Yes "true";\n' |
| > /etc/apt/apt.conf.d/99assumeyes |
| - apt-get update |
| - apt-get upgrade |
| - apt-get install git wget |
| - apt-get install --install-recommends |
| android-sdk |
| android-sdk-platform-23 |
| gradle-debian-helper |
| libgradle-android-plugin-java |
| - wget --no-verbose http://dl.google.com/android/repository/platform-25_r03.zip |
| - unzip -q platform-25_r03.zip |
| - mv android-7.1.1 $ANDROID_HOME/platforms/platform-25 |
| - mkdir -p $ANDROID_HOME/licenses/ |
| - echo '24333f8a63b6825ea9c5514f83c2829b004d1fee' |
| > $ANDROID_HOME/licenses/android-sdk-license |
| - sed -i |
| -e "s,jcenter(),maven { url 'file:///usr/share/maven-repo' }," |
| build.gradle app/build.gradle |
| - mkdir ~/.android |
| - gradle assembleDebug |
| artifacts: |
| name: "${CI_PROJECT_PATH}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_${CI_JOB_NAME}" |
| paths: |
| - app/build/outputs/apk/*-debug.apk |
| expire_in: 1 week |
| when: on_success |
| after_script: |
| - echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs" |
| |
| test: |
| only: |
| - branches |
| script: |
| - ./gradlew checkstyle |
| - ./gradlew assembleDebug |
| - ./create_ota.sh debug |
| - printf "key.store=${HOME}/.android/debug.keystore\nkey.store.password=android\nkey.alias=androiddebugkey\nkey.alias.password=android\n" > signing.properties |
| - ./create_ota.sh release |
| # always report on lint errors to the build log |
| - sed -i -e 's,textReport .*,textReport true,' app/build.gradle |
| - ./gradlew build || { |
| for log in app/build/reports/*ests/*/*ml; do |
| echo "read $log here:"; |
| cat "$log" | curl --silent -F 'clbin=<-' https://clbin.com; |
| done; |
| exit 1; |
| } |
| - echo "use versionCode that is known to exist on f-droid.org for test:" |
| - apt-get -qy install --no-install-recommends jq |
| - wget --quiet --tries=0 https://f-droid.org/repo/index-v1.jar |
| - versionCode=`unzip -qqc index-v1.jar index-v1.json |
| | jq '.packages."org.fdroid.fdroid.privileged"[0].versionCode'` |
| - sed -i 's,versionCode="[^"]*",versionCode="'$versionCode'",' app/src/main/AndroidManifest.xml |
| - ./create_ota.sh release binaries |
| artifacts: |
| name: "${CI_PROJECT_PATH}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}_${CI_JOB_NAME}" |
| paths: |
| - app/build/distributions/*-debug.zip |
| expire_in: 2 months |
| when: on_success |
| after_script: |
| - echo "Download debug artifacts from https://gitlab.com/${CI_PROJECT_PATH}/-/jobs" |
| |
| .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 |
| - emulator -avd avd$AVD_SDK |
| -no-audio |
| -no-jni |
| -no-snapstorage |
| -no-window |
| -skip-adb-auth |
| -verbose |
| -wipe-data |
| & |
| - wait-for-emulator |
| - adb shell input keyevent 82 & |
| - ./gradlew connectedCheck || (adb -e logcat -d '*:E' > logcat.txt; exit 1) |
| |
| connected22: |
| only: |
| - branches |
| variables: |
| AVD_SDK: "22" |
| 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/ |