From 39bc0244b93f918c183b4da14980bff18ee7fb2f Mon Sep 17 00:00:00 2001 From: Distopico Vegan Date: Fri, 9 Nov 2018 12:06:35 -0500 Subject: [PATCH] update CI config --- .gitlab-ci.yml | 62 +++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9e7e35b7..83bf12d9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,39 +1,41 @@ image: openjdk:8-jdk stages: - - build - test + - build - deploy 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: - #- 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 + - echo $ANDROID_HOME - 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 + # 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 - - 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 - # 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 @@ -69,6 +71,10 @@ buildDebug: - master script: - ./gradlew assembleDebug + artifacts: + expire_in: 1 week + paths: + - app/build/outputs/ buildRelease: stage: build @@ -76,9 +82,19 @@ buildRelease: - master script: - ./gradlew assembleRelease + artifacts: + expire_in: 1 week + paths: + - app/build/outputs/ release: - image: "aplyca/semantic-release" 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: - - 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