|
image: openjdk:8-jdk
|
|
|
|
stages:
|
|
- build
|
|
- test
|
|
- deploy
|
|
|
|
variables:
|
|
ANDROID_COMPILE_SDK: egrep '^[[:blank:]]+compileSdkVersion' app/build.gradle | awk '{print $2}'
|
|
|
|
before_script:
|
|
#- apt-get --quiet update --yes
|
|
#- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
|
|
# Explict output for logging purpose only
|
|
- echo $ANDROID_SDK_TOOLS
|
|
- echo $ANDROID_COMPILE_SDK
|
|
# Fetch the specified SDK tools version to build with
|
|
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
|
|
- unzip -d android-sdk android-sdk.zip
|
|
# Install platform tools and Android SDK for the compile target
|
|
- echo y | android-sdk/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
|
|
#- echo y | android-sdk/tools/bin/sdkmanager "platform-tools" >/dev/null
|
|
#- echo y | android-sdk/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
|
|
# Adds to environment path
|
|
- export ANDROID_HOME=$PWD/android-sdk
|
|
- export PATH=$PATH:$PWD/android-sdk/platform-tools/
|
|
- chmod +x ./gradlew
|
|
# temporarily disable checking for EPIPE error and use yes to accept all licenses
|
|
#- set +o pipefail
|
|
#- yes | android-sdk/tools/bin/sdkmanager --licenses
|
|
#- set -o pipefail
|
|
|
|
artifacts:
|
|
expire_in: 1 week
|
|
paths:
|
|
- app/build/outputs/
|
|
|
|
lintAll:
|
|
stage: test
|
|
except:
|
|
- master
|
|
script:
|
|
- ./gradlew --console=plain lint
|
|
|
|
lintRelease:
|
|
stage: test
|
|
only:
|
|
- master
|
|
script:
|
|
- ./gradlew --console=plain lintRelease
|
|
|
|
testAll:
|
|
stage: test
|
|
except:
|
|
- master
|
|
script:
|
|
- ./gradlew --console=plain test
|
|
|
|
testRelease:
|
|
stage: test
|
|
only:
|
|
- master
|
|
script:
|
|
- ./gradlew --console=plain testReleaseUnitTest
|
|
|
|
buildDebug:
|
|
stage: build
|
|
except:
|
|
- master
|
|
script:
|
|
- ./gradlew assembleDebug
|
|
|
|
buildRelease:
|
|
stage: build
|
|
only:
|
|
- master
|
|
script:
|
|
- ./gradlew assembleRelease
|
|
|
|
release:
|
|
image: "aplyca/semantic-release"
|
|
stage: deploy
|
|
script:
|
|
- semantic-release --help
|