Speed up circleci by allowing different flavours to build in parallel

This commit is contained in:
ByteHamster 2019-09-24 18:07:43 +02:00
parent a92123340d
commit 667be71e0f
1 changed files with 51 additions and 23 deletions

View File

@ -1,49 +1,77 @@
version: 2 version: 2
jobs: jobs:
test: test-debug:
docker: docker:
- image: circleci/android:api-28 - image: circleci/android:api-28
working_directory: ~/AntennaPod working_directory: ~/AntennaPod
environment: environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1536m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError"' GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1536m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError"'
_JAVA_OPTIONS: "-Xms256m -Xmx1280m" _JAVA_OPTIONS: "-Xms256m -Xmx1280m"
steps: steps:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- v1-android-{{ checksum "build.gradle" }} - v1-android-{{ checksum "build.gradle" }}
# fallback to using the latest cache if no exact match is found
- v1-android- - v1-android-
- run:
name: Create temporary release keystore
command: keytool -noprompt -genkey -v -keystore "app/keystore" -alias alias -storepass password -keypass password -keyalg RSA -validity 10 -dname "CN=antennapod.org, OU=dummy, O=dummy, L=dummy, S=dummy, C=US"
- run: - run:
name: Build debug name: Build debug
command: ./gradlew assembleDebug -PdisablePreDex command: ./gradlew assembleDebug -PdisablePreDex
- run:
name: Execute debug unit tests
command: ./gradlew :core:testPlayDebugUnitTest -PdisablePreDex
- save_cache:
paths:
- ~/.android
- ~/.gradle
- ~/android
key: v1-android-{{ checksum "build.gradle" }}
test-release:
docker:
- image: circleci/android:api-28
working_directory: ~/AntennaPod
environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1536m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError"'
_JAVA_OPTIONS: "-Xms256m -Xmx1280m"
steps:
- checkout
- restore_cache:
keys:
- v1-android-{{ checksum "build.gradle" }}
- v1-android-
- run:
name: Create temporary release keystore
command: keytool -noprompt -genkey -v -keystore "app/keystore" -alias alias -storepass password -keypass password -keyalg RSA -validity 10 -dname "CN=antennapod.org, OU=dummy, O=dummy, L=dummy, S=dummy, C=US"
- run: - run:
name: Build release name: Build release
command: ./gradlew assembleRelease -PdisablePreDex command: ./gradlew assembleRelease -PdisablePreDex
- run: - run:
name: Execute unit tests name: Execute release unit tests
command: ./gradlew :core:testPlayReleaseUnitTest -PdisablePreDex command: ./gradlew :core:testPlayReleaseUnitTest -PdisablePreDex
- save_cache:
paths:
- ~/.android
- ~/.gradle
- ~/android
key: v1-android-{{ checksum "build.gradle" }}
build-androidtest:
docker:
- image: circleci/android:api-28
working_directory: ~/AntennaPod
environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1536m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError"'
_JAVA_OPTIONS: "-Xms256m -Xmx1280m"
steps:
- checkout
- restore_cache:
keys:
- v1-android-{{ checksum "build.gradle" }}
- v1-android-
- run: - run:
name: Build integration tests name: Build integration tests
command: ./gradlew :app:assemblePlayDebugAndroidTest -PdisablePreDex command: ./gradlew :app:assemblePlayDebugAndroidTest -PdisablePreDex
- store_artifacts:
path: app/build/outputs/apk
destination: apks
- save_cache: - save_cache:
paths: paths:
- ~/.android - ~/.android
@ -55,10 +83,8 @@ jobs:
docker: docker:
- image: circleci/android:api-28 - image: circleci/android:api-28
working_directory: ~/AntennaPod working_directory: ~/AntennaPod
steps: steps:
- checkout - checkout
- run: - run:
name: Checkstyle name: Checkstyle
command: ./gradlew checkstyle command: ./gradlew checkstyle
@ -66,10 +92,12 @@ jobs:
workflows: workflows:
version: 2 version: 2
test: unit-tests:
jobs: jobs:
- test - test-debug
- test-release
- build-androidtest
checkstyle: static-analysis:
jobs: jobs:
- checkstyle - checkstyle