Skip to content

Instantly share code, notes, and snippets.

@JacquesSmuts
Last active December 26, 2018 08:16
Show Gist options
  • Save JacquesSmuts/b2fba6b9f1ce938411def9dc9ddfe564 to your computer and use it in GitHub Desktop.
Save JacquesSmuts/b2fba6b9f1ce938411def9dc9ddfe564 to your computer and use it in GitHub Desktop.
CircleCI config that builds, tests and deploys
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-25-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
tests:
working_directory: ~/code
docker:
- image: circleci/android:api-25-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- store_artifacts:
path: app/build/reports
destination: reports
- run:
name: Run Lint Test
command: ./gradlew lint
- run:
name: Run Tests
command: ./gradlew lint test
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
deploy:
working_directory: ~/code
docker:
- image: circleci/android:api-25-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Decode and store Keystore
command: |
echo $ENCODED_KEYSTORE | base64 --decode >> ${HOME}/keystore
echo 'export KEYSTORE=${HOME}/keystore' >> $BASH_ENV
- run:
name: Decode and store Private Key
command: |
echo $DEPLOYMENT_PRIVATE_KEY | base64 --decode >> ${HOME}/deployment_private_key.json
echo 'export PRIVATE_KEY=${HOME}/rxstarter_pk.json' >> $BASH_ENV
- run:
name: Upload to Google Play
command: ./gradlew publishRelease
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment