name: Test

on:
  workflow_dispatch: {}
  workflow_run:
    workflows: ["Build"]
    types:
      - completed

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    runs-on: ubuntu-latest
    # Only run if triggered by workflow_run AND Workflow A succeeded
    if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
    steps:
      - uses: actions/checkout@v4
      - name: Run tests
        run: cargo test --verbose
