# this workflow can be used to check if given integration test is flaky
name: verify-test

on:
  workflow_dispatch:
    inputs:
      testProject:
        description: String that partially matches test projects to run. Defaults to all test projects.
      testName:
        description: 'String that partially matches the tests to run'
      count:
        description: 'Test execution count'
        default: '20'

permissions:
  contents: read

jobs:
  verify-test:
    strategy:
      fail-fast: false
      matrix:
        include:
          - machine: windows-2022
            containers: windows
          - machine: windows-2025
            containers: windows
          - machine: ubuntu-22.04
            containers: linux
          - machine: macos-13
            containers: none
          - machine: ubuntu-22.04-arm
            containers: linux
    runs-on: ${{ matrix.machine }}
    steps:
      
      - name: Checkout
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag: v4.2.2

      - name: Setup .NET
        uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # tag: v4.3.1
        with:
          dotnet-version: | 
            8.0.412
            9.0.302

      - name: Run BuildTracer and ManagedTests
        run: ./build.cmd BuildTracer ManagedTests --containers ${{ matrix.containers }} --test-project "${{ github.event.inputs.testProject }}" --test-name '"${{ github.event.inputs.testName }}"' --test-count ${{ github.event.inputs.count }}

      - name: Upload logs
        if: always()
        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # tag: v4.6.2
        with:
          name: logs-${{ matrix.machine }}
          path: test-artifacts/
