|
@ -1,39 +1,41 @@ |
|
|
image: openjdk:8-jdk |
|
|
image: openjdk:8-jdk |
|
|
|
|
|
|
|
|
stages: |
|
|
stages: |
|
|
- build |
|
|
|
|
|
- test |
|
|
- test |
|
|
|
|
|
- build |
|
|
- deploy |
|
|
- deploy |
|
|
|
|
|
|
|
|
variables: |
|
|
variables: |
|
|
ANDROID_COMPILE_SDK: egrep '^[[:blank:]]+compileSdkVersion' app/build.gradle | awk '{print $2}' |
|
|
|
|
|
|
|
|
GIT_SUBMODULE_STRATEGY: recursive |
|
|
|
|
|
GITLAB_URL: "https://framagit.org" |
|
|
|
|
|
ANDROID_SDK_TOOLS: "4333796" |
|
|
|
|
|
ANDROID_HOME: "$CI_PROJECT_DIR/.android-sdk" |
|
|
|
|
|
|
|
|
|
|
|
cache: |
|
|
|
|
|
key: ${CI_PIPELINE_ID} |
|
|
|
|
|
paths: |
|
|
|
|
|
- "$ANDROID_HOME/" |
|
|
|
|
|
- .gradle/ |
|
|
|
|
|
|
|
|
before_script: |
|
|
before_script: |
|
|
#- apt-get --quiet update --yes |
|
|
|
|
|
#- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 |
|
|
|
|
|
|
|
|
# Get sdk version from project |
|
|
|
|
|
- export ANDROID_COMPILE_SDK=`egrep '^[[:blank:]]+compileSdkVersion' app/build.gradle | awk '{print $2}'` |
|
|
# Explict output for logging purpose only |
|
|
# Explict output for logging purpose only |
|
|
|
|
|
- echo $ANDROID_HOME |
|
|
- echo $ANDROID_SDK_TOOLS |
|
|
- echo $ANDROID_SDK_TOOLS |
|
|
- echo $ANDROID_COMPILE_SDK |
|
|
- echo $ANDROID_COMPILE_SDK |
|
|
# Fetch the specified SDK tools version to build with |
|
|
# 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 |
|
|
|
|
|
|
|
|
# Currently framagit.org have all runner with the same tag and don't use a distributed cache, so validate if restored the cache per pipeline ID |
|
|
|
|
|
- if [ ! -d "$ANDROID_HOME" ]; then |
|
|
|
|
|
- wget --quiet --output-document=/tmp/android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip |
|
|
|
|
|
- unzip -o -d $ANDROID_HOME /tmp/android-sdk.zip |
|
|
|
|
|
# Install platform tools and Android SDK for the compile target |
|
|
|
|
|
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null |
|
|
|
|
|
- fi |
|
|
# Adds to environment path |
|
|
# Adds to environment path |
|
|
- export ANDROID_HOME=$PWD/android-sdk |
|
|
|
|
|
- export PATH=$PATH:$PWD/android-sdk/platform-tools/ |
|
|
|
|
|
|
|
|
- echo $CI_PROJECT_DIR |
|
|
|
|
|
- export PATH=$PATH:$ANDROID_HOME/platform-tools/ |
|
|
- chmod +x ./gradlew |
|
|
- 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: |
|
|
lintAll: |
|
|
stage: test |
|
|
stage: test |
|
@ -69,6 +71,10 @@ buildDebug: |
|
|
- master |
|
|
- master |
|
|
script: |
|
|
script: |
|
|
- ./gradlew assembleDebug |
|
|
- ./gradlew assembleDebug |
|
|
|
|
|
artifacts: |
|
|
|
|
|
expire_in: 1 week |
|
|
|
|
|
paths: |
|
|
|
|
|
- app/build/outputs/ |
|
|
|
|
|
|
|
|
buildRelease: |
|
|
buildRelease: |
|
|
stage: build |
|
|
stage: build |
|
@ -76,9 +82,19 @@ buildRelease: |
|
|
- master |
|
|
- master |
|
|
script: |
|
|
script: |
|
|
- ./gradlew assembleRelease |
|
|
- ./gradlew assembleRelease |
|
|
|
|
|
artifacts: |
|
|
|
|
|
expire_in: 1 week |
|
|
|
|
|
paths: |
|
|
|
|
|
- app/build/outputs/ |
|
|
|
|
|
|
|
|
release: |
|
|
release: |
|
|
image: "aplyca/semantic-release" |
|
|
|
|
|
stage: deploy |
|
|
stage: deploy |
|
|
|
|
|
before_script: |
|
|
|
|
|
- wget --quiet --output-document=/tmp/nvm-install.sh https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh |
|
|
|
|
|
- bash /tmp/nvm-install.sh |
|
|
|
|
|
- export NVM_DIR="$HOME/.nvm" &&. "$NVM_DIR/nvm.sh" && nvm install 8 |
|
|
|
|
|
cache: {} |
|
|
script: |
|
|
script: |
|
|
- semantic-release --help |
|
|
|
|
|
|
|
|
- npm install -g semantic-release @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/changelog @semantic-release/gitlab |
|
|
|
|
|
- git checkout $CI_COMMIT_SHA |
|
|
|
|
|
- semantic-release -p @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/changelog @semantic-release/gitlab --debug |