From 4e659b35d7d603b48d919eda554f804e55493a78 Mon Sep 17 00:00:00 2001 From: Martin/Geno Date: Fri, 9 Nov 2018 15:13:53 +0100 Subject: [PATCH] add .gitlab-ci --- .gitlab-ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..7436d55f4 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,48 @@ +image: registry.gitlab.com/fdroid/ci-images-client:latest + +cache: + paths: + - .gradle/wrapper + - .gradle/caches + +stages: + - build + +before_script: + - export GRADLE_USER_HOME=$PWD/.gradle + - export ANDROID_COMPILE_SDK=`sed -n 's,.*compileSdkVersion\s*\([0-9][0-9]*\).*,\1,p' build.gradle` + - echo y | sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" > /dev/null + +build: + stage: build + except: + - develop + script: + - ./gradlew assembleConversationsFreeCompatDebug + artifacts: + paths: + - build/outputs/ + +publish: + stage: build + only: + - develop + script: + # workaround for bug in fdroid nightly + - sed -i "s/servergitmirror = 'git@' +/servergitmirror = 'gitlab@' +/" /usr/lib/python3/dist-packages/fdroidserver/nightly.py + - sed -i "s/git@/gitlab@/" /usr/lib/python3/dist-packages/fdroidserver/index.py + # generate new version + - export versionCode=`printf '%05d' $(date '+%s'| cut -b4-8)` + - sed -i "s/^\(\s*versionCode\s*[0-9]*\).*/\1$versionCode/" build.gradle + - export versionName=`printf '%s-%05d' $(git describe --tag --abbrev=0) $versionCode` + - sed -i "0,/versionName/s/^\(\s*versionName\).*/\1 \"$versionName\"/" build.gradle + - cat -n build.gradle + # build free version + - ./gradlew assembleConversationsFreeCompatDebug + # publish on nightly fdroid repo + - 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/