TiagoMSSantos/MobileRT

View on GitHub
.github/workflows/android.yml

Summary

Maintainability
Test Coverage
name: Android

on:
  workflow_dispatch:
  push:
    paths-ignore:
    - '*'
    - '**/**'
    - '!.github/workflows/android.yml'
    - '!.github/workflows/android_matrix.json'
    - '!.github/workflows/reusable-android.yml'
    - '!codecov.yml'
    - '!app/third_party/conan/Android/**'
    - '!scripts/compile_android.sh'
    - '!scripts/run_tests.sh'
    - '!scripts/run_tests_android.sh'
    - '!scripts/check_android.sh'
    - '!scripts/helper_functions.sh'
    - '!**/CMakeLists*'
    - '!**/*.java*'
    - '!**/*.kt*'
    - '!**/*.c*'
    - '!**/*.h'
    - '!**/*.hpp'
    - '!**/*gradle*'

defaults:
  run:
    shell: sh
    working-directory: .

concurrency:
  group: ${{ github.workflow }} ${{ github.ref }}
  cancel-in-progress: true

# Default environment variables.
env:
  GITHUB_STEP_TIMEOUT_SMALL: 4
  GITHUB_STEP_TIMEOUT_MEDIUM: 10
  GITHUB_STEP_TIMEOUT_LONG: 20

jobs:
  Matrix:
    if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'

    name: Set Matrix
    runs-on: ubuntu-latest
    timeout-minutes: 2

    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}

    steps:
      - name: Checkout
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        if: success()
        uses: actions/checkout@v4

      - name: Set Matrix
        id: set-matrix
        timeout-minutes: ${{ fromJSON(env.GITHUB_STEP_TIMEOUT_SMALL) }}
        if: success()
        run: |
          # Android usage: https://apilevels.com/
          MATRIX=$(echo $(cat .github/workflows/android_matrix.json) | sed 's/ //g');
          echo "Matrix: ${MATRIX}";
          echo "matrix=${MATRIX}" >> ${GITHUB_OUTPUT};

  Android:
    needs: [Matrix]
    name: Android ${{ matrix.android_api }} ${{ matrix.type }} (${{ matrix.host_os }})
    strategy:
      fail-fast: false
      matrix: ${{ fromJSON(needs.Matrix.outputs.matrix) }}
    uses: ./.github/workflows/reusable-android.yml
    with:
      host_os: ${{ matrix.host_os }}
      android_api: ${{ matrix.android_api }}
      type: ${{ matrix.type }}
    # If you might want to use a secret in the build or test job then you would need to pass secrets, inherit disables secret isolation
    secrets: inherit