name: Quality

on:
  push:
  pull_request:
  workflow_dispatch:

permissions:
  contents: read

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

jobs:
  backend-quality:
    runs-on: ubuntu-24.04
    steps:
      - name: Check out the repository
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false

      - name: Run isolated quality and security gates
        run: ./scripts/quality.sh

  browser-e2e:
    runs-on: ubuntu-24.04
    steps:
      - name: Check out the repository
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false

      - name: Run isolated browser end-to-end tests
        run: ./scripts/e2e-run.sh

  external-boundaries:
    runs-on: ubuntu-24.04
    steps:
      - name: Check out the repository
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false

      - name: Run isolated OAuth, SMTP, and push boundary drill
        run: ./scripts/external-boundaries-run.sh ci-boundaries

  android-build:
    runs-on: ubuntu-24.04
    steps:
      - name: Check out the repository
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          persist-credentials: false

      - name: Build, lint, and unit-test the debug Android app
        env:
          WNH_ENV_FILE: .env.example
        run: ./scripts/android-build.sh

      - name: Exercise signed APK and Play AAB release pipeline
        run: ./scripts/android-release-ci.sh
