blob: e81129d5974658ffaf3c491e2415f86ddaa428ee [file] [log] [blame]
job_config: &job_config
working_directory: ~/code
docker:
- image: circleci/openjdk:9.0.4-12-jdk
resource_class: xlarge
environment:
JVM_OPTS: -Xmx4096m
GRADLE_MAX_PARALLEL_FORKS: 2
ANDROID_HOME: /home/circleci/Android
version: 2
jobs:
build:
<< : *job_config
steps:
- checkout
- run:
name: Calculate Cache Hash
command: |
find . \( -name \*.gradle -or -name \*.groovy -or -name \*.sh -or -name \*.rb -or -name circle.yml \) -exec shasum {} \; | sort > .cache-hash
cat .cache-hash
- restore_cache:
key: cache-{{ checksum ".cache-hash" }}
- run:
name: Download Dependencies
command: |
curl --output ~/android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
mkdir ~/Android && (cd ~/Android && unzip ~/android-sdk.zip)
yes | sudo SDKMANAGER_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee' $ANDROID_HOME/tools/bin/sdkmanager --licenses || true
SDKMANAGER_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee' $ANDROID_HOME/tools/bin/sdkmanager --install 'platforms;android-28' > /dev/null
./gradlew --parallel prefetchDependencies
- save_cache:
paths:
- ~/.gradle
- ~/.m2
- ~/Android
key: cache-{{ checksum ".cache-hash" }}
- run:
name: Build
command: SKIP_JAVADOC=true ./gradlew clean assemble testClasses --parallel --stacktrace
- persist_to_workspace:
root: ~/code
paths:
- ".cache-hash"
- "[a-zA-Z]*" # not .git
test_16_17_18:
<< : *job_config
steps:
- attach_workspace:
at: ~/code
- restore_cache:
key: cache-{{ checksum ".cache-hash" }}
- run:
name: Test 16 17 18 (JELLY_BEAN)
command: |
GRADLE_MAX_PARALLEL_FORKS=2 \
SKIP_JAVADOC=true \
./gradlew test --info --stacktrace --continue \
--parallel \
-Drobolectric.enabledSdks=16,17,18 \
-Drobolectric.alwaysIncludeVariantMarkersInTestName=true \
-Dorg.gradle.workers.max=2
- run:
name: Collect Test Results
command: |
mkdir -p ~/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
- store_artifacts:
path: build/reports
destination: reports
test_19_21_22:
<< : *job_config
steps:
- attach_workspace:
at: ~/code
- restore_cache:
key: cache-{{ checksum ".cache-hash" }}
- run:
name: Test 19 21 22 (KITKAT/LOLLIPOP)
command: |
GRADLE_MAX_PARALLEL_FORKS=2 \
SKIP_JAVADOC=true \
./gradlew test --info --stacktrace --continue \
--parallel \
-Drobolectric.enabledSdks=19,21,22 \
-Drobolectric.alwaysIncludeVariantMarkersInTestName=true \
-Dorg.gradle.workers.max=2
- run:
name: Collect Test Results
command: |
mkdir -p ~/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
- store_artifacts:
path: build/reports
destination: reports
test_23_24_25:
<< : *job_config
steps:
- attach_workspace:
at: ~/code
- restore_cache:
key: cache-{{ checksum ".cache-hash" }}
- run:
name: Test 23 24 25 (M/N)
command: |
GRADLE_MAX_PARALLEL_FORKS=2 \
SKIP_JAVADOC=true \
./gradlew test --info --stacktrace --continue \
--parallel \
-Drobolectric.enabledSdks=23,24,25 \
-Drobolectric.alwaysIncludeVariantMarkersInTestName=true \
-Dorg.gradle.workers.max=2
- run:
name: Collect Test Results
command: |
mkdir -p ~/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
- store_artifacts:
path: build/reports
destination: reports
test_26_27:
<< : *job_config
steps:
- attach_workspace:
at: ~/code
- restore_cache:
key: cache-{{ checksum ".cache-hash" }}
- run:
name: Test 26 27 (O)
command: |
GRADLE_MAX_PARALLEL_FORKS=2 \
SKIP_JAVADOC=true \
./gradlew test --info --stacktrace --continue \
--parallel \
-Drobolectric.enabledSdks=26,27 \
-Drobolectric.alwaysIncludeVariantMarkersInTestName=true \
-Dorg.gradle.workers.max=2
- run:
name: Collect Test Results
command: |
mkdir -p ~/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
- store_artifacts:
path: build/reports
destination: reports
test_28_29:
<< : *job_config
steps:
- attach_workspace:
at: ~/code
- restore_cache:
key: cache-{{ checksum ".cache-hash" }}
- run:
name: Test 28 29 (P/Q)
command: |
GRADLE_MAX_PARALLEL_FORKS=2 \
SKIP_JAVADOC=true \
./gradlew test --info --stacktrace --continue \
--parallel \
-Drobolectric.enabledSdks=28,10000 \
-Drobolectric.alwaysIncludeVariantMarkersInTestName=true \
-Dorg.gradle.workers.max=2
- run:
name: Collect Test Results
command: |
mkdir -p ~/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
when: always
- store_test_results:
path: ~/junit
- store_artifacts:
path: build/reports
destination: reports
finish:
<< : *job_config
steps:
- attach_workspace:
at: ~/code
- restore_cache:
key: cache-{{ checksum ".cache-hash" }}
- run:
name: Upload Snapshot
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
./gradlew upload --no-rebuild
fi
workflows:
version: 2
build-and-test:
jobs:
- build
- test_16_17_18:
requires:
- build
- test_19_21_22:
requires:
- build
- test_23_24_25:
requires:
- build
- test_26_27:
requires:
- build
- test_28_29:
requires:
- build
- finish:
requires:
- test_16_17_18
- test_19_21_22
- test_23_24_25
- test_26_27
- test_28_29