commit 6ba0ceccbde67310c22fc9fa4e0dc88d932740f5 Author: Hans-Christoph Steiner hans@eds.org Date: Wed Mar 20 10:44:02 2019 +0100
add .gitlab-ci.yml setup with errorprone --- .gitlab-ci.yml | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ tools/errorprone.gradle | 25 +++++++++++++++++++++++ 2 files changed, 79 insertions(+)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..9a09b8b4 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,54 @@ +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` + - alias sdkmanager="sdkmanager --no_https" + - echo y | sdkmanager + "platforms;android-${ANDROID_COMPILE_SDK}" + "$(sed -nE 's,.*buildToolsVersion *.([0-9.]+).*,build-tools;\1,p' app/build.gradle)" + "build-tools;23.0.3" > /dev/null + +.test-template: &test-template + artifacts: + name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}" + paths: + - "logcat.txt" + - "*/build/reports" + - "*/build/outputs/*ml" + - "*/build/outputs/apk" + expire_in: 1 week + when: on_failure + after_script: + - echo "Download debug artifacts from https://gitlab.com/$%7BCI_PROJECT_PATH%7D/-/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: + # print lint errors/warnings to build log + - sed -i 's,\s*textReport .*,\ttextReport true,g' */build.gradle + # 'assemble' everything and run all checks that do not require a device/emulator + - ./gradlew build -PdisablePreDex + +errorprone: + stage: test + script: + - for f in */build.gradle; do cat tools/errorprone.gradle >> $f; done + - ./gradlew assembleDebug -PdisablePreDex + +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/ diff --git a/tools/errorprone.gradle b/tools/errorprone.gradle new file mode 100644 index 00000000..ea43695f --- /dev/null +++ b/tools/errorprone.gradle @@ -0,0 +1,25 @@ + +buildscript { + repositories { + maven { + url "https://plugins.gradle.org/m2/" + } + } + dependencies { + classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.16" + } +} + +apply plugin: "net.ltgt.errorprone" + +tasks.withType(JavaCompile) { + options.compilerArgs += [ + '-XepAllDisabledChecksAsWarnings', + '-Xep:Var:OFF', + '-XepExcludedPaths:.*/build/generated/.*', + ] +} + +configurations.errorprone { + resolutionStrategy.force 'com.google.errorprone:error_prone_core:2.2.0' +}
tor-commits@lists.torproject.org