2017-09-06 16:59:04 +02:00
|
|
|
image: registry.gitlab.com/fdroid/ci-images-client:latest
|
2016-02-29 15:15:02 +01:00
|
|
|
|
2016-02-24 20:31:42 +01:00
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- .gradle/wrapper
|
|
|
|
- .gradle/caches
|
|
|
|
|
2017-10-11 23:48:12 +02:00
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- deploy
|
|
|
|
|
2016-09-27 16:19:45 +02:00
|
|
|
before_script:
|
|
|
|
- export GRADLE_USER_HOME=$PWD/.gradle
|
2017-03-17 12:29:45 +01:00
|
|
|
- export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle`
|
2018-04-19 12:28:50 +02:00
|
|
|
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}"
|
2016-09-27 16:19:45 +02:00
|
|
|
|
2018-01-12 13:50:28 +01:00
|
|
|
.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"
|
|
|
|
|
2018-02-05 17:05:35 +01:00
|
|
|
# Run the most important first. Then we can decide whether to ignore
|
|
|
|
# the style tests if the rest of the more meaningful tests pass.
|
2016-05-16 12:57:49 +02:00
|
|
|
test:
|
2017-10-11 23:48:12 +02:00
|
|
|
stage: test
|
2018-01-12 13:50:28 +01:00
|
|
|
<<: *test-template
|
2015-08-27 05:28:38 +02:00
|
|
|
script:
|
2017-05-19 23:35:11 +02:00
|
|
|
- export EXITVALUE=0
|
2017-10-25 22:15:40 +02:00
|
|
|
- ./gradlew assemble
|
2016-02-24 22:59:01 +01:00
|
|
|
# always report on lint errors to the build log
|
2016-03-28 12:12:37 +02:00
|
|
|
- sed -i -e 's,textReport .*,textReport true,' app/build.gradle
|
2018-02-05 17:05:35 +01:00
|
|
|
- ./gradlew test
|
2017-10-25 22:15:40 +02:00
|
|
|
- ./gradlew lint
|
2018-02-05 17:05:35 +01:00
|
|
|
- ./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
|
2017-05-19 23:35:11 +02:00
|
|
|
- exit $EXITVALUE
|
2016-05-12 16:18:41 +02:00
|
|
|
|
2018-02-13 20:19:45 +01:00
|
|
|
errorprone:
|
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- cat config/errorprone.gradle >> app/build.gradle
|
|
|
|
- ./gradlew assembleDebug
|
|
|
|
allow_failure: true
|
|
|
|
|
2018-04-19 12:28:50 +02:00
|
|
|
connected14:
|
2017-10-11 23:48:12 +02:00
|
|
|
stage: test
|
2018-01-12 13:50:28 +01:00
|
|
|
<<: *test-template
|
2016-05-16 12:42:58 +02:00
|
|
|
variables:
|
2018-04-19 12:28:50 +02:00
|
|
|
AVD_SDK: "14"
|
2016-05-16 12:42:58 +02:00
|
|
|
script:
|
2017-10-25 22:15:40 +02:00
|
|
|
- ./gradlew assembleDebug
|
2018-04-19 12:28:50 +02:00
|
|
|
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-$AVD_SDK"
|
|
|
|
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-${AVD_SDK};default;armeabi-v7a"
|
|
|
|
- echo no | android --verbose create avd --name fcl-test-$AVD_SDK --target android-$AVD_SDK
|
2016-05-16 12:42:58 +02:00
|
|
|
- emulator64-arm -avd fcl-test-$AVD_SDK -no-skin -no-audio -no-window &
|
|
|
|
- ./tools/wait-for-emulator
|
|
|
|
- adb shell input keyevent 82 &
|
2018-01-12 13:50:28 +01:00
|
|
|
- ./gradlew connectedCheck || adb -e logcat -d '*:E' > logcat.txt
|
2016-05-16 12:42:58 +02:00
|
|
|
|
2016-07-10 02:32:48 +02:00
|
|
|
connected24:
|
2017-10-11 23:48:12 +02:00
|
|
|
stage: test
|
2016-05-12 16:23:30 +02:00
|
|
|
variables:
|
2016-07-10 02:32:48 +02:00
|
|
|
AVD_SDK: "24"
|
2018-01-12 13:50:28 +01:00
|
|
|
<<: *test-template
|
2016-05-12 16:18:41 +02:00
|
|
|
script:
|
2017-10-25 22:15:40 +02:00
|
|
|
- ./gradlew assembleDebug
|
2017-05-01 11:54:22 +02:00
|
|
|
- android list avd
|
2017-03-17 12:29:45 +01:00
|
|
|
- emulator64-arm -avd fcl-test-$AVD_SDK -no-audio -no-window &
|
2015-10-02 04:50:37 +02:00
|
|
|
- ./tools/wait-for-emulator
|
2016-04-05 00:21:45 +02:00
|
|
|
- adb shell input keyevent 82 &
|
2017-05-01 11:54:22 +02:00
|
|
|
- adb devices
|
2018-01-12 13:50:28 +01:00
|
|
|
- ./gradlew connectedCheck || adb -e logcat -d '*:E' > logcat.txt
|
2016-02-24 22:59:01 +01:00
|
|
|
|
2017-10-11 23:48:12 +02:00
|
|
|
deploy_nightly:
|
|
|
|
stage: deploy
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
script:
|
2017-12-06 16:29:51 +01:00
|
|
|
- sed -i
|
|
|
|
's,<string name="app_name">.*</string>,<string name="app_name">F-Nightly</string>,'
|
|
|
|
app/src/main/res/values*/strings.xml
|
|
|
|
# add this nightly repo as a enabled repo
|
2017-12-02 22:50:28 +01:00
|
|
|
- sed -i -e '/<\/string-array>/d' -e '/<\/resources>/d' app/src/main/res/values/default_repos.xml
|
|
|
|
- echo "<item>${CI_PROJECT_PATH}-nightly</item>" >> app/src/main/res/values/default_repos.xml
|
|
|
|
- echo "<item>${CI_PROJECT_URL}-nightly/raw/master/fdroid/repo</item>" >> app/src/main/res/values/default_repos.xml
|
|
|
|
- cat config/nightly-repo/repo.xml >> app/src/main/res/values/default_repos.xml
|
2018-06-13 13:50:01 +02:00
|
|
|
- export DB=`sed -n 's,.*DB_VERSION *= *\([0-9][0-9]*\).*,\1,p' app/src/main/java/org/fdroid/fdroid/data/DBHelper.java`
|
|
|
|
- export versionCode=`printf '%d%05d' $DB $(date '+%s'| cut -b4-8)`
|
|
|
|
- sed -i "s,^\(\s*versionCode\) *[0-9].*,\1 $versionCode," app/build.gradle
|
2017-12-06 16:29:51 +01:00
|
|
|
# build the APKs!
|
2018-01-04 23:00:55 +01:00
|
|
|
- ./gradlew assembleDebug
|
|
|
|
- fdroid nightly -v
|
2017-10-11 23:48:12 +02:00
|
|
|
|
2016-09-27 16:19:45 +02:00
|
|
|
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/
|