Run selected tests (windows-11-arm --framework net10.0 --filter BenchmarkDotNet) #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: run-tests-selected | |
| run-name: Run selected tests (${{ inputs.runs_on }} --framework ${{ inputs.framework}} --filter ${{ inputs.filter }}) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| runs_on: | |
| type: choice | |
| description: GitHub Actions runner image name | |
| required: true | |
| default: ubuntu-latest | |
| options: | |
| - windows-latest | |
| - ubuntu-latest | |
| - macos-latest | |
| - windows-11-arm | |
| - ubuntu-24.04-arm | |
| - macos-26-intel | |
| project: | |
| type: choice | |
| description: Specify test project path | |
| required: true | |
| default: tests/BenchmarkDotNet.IntegrationTests | |
| options: | |
| - tests/BenchmarkDotNet.Tests | |
| - tests/BenchmarkDotNet.IntegrationTests | |
| - tests/BenchmarkDotNet.IntegrationTests.ManualRunning | |
| - tests/BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks | |
| - samples/BenchmarkDotNet.Samples | |
| framework: | |
| type: choice | |
| description: Specify target framework | |
| required: true | |
| options: | |
| - net10.0 | |
| - net472 | |
| # Following target framework is used for `MultipleFrameworks` tests | |
| - net8.0 | |
| - net462 | |
| - net48 | |
| filter: | |
| type: string | |
| description: Test filter text (It's used for `dotnet test --filter`) Use default value when running all tests | |
| required: true | |
| default: "BenchmarkDotNet" | |
| iteration_count: | |
| type: number | |
| description: Count of test loop (It's expected to be used for flaky tests) | |
| required: true | |
| default: 1 | |
| skip_setup_additional_tools: | |
| type: boolean | |
| description: Skip setup additional tools for Wasm/NativeAot related tests | |
| required: true | |
| default: false | |
| jobs: | |
| test: | |
| name: test (${{ inputs.runs_on }} --framework ${{ inputs.framework}} --filter ${{ inputs.filter }}) | |
| runs-on: ${{ inputs.runs_on }} | |
| timeout-minutes: 60 # Explicitly set timeout. When wrong input parameter is passed. It may continue to run until it times out (Default:360 minutes)) | |
| steps: | |
| # Checkout | |
| - uses: actions/checkout@v4 | |
| # Add Windows Defender Exclusions | |
| - uses: ./.github/actions/add-windowsdefender-exclusions | |
| if: runner.os == 'Windows' | |
| # Setup | |
| - name: Create `artifacts` directory | |
| run: | | |
| mkdir artifacts | |
| # Setup additional tools | |
| - name: Setup additional tools for Wasm/NativeAot tests | |
| uses: ./.github/actions/setup-additional-tools | |
| if: ${{ !inputs.skip_setup_additional_tools }} | |
| # Build | |
| - name: Run build | |
| working-directory: ${{ inputs.project }} | |
| run: | | |
| dotnet build -c Release --framework ${{ inputs.framework }} -tl:off | |
| # Test | |
| - name: Run tests | |
| shell: pwsh | |
| working-directory: ${{ inputs.project }} | |
| run: | | |
| $PSNativeCommandUseErrorActionPreference = $true | |
| $iterationCount = ${{ inputs.iteration_count }} | |
| foreach($i in 1..$iterationCount) { | |
| Write-Output ('##[group]Executing Iteration: {0}/${{ inputs.iteration_count }}' -f $i) | |
| dotnet test -c Release --framework ${{ inputs.framework }} --filter ${{ inputs.filter }} -tl:off --no-build --logger "console;verbosity=normal" | |
| Write-Output '##[endgroup]' | |
| } | |
| # Upload artifact files that are located at `$(GITHUB_WORKSPACE)/artifacts` directory | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: results | |
| if-no-files-found: ignore | |
| path: | | |
| artifacts/**/* | |
| **/BenchmarkDotNet.Artifacts/** |