image: registry.gitlab.com/fdroid/ci-images-client:latest cache: paths: - .gradle/wrapper - .gradle/caches - .android stages: - build - test 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 script: # generate version number - export versionCode=`printf $(git rev-list --first-parent --count HEAD)` - export versionName=`printf '%s-%05d' $(git describe --tag --abbrev=0) $versionCode` - echo "set VersionCode '${versionCode}' and VersonName '${versionName}'" - sed -i "s/^\(\s*versionCode\s*\).*$/\1$versionCode/" build.gradle - sed -i "0,/versionName/s/^\(\s*versionName\).*/\1 \"$versionName\"/" build.gradle - cat -n build.gradle # build - ./gradlew assembleStandard # publish on nightly fdroid repo - fdroid nightly artifacts: paths: - build/outputs/ test: stage: test script: - ./gradlew lint artifacts: paths: - build/outputs/ 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/