Skip to content

Instantly share code, notes, and snippets.

@rogererill
Created June 19, 2019 14:19
Show Gist options
  • Save rogererill/8240d28fa5bccfa2b762a9a15f371c82 to your computer and use it in GitHub Desktop.
Save rogererill/8240d28fa5bccfa2b762a9a15f371c82 to your computer and use it in GitHub Desktop.
version: 2
workspace_root: &workspace_root
~/workspace
config_android: &config_android
working_directory: *workspace_root
docker:
- image: circleci/android:api-28
environment:
GRADLE_OPTS: '
-Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -XX:MaxPermSize=512m"
-Dorg.gradle.daemon=false
-Dorg.gradle.workers.max=3
-Dkotlin.incremental=false'
resource_class: large
attach_workspace: &attach_workspace
attach_workspace:
at: *workspace_root
config_no_android: &config_no_android
working_directory: *workspace_root
docker:
- image: alpine/git
general_cache_key: &general_cache_key
key: circleciimage-{{ checksum "build.gradle" }}-{{ checksum "buildSrc/src/main/kotlin/com/android21buttons/Libs.kt" }}
jobs:
Checkout:
<<: *config_no_android
steps:
- checkout
- persist_to_workspace:
root: ~/workspace
paths:
- .
Download dependencies:
<<: *config_android
steps:
- *attach_workspace
- restore_cache:
<<: *general_cache_key
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
<<: *general_cache_key
paths:
- ~/.gradle
Deploy:
<<: *config_android
steps:
- *attach_workspace
- restore_cache:
<<: *general_cache_key
- run:
name: Run static analysis
command: ./gradlew ktlintCheck detekt
- run:
name: Compile Android test sources
command: ./gradlew compileDebugAndroidTestSources
- run:
name: Unit tests
command: ./gradlew testDebug
- run:
name: Assemble PR
command: ./gradlew :app:assembleRelease
- store_artifacts:
path: app/build/outputs/apk/
destination: apk/
- store_artifacts:
path: app/build/outputs/mapping/
destination: mapping/
- run:
name: Deploy PR
command: ~/workspace/scripts/deploy_hockeyapp.sh
workflows:
version: 2
PR pipeline:
jobs:
- Checkout
- Download dependencies:
requires:
- Checkout
- Deploy:
requires:
- Checkout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment