Separated test runs by framework to avoid file-locking conflicts #154
Workflow file for this run
This file contains 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: build-test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
timeout-minutes: 60 | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Build project | |
run: dotnet build -bl:build.binlog --configuration Release | |
# there are cases where this will fail and we want to know about it | |
# so we don't use continue-on-error, but we still want to publish the results | |
# Separate test steps for each framework to avoid file lock issues | |
- name: Test project (netcoreapp2.1) | |
id: test_netcoreapp21 | |
run: dotnet test --no-build -bl:test_netcoreapp21.binlog --framework netcoreapp2.1 --filter "TestCategory != SkipOnTeamCity" --blame-hang-timeout 5m --logger:"trx;LogFilePrefix=results_netcoreapp21" --results-directory ./test-results/netcoreapp2.1 | |
- name: Kill lingering test processes | |
run: | | |
taskkill /F /IM testhost.exe /T || exit 0 | |
taskkill /F /IM dotnet.exe /T || exit 0 | |
continue-on-error: true | |
- name: Test project (net6.0) | |
id: test_net6 | |
run: dotnet test --no-build -bl:test_net6.binlog --framework net6.0 --filter "TestCategory != SkipOnTeamCity" --blame-hang-timeout 5m --logger:"trx;LogFilePrefix=results_net6" --results-directory ./test-results/net6.0 | |
- name: Kill lingering test processes | |
run: | | |
taskkill /F /IM testhost.exe /T || exit 0 | |
taskkill /F /IM dotnet.exe /T || exit 0 | |
continue-on-error: true | |
- name: Test project (net8.0) | |
id: test_net8 | |
run: dotnet test --no-build -bl:test_net8.binlog --framework net8.0 --filter "TestCategory != SkipOnTeamCity" --blame-hang-timeout 5m --logger:"trx;LogFilePrefix=results_net8" --results-directory ./test-results/net8.0 | |
- name: Publish test results | |
if: ${{ !cancelled() && (steps.test_netcoreapp21.outcome != 'skipped' || steps.test_net6.outcome != 'skipped' || steps.test_net8.outcome != 'skipped') }} | |
uses: EnricoMi/publish-unit-test-result-action/windows@v2 | |
with: | |
check_name: LibPalaso Tests | |
files: | | |
./test-results/netcoreapp2.1/**/*.trx | |
./test-results/net6.0/**/*.trx | |
./test-results/net8.0/**/*.trx | |
action_fail: true | |
action_fail_on_inconclusive: true | |
- name: Publish logs on failure | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: binary-logs | |
path: | | |
build.binlog | |
test_netcoreapp21.binlog | |
test_net6.binlog | |
test_net8.binlog |