Skip to content

Instantly share code, notes, and snippets.

@kaeawc
Created December 20, 2018 21:14
Show Gist options
  • Save kaeawc/61a272fae47422741797b5b4c4084131 to your computer and use it in GitHub Desktop.
Save kaeawc/61a272fae47422741797b5b4c4084131 to your computer and use it in GitHub Desktop.
Making Circle CI not suck
#!/usr/bin/env bash
mkdir -p /opt/android/sdk/licenses || true
cp ./licenses/* /opt/android/sdk/licenses/
yes | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;28.0.3"
defaults: &defaults
resource_class: xlarge
working_directory: ~/code
docker:
- image: circleci/android:api-28-alpha
environment:
TERM: dumb
TEST_FLAGS: " --stacktrace --configure-on-demand -PdisablePreDex"
_JAVA_OPTIONS: "-Xmx8192m -XX:ParallelGCThreads=4 -XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 -Djava.util.concurrent.ForkJoinPool.common.parallelism=4"
version: 2
jobs:
build:
<<: *defaults
steps:
- checkout
- restore_cache:
key: app-{{ checksum "build.gradle" }}
- run:
name: Android SDK Licenses
command: ci/android_sdk_licenses.sh
- run:
name: Create Empty Local Properties
command: touch local.properties
- run:
name: Create Empty Release Keystore
command: touch app/release.keystore
- run:
name: Dependencies
command: ./gradlew --no-daemon --stacktrace dependencies
- run:
name: Run All Unit Tests
command: ./gradlew -q testBUILDVARIANTDebugUnitTestCoverage $TEST_FLAGS
- store_test_results:
path: "MODULE/build/test-results/testBUILDVARIANTDebugUnitTest"
- run:
name: Send coverage reports to CodeCov
command: bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -f "*testBUILDVARIANTDebugUnitTestCoverage.xml"
- save_cache:
key: app-{{ checksum "build.gradle" }}
paths:
- ~/.gradle
codecov:
branch: master
coverage:
precision: 2
round: down
range: "70...100"
ignore:
- "*/Variant*.kt"
- "*/internal/**"
- "*/*Activity.kt"
comment:
layout: "diff, tree"
branches: null
behavior: default
require_changes: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment