2017-08-10 12:59:13 +02:00
|
|
|
version: 2
|
|
|
|
|
|
|
|
references:
|
|
|
|
|
|
|
|
workspace_root: &workspace_root
|
|
|
|
~/wulkanowy
|
|
|
|
|
|
|
|
container_config: &container_config
|
|
|
|
docker:
|
2019-06-03 00:43:54 +02:00
|
|
|
- image: circleci/android@sha256:5cdc8626cc6f13efe5ed982cdcdb432b0472f8740fed8743a6461e025ad6cdfc
|
2017-08-10 12:59:13 +02:00
|
|
|
working_directory: *workspace_root
|
|
|
|
environment:
|
|
|
|
environment:
|
2019-04-29 20:39:35 +02:00
|
|
|
_JAVA_OPTS: -Xmx3072m
|
2017-08-10 12:59:13 +02:00
|
|
|
|
|
|
|
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:
|
2018-08-17 05:35:41 -07:00
|
|
|
- run: |
|
|
|
|
curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | bash
|
2017-08-10 12:59:13 +02:00
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
|
|
<<: *general_cache_key
|
|
|
|
- run:
|
|
|
|
name: Setup environment
|
2017-11-26 16:32:33 +01:00
|
|
|
command: ./gradlew dependencies --no-daemon --stacktrace --console=plain -PdisablePreDex || true
|
2017-08-10 12:59:13 +02:00
|
|
|
- run:
|
|
|
|
name: Initial build
|
2019-06-03 14:12:48 +02:00
|
|
|
command: ./gradlew build -x test -x lint -x fabricGenerateResourcesFdroidRelease -x fabricGenerateResourcesPlayRelease -x packageRelease --no-daemon --stacktrace --console=plain -PdisablePreDex
|
2018-05-07 19:11:28 +02:00
|
|
|
- run:
|
2018-08-17 05:35:41 -07:00
|
|
|
name: Run FOSSA
|
2018-11-01 19:27:02 +01:00
|
|
|
command: fossa --no-ansi || true
|
2017-08-10 12:59:13 +02:00
|
|
|
- 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
|
2019-06-03 14:12:48 +02:00
|
|
|
command: ./gradlew lint -x fabricGenerateResourcesFdroidRelease -x fabricGenerateResourcesPlayRelease --no-daemon --stacktrace --console=plain -PdisablePreDex
|
2017-08-10 12:59:13 +02:00
|
|
|
- store_artifacts:
|
|
|
|
path: ./app/build/reports/
|
|
|
|
destination: lint_reports/app/
|
2017-09-23 22:17:13 +02:00
|
|
|
- store_test_results:
|
|
|
|
path: ./app/build/reports/
|
2017-11-26 16:32:33 +01:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: *workspace_root
|
|
|
|
paths:
|
|
|
|
- "./app/build/reports/lint-results.xml"
|
2017-08-10 12:59:13 +02:00
|
|
|
|
2017-11-18 22:17:18 +01:00
|
|
|
app-test:
|
2017-08-10 12:59:13 +02:00
|
|
|
<<: *container_config
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- restore_cache:
|
|
|
|
<<: *general_cache_key
|
|
|
|
- run:
|
2017-11-18 22:17:18 +01:00
|
|
|
name: Run app tests
|
2019-06-03 14:12:48 +02:00
|
|
|
command: ./gradlew :app:test :app:jacocoTestReport -x fabricGenerateResourcesFdroidRelease -x fabricGenerateResourcesPlayRelease --no-daemon --stacktrace --console=plain -PdisablePreDex
|
2017-08-10 12:59:13 +02:00
|
|
|
- run:
|
2017-09-23 22:17:13 +02:00
|
|
|
name: Upload unit code coverage to codecov
|
2017-11-26 16:32:33 +01:00
|
|
|
command: bash <(curl -s https://codecov.io/bash) -F app
|
2017-08-10 12:59:13 +02:00
|
|
|
- store_artifacts:
|
2018-07-14 14:06:57 +02:00
|
|
|
path: ./app/build/reports/
|
|
|
|
destination: reports/
|
2017-08-10 12:59:13 +02:00
|
|
|
- store_test_results:
|
|
|
|
path: ./app/build/test-results
|
2017-11-26 16:32:33 +01:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: *workspace_root
|
|
|
|
paths:
|
|
|
|
- "./app/build/jacoco"
|
2017-08-10 12:59:13 +02:00
|
|
|
|
2017-09-23 22:17:13 +02:00
|
|
|
instrumented:
|
|
|
|
<<: *container_config
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- run:
|
2019-06-03 00:43:54 +02:00
|
|
|
name: Accept licenses
|
|
|
|
command: yes | sdkmanager --licenses && yes | sdkmanager --update
|
|
|
|
- run:
|
2017-09-23 22:17:13 +02:00
|
|
|
name: Setup emulator
|
2019-10-05 22:32:55 +02:00
|
|
|
command: sdkmanager "system-images;android-22;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-22;default;armeabi-v7a"
|
2017-09-23 22:17:13 +02:00
|
|
|
- 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
|
2018-03-13 22:30:33 +01:00
|
|
|
- run:
|
|
|
|
name: Change circle-android script file permissions
|
|
|
|
command: sudo chmod +rx /bin/circle-android
|
2017-09-23 22:17:13 +02:00
|
|
|
- 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: Run instrumented tests
|
2019-10-03 00:46:08 +02:00
|
|
|
command: ./gradlew clean createFdroidDebugCoverageReport jacocoTestReport --no-daemon --stacktrace --console=plain -PdisablePreDex
|
2017-09-23 22:17:13 +02:00
|
|
|
- run:
|
|
|
|
name: Collect logs from emulator
|
|
|
|
command: adb logcat -d > ./app/build/reports/logcat_emulator.txt
|
2018-08-22 22:31:17 +02:00
|
|
|
when: always
|
2017-09-23 22:17:13 +02:00
|
|
|
- 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-11-26 16:32:33 +01:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: *workspace_root
|
|
|
|
paths:
|
|
|
|
- "./app/build/outputs/code-coverage/connected"
|
|
|
|
|
|
|
|
sonarcube:
|
|
|
|
<<: *container_config
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- restore_cache:
|
|
|
|
<<: *general_cache_key
|
|
|
|
- run:
|
|
|
|
name: Prepare coverage report
|
|
|
|
command: ./gradlew jacocoTestReport --no-daemon --stacktrace --console=plain -PdisablePreDex
|
|
|
|
- run:
|
|
|
|
name: Run sonarqube runner
|
2018-12-14 21:09:15 +01:00
|
|
|
command: if [ -z ${SONAR_HOST+x} ]; then echo "sonar scan skipped"; else ./gradlew -x test -x lint sonarqube -Dsonar.host.url=$SONAR_HOST -Dsonar.organization=$SONAR_ORG -Dsonar.login=$SONAR_KEY -Dsonar.branch.name=$CIRCLE_BRANCH --no-daemon --stacktrace --console=plain -PdisablePreDex; fi
|
2018-08-17 05:35:41 -07:00
|
|
|
command: "[[ -v CIRCLE_PR_NUMBER ]] && ./gradlew -x test -x lint sonarqube -Dsonar.host.url=$SONAR_HOST -Dsonar.organization=$SONAR_ORG -Dsonar.login=$SONAR_KEY -Dsonar.branch.name=$CIRCLE_BRANCH --no-daemon --stacktrace --console=plain -PdisablePreDex || true"
|
2017-09-23 22:17:13 +02:00
|
|
|
|
2018-05-07 19:11:28 +02:00
|
|
|
deploy:
|
|
|
|
<<: *container_config
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- restore_cache:
|
|
|
|
<<: *general_cache_key
|
|
|
|
- run:
|
|
|
|
name: Decrypt keys
|
|
|
|
command: |
|
2018-12-14 00:20:54 +01:00
|
|
|
gpg --yes --batch --passphrase=$SERVICES_ENCRYPT_KEY ./app/src/release/google-services.json.gpg
|
2018-05-07 19:11:28 +02:00
|
|
|
openssl aes-256-cbc -d -in ./app/key-encrypted.p12 -k $ENCRYPT_KEY >> ./app/key.p12
|
|
|
|
openssl aes-256-cbc -d -in ./app/upload-key-encrypted.jks -k $ENCRYPT_KEY >> ./app/upload-key.jks
|
|
|
|
- run:
|
|
|
|
name: Publish release
|
2024-03-09 10:03:36 +01:00
|
|
|
command: ./gradlew publishPlayRelease --no-daemon --stacktrace --console=plain -PdisablePreDex
|
2018-05-07 19:11:28 +02:00
|
|
|
|
2017-08-10 12:59:13 +02:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
|
2018-05-14 22:20:17 +02:00
|
|
|
build-test-deploy:
|
2017-08-10 12:59:13 +02:00
|
|
|
jobs:
|
2018-05-14 22:20:17 +02:00
|
|
|
- build:
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
2017-08-10 12:59:13 +02:00
|
|
|
- lint:
|
2018-05-14 22:20:17 +02:00
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
2017-08-10 12:59:13 +02:00
|
|
|
requires:
|
|
|
|
- build
|
2017-11-18 22:17:18 +01:00
|
|
|
- app-test:
|
2018-05-14 22:20:17 +02:00
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
2017-11-18 22:17:18 +01:00
|
|
|
requires:
|
|
|
|
- build
|
2017-09-23 22:17:13 +02:00
|
|
|
- instrumented:
|
2018-05-14 22:20:17 +02:00
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
2017-11-26 16:32:33 +01:00
|
|
|
requires:
|
|
|
|
- build
|
|
|
|
- sonarcube:
|
2018-05-14 22:20:17 +02:00
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
2017-11-26 16:32:33 +01:00
|
|
|
requires:
|
|
|
|
- build
|
|
|
|
- lint
|
|
|
|
- app-test
|
|
|
|
- instrumented
|
2018-05-07 19:11:28 +02:00
|
|
|
- deploy:
|
|
|
|
requires:
|
|
|
|
- instrumented
|
|
|
|
filters:
|
2018-05-14 22:20:17 +02:00
|
|
|
tags:
|
|
|
|
only: /\d+\.\d+\.\d+/
|
2018-05-11 21:55:38 +02:00
|
|
|
branches:
|
2018-11-23 12:38:55 +01:00
|
|
|
ignore: /.*/
|