Skip to content

Instantly share code, notes, and snippets.

@jeanPokou
Created March 29, 2019 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeanPokou/15ea7e55908889bc6bdefeb4278d3246 to your computer and use it in GitHub Desktop.
Save jeanPokou/15ea7e55908889bc6bdefeb4278d3246 to your computer and use it in GitHub Desktop.
Attemp of android ci with semaphore
version: v1.0
name: Inclusive-Android
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
blocks:
- name: SETUP
task:
env_vars:
# Set up environment variable for android
- name: ANDROID_HOME
value: $PWD/android-sdk-linux
- name: ANDROID_COMPILE_SDK
value: "28"
-name: ANDROID_BUILD_TOOLS
value: "28.0.2"
-name: ANDROID_SDK_TOOLS
value: "26.1.1"
jobs:
- name: Install dependencies
commands:
- checkout
# Restore ANDROID_HOME
- cache restore $ANDROID_HOME-$SEMAPHORE_GIT_BRANCH,$ANDROID_HOME
- sudo apt-get --quiet update --yes
- sudo apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
- unzip -d android-sdk-linux android-sdk.zip
- echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
# Temporarily disable checking for EPIPE error and use yes to accept all licenses
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
# Cache ANDROID_HOME
- cache store $ANDROID_HOME-$SEMAPHORE_GIT_BRANCH-$,$ANDROID_HOME
- name: LINT
task:
prologue:
commands:
- checkout
- cache restore $ANDROID_HOME-$SEMAPHORE_GIT_BRANCH, $ANDROID_HOME
jobs:
- name: Lint
commands:
- gradlew lintDebug
- name: TEST
task:
prologue:
commands:
- checkout
- cache restore $ANDROID_HOME-$SEMAPHORE_GIT_BRANCH, $ANDROID_HOME
jobs:
- name: Test
commands:
- gradlew test
- name: BUILD
task:
prologue:
commands:
- checkout
- cache restore $ANDROID_HOME-$SEMAPHORE_GIT_BRANCH, $ANDROID_HOME
jobs:
- name: Build
commands:
- gradlew assembleDebug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment