Skip to content

Commit

Permalink
refactor: use retry action for failed tests (#349)
Browse files Browse the repository at this point in the history
Use [retry action](https://github.com/marketplace/actions/retry-action)
to retry a failed test step once in the build pipeline.

Co-authored-by: Valentin Breuß <[email protected]>
  • Loading branch information
vbreuss and vbtig authored Aug 5, 2023
1 parent e5a16b7 commit 8389630
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 12 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ jobs:
- name: Build solution
run: dotnet build /p:NetCoreOnly=True --configuration "Release"
- name: Run tests
run: dotnet test --no-build --collect:"XPlat Code Coverage"
uses: Wandalen/[email protected]
with:
command: dotnet test --no-build --collect:"XPlat Code Coverage"
attempt_limit: 2
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
Expand All @@ -101,7 +104,10 @@ jobs:
- name: Build solution
run: dotnet build /p:NetCoreOnly=True --configuration "Release"
- name: Run tests
run: dotnet test --no-build --collect:"XPlat Code Coverage"
uses: Wandalen/[email protected]
with:
command: dotnet test --no-build --collect:"XPlat Code Coverage"
attempt_limit: 2
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
Expand All @@ -125,7 +131,10 @@ jobs:
- name: Build solution
run: dotnet build /p:NetCoreOnly=True --configuration "Release"
- name: Run tests
run: dotnet test --no-build --collect:"XPlat Code Coverage"
uses: Wandalen/[email protected]
with:
command: dotnet test --no-build --collect:"XPlat Code Coverage"
attempt_limit: 2
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -176,7 +185,10 @@ jobs:
- name: Build example solution
run: dotnet build Examples /p:UseFileReferenceToTestablyLibraries=True
- name: Run example tests
run: dotnet test Examples --no-build
uses: Wandalen/[email protected]
with:
command: dotnet test Examples --no-build
attempt_limit: 2

upload-coverage:
name: Upload coverage to Codacy
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ jobs:
- name: Build solution
run: dotnet build /p:NetCoreOnly=True --configuration "Release"
- name: Run tests
run: dotnet test --no-build --collect:"XPlat Code Coverage" --logger trx --results-directory "TestResults"
uses: Wandalen/[email protected]
with:
command: dotnet test --no-build --collect:"XPlat Code Coverage" --logger trx --results-directory "TestResults"
attempt_limit: 2
- name: Upload test results (MacOS)
if: ${{ always() }}
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -53,7 +56,10 @@ jobs:
- name: Build solution
run: dotnet build /p:NetCoreOnly=True --configuration "Release"
- name: Run tests
run: dotnet test --no-build --collect:"XPlat Code Coverage" --logger trx --results-directory "TestResults"
uses: Wandalen/[email protected]
with:
command: dotnet test --no-build --collect:"XPlat Code Coverage" --logger trx --results-directory "TestResults"
attempt_limit: 2
- name: Upload test results (Ubuntu)
if: ${{ always() }}
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -83,7 +89,10 @@ jobs:
- name: Build solution
run: dotnet build /p:NetCoreOnly=True --configuration "Release"
- name: Run tests
run: dotnet test --no-build --collect:"XPlat Code Coverage" --logger trx --results-directory "TestResults"
uses: Wandalen/[email protected]
with:
command: dotnet test --no-build --collect:"XPlat Code Coverage" --logger trx --results-directory "TestResults"
attempt_limit: 2
- name: Upload test results (Windows)
if: ${{ always() }}
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -130,8 +139,10 @@ jobs:
with:
fetch-depth: 0
- name: Save PR number to file
if: github.event_name == 'pull_request'
run: echo ${{ github.event.number }} > PR_NUMBER.txt
- name: Archive PR number
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v3
with:
name: PR_NUMBER
Expand All @@ -147,4 +158,7 @@ jobs:
- name: Build example solution
run: dotnet build Examples /p:UseFileReferenceToTestablyLibraries=True
- name: Run example tests
run: dotnet test Examples --no-build
uses: Wandalen/[email protected]
with:
command: dotnet test Examples --no-build
attempt_limit: 2
20 changes: 16 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ jobs:
- name: Build solution
run: dotnet build /p:NetCoreOnly=True --configuration "Release"
- name: Run tests
run: dotnet test --no-build
uses: Wandalen/[email protected]
with:
command: dotnet test --no-build
attempt_limit: 2

test-ubuntu:
name: Test (Ubuntu)
Expand All @@ -112,7 +115,10 @@ jobs:
- name: Build solution
run: dotnet build /p:NetCoreOnly=True --configuration "Release"
- name: Run tests
run: dotnet test --no-build
uses: Wandalen/[email protected]
with:
command: dotnet test --no-build
attempt_limit: 2

test-windows:
name: Test (Windows)
Expand All @@ -136,7 +142,10 @@ jobs:
- name: Build solution
run: dotnet build /p:NetCoreOnly=True --configuration "Release"
- name: Run tests
run: dotnet test --no-build
uses: Wandalen/[email protected]
with:
command: dotnet test --no-build
attempt_limit: 2

test-net-framework:
name: Test (.NET Framework)
Expand Down Expand Up @@ -186,7 +195,10 @@ jobs:
- name: Build example solution
run: dotnet build Examples /p:UseFileReferenceToTestablyLibraries=True --configuration "Release"
- name: Run example tests
run: dotnet test Examples --no-build
uses: Wandalen/[email protected]
with:
command: dotnet test Examples --no-build
attempt_limit: 2

stryker-ubuntu:
name: Analyze quality of unit test coverage with .NET Stryker (Ubuntu)
Expand Down

0 comments on commit 8389630

Please sign in to comment.