Skip to content

Instantly share code, notes, and snippets.

@viktorbenei
Last active November 2, 2018 16:32
Show Gist options
  • Save viktorbenei/555a23293ee0ff9478e583a34d2a45a4 to your computer and use it in GitHub Desktop.
Save viktorbenei/555a23293ee0ff9478e583a34d2a45a4 to your computer and use it in GitHub Desktop.
bitrise flank config

Bitrise Flank config

See the bitrise.yml for an example setup, using https://github.com/TestArmada/flank on https://www.bitrise.io/

The config requires the following variables to be set as Secrets:

  • SERVICE_ACCOUNT_KEY_JSON : the Google (Firebase) Service Account JSON
  • GOOGLE_CLOUD_PROJECT : the Firebase google project name/id

Note: if you'd get an error like Test run failed to complete. Expected 786 tests, received 660 that can mean that the test app is not orchestrator compatible. If that's the case simply change the use-orchestrator: true to use-orchestrator: false in the Flank config (flank.yml) and it'll work.

---
format_version: '6'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
trigger_map:
- push_branch: "*"
workflow: primary
- pull_request_source_branch: "*"
workflow: primary
workflows:
primary:
steps:
- activate-ssh-key@4.0.3:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@4.0.11: {}
- cache-pull@2.0.1: {}
- install-missing-android-tools@2.2.0:
inputs:
- gradlew_path: "$PROJECT_LOCATION/gradlew"
- android-lint@0.9.4:
inputs:
- project_location: "$PROJECT_LOCATION"
- module: "$MODULE"
- variant: "$TEST_VARIANT"
- android-unit-test@0.9.3:
inputs:
- project_location: "$PROJECT_LOCATION"
- module: "$MODULE"
- variant: "$TEST_VARIANT"
- gradle-runner@1.8.3:
inputs:
- gradlew_path: "./gradlew"
- gradle_task: assembleDebug assembleDebugAndroidTest
- script@1.1.5:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
echo "$SERVICE_ACCOUNT_KEY_JSON" > $HOME/.config/gcloud/application_default_credentials.json
title: Save Google Service Account JSON
- script@1.1.5:
title: Generate Flank config
inputs:
- content: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
cat << FLANKEOF > ./flank.yml
# gcloud args match the official gcloud cli
# https://cloud.google.com/sdk/gcloud/reference/firebase/test/android/run
gcloud:
# results-bucket: tmp_flank
record-video: true
timeout: 30m
async: false
# project: delta-essence-114723
# results-history-name: android-history
# test and app are the only required args
app: $BITRISE_APK_PATH
test: $BITRISE_TEST_APK_PATH
auto-google-login: true
use-orchestrator: true
environment-variables:
clearPackageData: true
directories-to-pull:
- /sdcard/screenshots
performance-metrics: true
device:
- model: NexusLowRes
version: 28
flank:
# test shards - the amount of groups to split the test suite into
# set to -1 to use one shard per test.
testShards: 1
# repeat tests - the amount of times to run the tests.
# 1 runs the tests once. 10 runs all the tests 10x
repeatTests: 1
# always run - these tests are inserted at the beginning of every shard
# useful if you need to grant permissions or login before other tests run
# test-targets-always-run:
# - class com.example.app.ExampleUiTest#testPasses
FLANKEOF
- script@1.1.5:
inputs:
- content: |-
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
wget --quiet https://github.com/TestArmada/flank/releases/download/flank_snapshot/flank.jar -O /usr/local/bin/flank.jar
java -jar /usr/local/bin/flank.jar firebase test android run
title: Run Flank
- deploy-to-bitrise-io@1.3.15: {}
- cache-push@2.0.5: {}
app:
envs:
- opts:
is_expand: false
PROJECT_LOCATION: "."
- opts:
is_expand: false
MODULE: app
- opts:
is_expand: false
BUILD_VARIANT: Debug
- opts:
is_expand: false
TEST_VARIANT: Debug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment