2017-08-10 05:59:13 -05:00
|
|
|
version: 2
|
|
|
|
|
|
|
|
references:
|
|
|
|
|
|
|
|
workspace_root: &workspace_root
|
|
|
|
~/wulkanowy
|
|
|
|
|
|
|
|
container_config: &container_config
|
|
|
|
docker:
|
2017-11-06 10:25:38 -06:00
|
|
|
- image: circleci/android:api-27-alpha
|
2017-08-10 05:59:13 -05:00
|
|
|
working_directory: *workspace_root
|
|
|
|
environment:
|
|
|
|
environment:
|
|
|
|
JVM_OPTS: -Xmx3200m
|
|
|
|
|
|
|
|
attach_workspace: &attach_workspace
|
|
|
|
attach_workspace:
|
|
|
|
at: *workspace_root
|
|
|
|
|
|
|
|
general_cache_key: &general_cache_key
|
|
|
|
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
build:
|
|
|
|
<<: *container_config
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
|
|
<<: *general_cache_key
|
|
|
|
- run:
|
|
|
|
name: Setup environment
|
|
|
|
command: ./gradlew --no-daemon --stacktrace dependencies || true
|
|
|
|
- run:
|
|
|
|
name: Initial build
|
2017-09-23 15:17:13 -05:00
|
|
|
command: ./gradlew --no-daemon --stacktrace assembleDebug -PdisablePreDex
|
2017-08-10 05:59:13 -05:00
|
|
|
- store_artifacts:
|
|
|
|
path: ./app/build/outputs/apk/
|
|
|
|
destination: apks/
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: *workspace_root
|
|
|
|
paths:
|
|
|
|
- .
|
|
|
|
- save_cache:
|
|
|
|
<<: *general_cache_key
|
|
|
|
paths:
|
|
|
|
- "~/.gradle"
|
|
|
|
|
|
|
|
lint:
|
|
|
|
<<: *container_config
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- restore_cache:
|
|
|
|
<<: *general_cache_key
|
|
|
|
- run:
|
|
|
|
name: Run lint
|
|
|
|
command: ./gradlew --no-daemon --stacktrace lint
|
|
|
|
- store_artifacts:
|
|
|
|
path: ./app/build/reports/
|
|
|
|
destination: lint_reports/app/
|
2017-09-23 15:17:13 -05:00
|
|
|
- store_test_results:
|
|
|
|
path: ./app/build/reports/
|
2017-08-10 05:59:13 -05:00
|
|
|
|
2017-11-18 15:17:18 -06:00
|
|
|
app-test:
|
2017-08-10 05:59:13 -05:00
|
|
|
<<: *container_config
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- restore_cache:
|
|
|
|
<<: *general_cache_key
|
|
|
|
- run:
|
2017-11-18 15:17:18 -06:00
|
|
|
name: Run app tests
|
|
|
|
command: ./gradlew --no-daemon --stacktrace :app:test
|
2017-08-10 05:59:13 -05:00
|
|
|
- run:
|
2017-09-23 15:17:13 -05:00
|
|
|
name: Upload unit code coverage to codecov
|
|
|
|
command: |
|
2017-11-18 15:17:18 -06:00
|
|
|
./gradlew --no-daemon --stacktrace :app:jacocoTestReport
|
|
|
|
bash <(curl -s https://codecov.io/bash) -F app
|
2017-09-18 11:15:33 -05:00
|
|
|
- run:
|
|
|
|
name: Upload code coverage to codacy
|
2017-11-18 15:17:18 -06:00
|
|
|
command: ./gradlew --no-daemon --stacktrace :app:codacyUpload
|
2017-08-10 05:59:13 -05:00
|
|
|
- store_artifacts:
|
|
|
|
path: ./app/build/reports/tests/
|
|
|
|
destination: tests_reports/
|
|
|
|
- store_artifacts:
|
|
|
|
path: ./app/build/reports/jacoco/jacocoTestDebugUnitTestReport/
|
|
|
|
destination: coverage_reports/
|
|
|
|
- store_test_results:
|
|
|
|
path: ./app/build/test-results
|
|
|
|
|
2017-11-18 15:17:18 -06:00
|
|
|
api-test:
|
|
|
|
<<: *container_config
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- restore_cache:
|
|
|
|
<<: *general_cache_key
|
|
|
|
- run:
|
|
|
|
name: Run api tests
|
|
|
|
command: ./gradlew --no-daemon --stacktrace :api:test
|
|
|
|
- run:
|
|
|
|
name: Upload unit code coverage to codecov
|
|
|
|
command: |
|
|
|
|
./gradlew --no-daemon --stacktrace :api:jacocoTestReport
|
|
|
|
bash <(curl -s https://codecov.io/bash) -F api
|
|
|
|
- run:
|
|
|
|
name: Upload code coverage to codacy
|
|
|
|
command: ./gradlew --no-daemon --stacktrace :api:codacyUpload
|
|
|
|
- store_artifacts:
|
|
|
|
path: ./api/build/reports/tests/
|
|
|
|
destination: tests_reports/
|
|
|
|
- store_artifacts:
|
|
|
|
path: ./api/build/reports/jacoco/test/
|
|
|
|
destination: coverage_reports/
|
|
|
|
- store_test_results:
|
|
|
|
path: ./api/build/test-results
|
|
|
|
|
2017-09-23 15:17:13 -05:00
|
|
|
instrumented:
|
|
|
|
<<: *container_config
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- run:
|
|
|
|
name: Setup emulator
|
|
|
|
command: sdkmanager "system-images;android-19;google_apis;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-19;google_apis;armeabi-v7a"
|
|
|
|
- run:
|
|
|
|
name: Launch emulator
|
|
|
|
command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on
|
|
|
|
background: true
|
|
|
|
- run:
|
|
|
|
name: Wait emulator
|
|
|
|
command: |
|
|
|
|
# wait for it to have booted
|
|
|
|
circle-android wait-for-boot
|
|
|
|
# unlock the emulator screen
|
|
|
|
sleep 30
|
|
|
|
adb shell input keyevent 82
|
|
|
|
- run:
|
|
|
|
name: Clean project
|
|
|
|
command: ./gradlew clean --no-daemon --stacktrace --console=plain -PdisablePreDex
|
|
|
|
- run:
|
|
|
|
name: Run instrumented tests
|
|
|
|
command: ./gradlew connectedAndroidTest --no-daemon --stacktrace --console=plain -PdisablePreDex
|
|
|
|
- run:
|
|
|
|
name: Collect logs from emulator
|
|
|
|
command: adb logcat -d > ./app/build/reports/logcat_emulator.txt
|
|
|
|
- run:
|
|
|
|
name: Upload code covarage to codecov
|
|
|
|
command: bash <(curl -s https://codecov.io/bash) -F instrumented
|
|
|
|
- store_artifacts:
|
|
|
|
path: ./app/build/reports
|
|
|
|
destination: reports
|
|
|
|
- store_test_results:
|
|
|
|
path: ./app/build/outputs/androidTest-results/connected/
|
|
|
|
|
2017-08-10 05:59:13 -05:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
|
|
|
|
build_check_tests:
|
|
|
|
jobs:
|
|
|
|
- build
|
|
|
|
- lint:
|
|
|
|
requires:
|
|
|
|
- build
|
2017-11-18 15:17:18 -06:00
|
|
|
- app-test:
|
|
|
|
requires:
|
|
|
|
- build
|
|
|
|
- api-test:
|
2017-08-10 05:59:13 -05:00
|
|
|
requires:
|
|
|
|
- build
|
2017-09-23 15:17:13 -05:00
|
|
|
- instrumented:
|
|
|
|
requires:
|
|
|
|
- build
|