Skip to content

Instantly share code, notes, and snippets.

@rharter
Created May 24, 2018 21:07
Show Gist options
  • Save rharter/242eda8360e129c519af6e6a0a59a2f4 to your computer and use it in GitHub Desktop.
Save rharter/242eda8360e129c519af6e6a0a59a2f4 to your computer and use it in GitHub Desktop.
Example Circle CI config file
version: 2.0
defaults: &defaults
docker:
- image: menny/android_ndk:latest
working_directory: ~/pigment
environment:
_JAVA_OPTIONS: "-Xmx1400m -XX:ParallelGCThreads=2 -XX:ConcGCThreads=2 -XX:ParallelGCThreads=2 -Djava.util.concurrent.ForkJoinPool.common.parallelism=2"
TERM: dumb
update_sdk: &update_sdk
name: Update SDK
command: |
mkdir "${ANDROID_HOME}/licenses" || true
echo -e "8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > ${ANDROID_HOME}/licenses/android-sdk-license
echo -e "84831b9409646a918e30573bab4c9c91346d8abd" > ${ANDROID_HOME}/licenses/android-sdk-preview-license
echo -e "d975f751698a77b662f1254ddbeed3901e976f5a" > ${ANDROID_HOME}/licenses/intel-android-sysimage-license
jobs:
build:
<<: *defaults
steps:
- run:
<<: *update_sdk
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "masker/build.gradle" }}-{{ checksum "imageloader/build.gradle" }}-{{ checksum ".circleci/config.yml" }}
- run:
name: Download Dependencies
command: ./gradlew dependencies --no-daemon || true
- run:
name: Decrypt secrets
command: signing/setup.sh $ENCRYPT_KEY
- run:
name: Check and assemble APKs
command: ./gradlew clean check --no-daemon
- run:
name: Cleanup secrets
command: signing/cleanup.sh
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "masker/build.gradle" }}-{{ checksum "imageloader/build.gradle" }}-{{ checksum ".circleci/config.yml" }}
- store_artifacts:
path: app/build/outputs/apk/release
destination: release-apks
- store_artifacts:
path: app/build/outputs/apk/debug
destination: debug-apks
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
- persist_to_workspace:
root: .
paths:
- .gradle
- build
- app/build
deploy_to_play:
<<: *defaults
steps:
- run:
<<: *update_sdk
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "masker/build.gradle" }}-{{ checksum "imageloader/build.gradle" }}-{{ checksum ".circleci/config.yml" }}
- attach_workspace:
at: ~/pigment
- run:
name: Decrypt secrets
command: signing/setup.sh $ENCRYPT_KEY
- run:
name: Deploy to Alpha channel
command: ./gradlew publishRelease --no-daemon
- run:
name: Cleanup secrets
command: signing/cleanup.sh
deploy_to_crashlytics:
<<: *defaults
steps:
- run:
<<: *update_sdk
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}-{{ checksum "masker/build.gradle" }}-{{ checksum "imageloader/build.gradle" }}-{{ checksum ".circleci/config.yml" }}
- attach_workspace:
at: ~/pigment
- run:
name: Decrypt secrets
command: signing/setup.sh $ENCRYPT_KEY
- run:
name: Build
command: ./gradlew assembleDebug --no-daemon
- run:
name: Deploy to Crashlytics Beta
command: ./gradlew crashlyticsUploadDistributionDebug --no-daemon
- run:
name: Cleanup secrets
command: signing/cleanup.sh
workflows:
version: 2
build_and_test:
jobs:
- build
- deploy_to_play:
requires:
- build
filters:
branches:
only: master
- deploy_to_crashlytics:
requires:
- build
filters:
branches:
ignore: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment