Merge branch 'add-base-ci-job' into 'master'

Add base ci job

See merge request fdroid/fdroidclient!977
This commit is contained in:
Hans-Christoph Steiner 2021-02-23 12:07:18 +00:00
commit 725c82c1b0

View File

@ -1,15 +1,10 @@
image: registry.gitlab.com/fdroid/ci-images-client:latest
cache:
paths:
- .gradle/wrapper
- .gradle/caches
stages: stages:
- test - test
- deploy - deploy
before_script: .base:
image: registry.gitlab.com/fdroid/ci-images-client:latest
before_script:
- export GRADLE_USER_HOME=$PWD/.gradle - export GRADLE_USER_HOME=$PWD/.gradle
- export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle` - export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' app/build.gradle`
- alias sdkmanager="sdkmanager --no_https" - alias sdkmanager="sdkmanager --no_https"
@ -17,8 +12,17 @@ before_script:
# limit RAM usage for all gradle runs # limit RAM usage for all gradle runs
- export maxmem=$(expr $(sed -n 's,^MemAvailable:[^0-9]*\([0-9][0-9]*\)[^0-9]*$,\1,p' /proc/meminfo) / 1024 / 2 / 1024 \* 1024) - export maxmem=$(expr $(sed -n 's,^MemAvailable:[^0-9]*\([0-9][0-9]*\)[^0-9]*$,\1,p' /proc/meminfo) / 1024 / 2 / 1024 \* 1024)
- printf '\norg.gradle.jvmargs=-Xmx${maxmem}m -XX:MaxPermSize=${maxmem}m\norg.gradle.daemon=false\norg.gradle.parallel=false\n' >> local.properties - printf '\norg.gradle.jvmargs=-Xmx${maxmem}m -XX:MaxPermSize=${maxmem}m\norg.gradle.daemon=false\norg.gradle.parallel=false\n' >> local.properties
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/
cache:
paths:
- .gradle/wrapper
- .gradle/caches
.test-template: &test-template .test-template: &test-template
extends: .base
stage: test stage: test
artifacts: artifacts:
name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}" name: "${CI_PROJECT_PATH}_${CI_JOB_STAGE}_${CI_COMMIT_REF_NAME}_${CI_COMMIT_SHA}"
@ -56,6 +60,7 @@ test_lint_pmd_checkstyle:
- exit $EXITVALUE - exit $EXITVALUE
errorprone: errorprone:
extends: .base
stage: test stage: test
script: script:
- apt-get update - apt-get update
@ -68,6 +73,7 @@ errorprone:
# once these prove stable, the task should be switched to # once these prove stable, the task should be switched to
# connectedCheck to test all the build flavors # connectedCheck to test all the build flavors
.connected-template: &connected-template .connected-template: &connected-template
extends: .base
script: script:
- ./gradlew assembleFullDebug - ./gradlew assembleFullDebug
- export AVD_SDK=`echo $CI_JOB_NAME | awk '{print $2}'` - export AVD_SDK=`echo $CI_JOB_NAME | awk '{print $2}'`
@ -112,6 +118,7 @@ connected 26 google_apis x86:
- branches@eighthave/fdroidclient - branches@eighthave/fdroidclient
deploy_nightly: deploy_nightly:
extends: .base
stage: deploy stage: deploy
only: only:
- master - master
@ -131,8 +138,3 @@ deploy_nightly:
# build the APKs! # build the APKs!
- ./gradlew assembleDebug - ./gradlew assembleDebug
- fdroid nightly -v - 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/