name: Run Flank
on:
  push:
    branches:
      - main
jobs:
  run_flank:
    runs-on: ubuntu-latest
    name: Run Flank Android Tests
    steps:
      - uses: actions/checkout@v4
      - uses: Flank/flank@master
        id: flank_run
        with:
          version: v21.03.1
          service_account: ${{ secrets.SERVICE_ACCOUNT }}
          platform: android
          flank_configuration_file: './testing/android/flank-simple-success.yml'
      - name: Output Results
        run: |
          echo "Local directory: ${{ steps.flank_run.outputs.local_results_directory }}"
          echo "Gcloud results: ${{ steps.flank_run.outputs.gcloud_results_directory }}"
What is Flank GitHub Action?
This GitHub Action allows you to run Flank in a GitHub workflow to manage Android and iOS testing efficiently. Flank executes tests using Google Cloud Test Lab, providing scalable test execution.
How to Specify the Flank Version
You can choose a specific Flank version by using the version input. If not specified, it will default to the latest available version.
with:
  version: v21.03.1  # or leave it blank for the latest version
How to Authenticate with a Service Account
The service_account input is used to authenticate with Google Cloud. You can pass the path to the service account file, link to the file, or the file content itself. It is recommended to store sensitive data like service account files in GitHub Secrets.
with:
  service_account: ${{ secrets.SERVICE_ACCOUNT }}  # Store service account in GitHub secrets
How to Select the Platform
Flank supports both Android and iOS platforms. You can specify which platform to run tests on by using the platform input.
with:
  platform: android  # Can be 'android' or 'ios'
How to Provide a Flank Configuration File
The flank_configuration_file input is mandatory and should point to the configuration file that defines your testing setup. The file path must be relative to the root of your repository.
with:
  flank_configuration_file: './testing/android/flank-simple-success.yml'
Example Workflow with Service Account from Secrets
- name: flank run
  id: flank_run
  uses: Flank/flank@master
  with:
    version: v21.03.1
    service_account: ${{ secrets.SERVICE_ACCOUNT }}
    platform: android
    flank_configuration_file: './testing/android/flank-simple-success.yml'
Example Workflow with Service Account from Repository
- name: flank run
  id: flank_run
  uses: Flank/flank@master
  with:
    service_account: './service_account.json'
    platform: android
    flank_configuration_file: './testing/android/flank-simple-success.yml'
Example Workflow with Service Account Creation
- name: Create service account
  run: echo '${{ secrets.SERVICE_ACCOUNT }}' > service_account_created.json
- name: flank run
  id: flank_run
  uses: Flank/flank@master
  with:
    service_account: './service_account_created.json'
    platform: android
    flank_configuration_file: './testing/android/flank-simple-success.yml'
Flank Outputs
- gcloud_results_directory: This output gives a link to the Google Cloud storage location where the test results are stored.
- local_results_directory: This is the local directory path where all the output files from the Flank run are stored.





