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' app/build.gradle` - echo y | android --silent update sdk --no-ui --filter android-${ANDROID_COMPILE_SDK} .test-template: &test-template artifacts: name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}" paths: - logcat.txt - app/build/reports - app/build/outputs/*ml - app/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: - export EXITVALUE=0 - ./gradlew assemble # always report on lint errors to the build log - sed -i -e 's,textReport .*,textReport true,' app/build.gradle - ./gradlew test - ./gradlew lint - ./gradlew pmd || export EXITVALUE=1 - ./gradlew checkstyle || export EXITVALUE=1 - ./tools/check-format-strings.py - ./tools/remove-unused-and-blank-translations.py - echo "These are unused or blank translations that should be removed:" - git --no-pager diff --ignore-all-space --name-only --exit-code || export EXITVALUE=1 - exit $EXITVALUE errorprone: stage: test script: - cat config/errorprone.gradle >> app/build.gradle - ./gradlew assembleDebug allow_failure: true connected10: stage: test <<: *test-template variables: AVD_SDK: "10" script: - ./gradlew assembleDebug - emulator64-arm -avd fcl-test-$AVD_SDK -no-skin -no-audio -no-window & - ./tools/wait-for-emulator - adb shell input keyevent 82 & - ./gradlew connectedCheck || adb -e logcat -d '*:E' > logcat.txt connected24: stage: test variables: AVD_SDK: "24" <<: *test-template script: - ./gradlew assembleDebug - android list avd - emulator64-arm -avd fcl-test-$AVD_SDK -no-audio -no-window & - ./tools/wait-for-emulator - adb shell input keyevent 82 & - adb devices - ./gradlew connectedCheck || adb -e logcat -d '*:E' > logcat.txt deploy_nightly: stage: deploy only: - master script: - sed -i 's,.*,F-Nightly,' app/src/main/res/values*/strings.xml # add this nightly repo as a enabled repo - sed -i -e '/<\/string-array>/d' -e '/<\/resources>/d' app/src/main/res/values/default_repos.xml - echo "${CI_PROJECT_PATH}-nightly" >> app/src/main/res/values/default_repos.xml - echo "${CI_PROJECT_URL}-nightly/raw/master/fdroid/repo" >> app/src/main/res/values/default_repos.xml - cat config/nightly-repo/repo.xml >> app/src/main/res/values/default_repos.xml # build the APKs! - ./gradlew assembleDebug - fdroid nightly -v 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/