-
-
Save bffcorreia/8e552da0fdbed75c59c4b0f3c85cc73b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
references: | |
## Workspaces | |
workspace: &workspace | |
~/src | |
## Docker image configurations | |
android_config: &android_config | |
working_directory: *workspace | |
docker: | |
- image: circleci/android:api-27-alpha | |
environment: | |
TERM: dumb | |
_JAVA_OPTIONS: "-Xmx2048m -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap" | |
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m"' | |
## Cache | |
gradle_key: &gradle_key | |
jars-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} | |
gems_key: &gems_key | |
gems-{{ checksum "Gemfile.lock" }} | |
restore_gradle_cache: &restore_gradle_cache | |
restore_cache: | |
key: *gradle_key | |
restore_gems_cache: &restore_gems_cache | |
restore_cache: | |
key: *gems_key | |
save_gradle_cache: &save_gradle_cache | |
save_cache: | |
key: *gradle_key | |
paths: | |
- ~/.gradle | |
- ~/.m2 | |
save_gems_cache: &save_gems_cache | |
save_cache: | |
key: *gems_key | |
paths: | |
- vendor/bundle | |
## Dependencies | |
ruby_dependencies: &ruby_dependencies | |
run: | |
name: Download Ruby Dependencies | |
command: bundle check || bundle install --path vendor/bundle | |
android_dependencies: &android_dependencies | |
run: | |
name: Download Android Dependencies | |
command: ./gradlew androidDependencies | |
## Keys | |
decode_android_key: &decode_android_key | |
run: | |
name: Decode Android key store | |
command: echo $KEYSTORE | base64 -di | tee keystore.jks app/keystore.jks >/dev/null | |
create_google_play_key: &create_google_play_key | |
run: | |
name: Create Google Play key | |
command: echo $GOOGLE_PLAY_KEY > google-play-key.json | |
jobs: | |
## Run unit tests | |
test_unit: | |
<<: *android_config | |
steps: | |
- checkout | |
- *restore_gradle_cache | |
- *restore_gems_cache | |
- *ruby_dependencies | |
- *android_dependencies | |
- *save_gradle_cache | |
- *save_gems_cache | |
- run: | |
name: Run unit tests | |
command: bundle exec fastlane unit_tests | |
- store_artifacts: | |
path: app/build/reports/ | |
destination: /reports/ | |
- store_test_results: | |
path: app/build/test-results/ | |
destination: /test-results/ | |
## Run instrumentation tests | |
test_instrumentation: | |
<<: *android_config | |
steps: | |
- checkout | |
- *restore_gradle_cache | |
- *restore_gems_cache | |
- *ruby_dependencies | |
- *android_dependencies | |
- *save_gradle_cache | |
- *save_gems_cache | |
# Since we will download a video, we require integrity checking with CRC32c | |
# But the crcmod installation in the docker image isn't using the module's C extension | |
# So, uninstall it and install again with the C extension | |
- run: | |
name: Uninstall crcmod | |
command: echo "y" | sudo pip uninstall crcmod | |
- run: | |
name: Install crcmod | |
command: sudo pip install -U crcmod | |
- run: | |
name: Run instrumentation tests in Firebase testlab | |
command: bundle exec fastlane instrumentation_tests_testlab | |
- store_artifacts: | |
path: firebase/ | |
destination: /firebase/ | |
## Deploy to Crashlytics Beta | |
deploy_crashlytics: | |
<<: *android_config | |
steps: | |
- checkout | |
- *restore_gradle_cache | |
- *restore_gems_cache | |
- *ruby_dependencies | |
- *android_dependencies | |
- *save_gradle_cache | |
- *save_gems_cache | |
- run: | |
name: Deploy to Crashlytics Beta | |
command: bundle exec fastlane deploy_to_crashlytics | |
## Deploy to Play Store | |
deploy_play_store: | |
<<: *android_config | |
steps: | |
- checkout | |
- *restore_gradle_cache | |
- *restore_gems_cache | |
- *ruby_dependencies | |
- *android_dependencies | |
- *save_gradle_cache | |
- *save_gems_cache | |
- *decode_android_key | |
- *create_google_play_key | |
- run: | |
name: Deploy to Play Store | |
command: bundle exec fastlane deploy_to_play_store | |
- store_artifacts: | |
path: app/build/outputs/apk/ | |
destination: /apk/ | |
- store_artifacts: | |
path: app/build/outputs/mapping/ | |
destination: /mapping/ | |
workflows: | |
version: 2 | |
workflow: | |
jobs: | |
- test_unit | |
- test_instrumentation: | |
requires: | |
- test_unit | |
- deploy_crashlytics: | |
filters: | |
branches: | |
only: | |
- beta | |
requires: | |
- test_unit | |
- test_instrumentation | |
- deploy_play_store: | |
filters: | |
branches: | |
only: | |
- production | |
requires: | |
- test_unit | |
- test_instrumentation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment