|
| 1 | +name: run-tests-selected |
| 2 | +run-name: Run selected tests (${{ inputs.runs_on }} --framework ${{ inputs.framework}} --filter ${{ inputs.filter }}) |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + runs_on: |
| 8 | + type: choice |
| 9 | + description: GitHub Actions runner image name |
| 10 | + required: true |
| 11 | + default: ubuntu-latest |
| 12 | + options: |
| 13 | + - windows-latest |
| 14 | + - ubuntu-latest |
| 15 | + - macos-latest |
| 16 | + - windows-11-arm |
| 17 | + - ubuntu-24.04-arm |
| 18 | + - macos-13 |
| 19 | + project: |
| 20 | + type: string |
| 21 | + description: Specify test project path |
| 22 | + required: true |
| 23 | + default: tests/BenchmarkDotNet.IntegrationTests |
| 24 | + options: |
| 25 | + - tests/BenchmarkDotNet.Tests |
| 26 | + - tests/BenchmarkDotNet.IntegrationTests |
| 27 | + - tests/BenchmarkDotNet.IntegrationTests.ManualRunning |
| 28 | + framework: |
| 29 | + type: choice |
| 30 | + description: Specify target framework |
| 31 | + required: true |
| 32 | + options: |
| 33 | + - net8.0 |
| 34 | + - net462 |
| 35 | + filter: |
| 36 | + type: string |
| 37 | + description: Test filter text (It's used for `dotnet test --filter`) Use default value when running all tests |
| 38 | + required: true |
| 39 | + default: "BenchmarkDotNet" |
| 40 | + iteration_count: |
| 41 | + type: number |
| 42 | + description: Count of test loop (It's expected to be used for flaky tests) |
| 43 | + required: true |
| 44 | + default: 1 |
| 45 | + |
| 46 | +jobs: |
| 47 | + test: |
| 48 | + name: test (${{ inputs.runs_on }} --framework ${{ inputs.framework}} --filter ${{ inputs.filter }}) |
| 49 | + runs-on: ${{ inputs.runs_on }} |
| 50 | + timeout-minutes: 60 # Explicitly set timeout. When wrong input parameter is passed. It may continue to run until it times out (Default:360 minutes)) |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + |
| 54 | + # Setup |
| 55 | + - name: Setup |
| 56 | + run: | |
| 57 | + mkdir artifacts |
| 58 | +
|
| 59 | + # Build |
| 60 | + - name: Run build |
| 61 | + working-directory: ${{ github.event.inputs.project }} |
| 62 | + run: | |
| 63 | + dotnet build -c Release --framework ${{ inputs.framework }} -tl:off |
| 64 | +
|
| 65 | + # Test |
| 66 | + - name: Run tests |
| 67 | + shell: pwsh |
| 68 | + working-directory: ${{ github.event.inputs.project }} |
| 69 | + run: | |
| 70 | + $PSNativeCommandUseErrorActionPreference = $true |
| 71 | + $iterationCount = ${{ inputs.iteration_count }} |
| 72 | +
|
| 73 | + foreach($i in 1..$iterationCount) { |
| 74 | + Write-Output ('##[group]Executing Iteration: {0}/${{ inputs.iteration_count }}' -f $i) |
| 75 | +
|
| 76 | + dotnet test -c Release --framework ${{ inputs.framework }} --filter ${{ inputs.filter }} -tl:off --no-build --logger "console;verbosity=normal" |
| 77 | +
|
| 78 | + Write-Output '##[endgroup]' |
| 79 | + } |
| 80 | +
|
| 81 | + # Upload artifact files that are located at `$(GITHUB_WORKSPACE)/artifacts` directory |
| 82 | + - name: Upload test results |
| 83 | + uses: actions/upload-artifact@v4 |
| 84 | + if: always() |
| 85 | + with: |
| 86 | + name: results |
| 87 | + if-no-files-found: ignore |
| 88 | + path: | |
| 89 | + artifacts/**/* |
0 commit comments