# 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'

jobs:
  verify-test:
    strategy:
      fail-fast: false
      matrix:
        include:
          - machine: windows-2022
            containers: windows
          - machine: ubuntu-20.04
            containers: linux
          - machine: macos-11
            containers: none
    runs-on: ${{ matrix.machine }}
    steps:
      - uses: actions/checkout@v3.3.0
      - uses: actions/setup-dotnet@v3.0.3
        with:
          dotnet-version: | 
            6.0.x
            7.0.x
      - 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
        uses: actions/upload-artifact@v3.1.2
        if: always()
        with:
          name: logs-${{ matrix.machine }}
          path: build_data/
