Skip to content

Commit d33407a

Browse files
committed
adds retry mechanism for failing steps
Adds a retry step for unit tests and docker tests on failure to enhance reliability.
1 parent 35dcb69 commit d33407a

File tree

4 files changed

+36
-15
lines changed

4 files changed

+36
-15
lines changed

.github/actions/docker-test/action.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,25 @@ runs:
1616
steps:
1717
-
1818
name: '[Docker Build & Test] DockerHub'
19-
shell: pwsh
20-
run: |
19+
uses: nick-fields/retry@v3
20+
with:
21+
shell: pwsh
22+
timeout_minutes: 30
23+
max_attempts: 3
24+
retry_on: error
25+
command: |
2126
dotnet run/docker.dll --target=DockerTest `
2227
--arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnet_version }} `
2328
--docker_distro=${{ inputs.docker_distro }} --docker_registry dockerhub --verbosity=diagnostic
2429
-
2530
name: '[Docker Build & Test] GitHub'
26-
shell: pwsh
27-
run: |
31+
uses: nick-fields/retry@v3
32+
with:
33+
shell: pwsh
34+
timeout_minutes: 30
35+
max_attempts: 3
36+
retry_on: error
37+
command: |
2838
dotnet run/docker.dll --target=DockerTest `
2939
--arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnet_version }} `
3040
--docker_distro=${{ inputs.docker_distro }} --docker_registry github --verbosity=diagnostic

.github/workflows/_artifacts_linux.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
env:
1818
DOTNET_INSTALL_DIR: "./.dotnet"
1919
DOTNET_ROLL_FORWARD: "Major"
20-
20+
2121
jobs:
2222
artifacts:
2323
name: ${{ matrix.docker_distro }} - net${{ matrix.dotnet_version }}
@@ -53,8 +53,14 @@ jobs:
5353
uses: ./.github/actions/docker-setup
5454
-
5555
name: '[Test Artifacts]'
56-
shell: pwsh
57-
run: |
56+
uses: nick-fields/retry@v3
57+
with:
58+
shell: pwsh
59+
timeout_minutes: 30
60+
max_attempts: 3
61+
retry_on: error
62+
command: |
5863
dotnet run/artifacts.dll `
59-
--target=ArtifactsTest --arch=${{ inputs.arch }} --dotnet_version=${{ matrix.dotnet_version }} `
60-
--docker_distro=${{ matrix.docker_distro }}
64+
--target=ArtifactsTest --arch=${{ inputs.arch }} `
65+
--dotnet_version=${{ matrix.dotnet_version }} `
66+
--docker_distro=${{ matrix.docker_distro }}

.github/workflows/_unit_tests.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
os: [windows-2025, ubuntu-24.04, macos-15]
19+
os: [ windows-2025, ubuntu-24.04, macos-15 ]
2020
dotnet_version: ${{ fromJson(inputs.dotnet_versions) }}
2121

2222
runs-on: ${{ matrix.os }}
@@ -29,10 +29,15 @@ jobs:
2929
-
3030
name: Restore State
3131
uses: ./.github/actions/cache-restore
32-
-
33-
name: '[Unit Test]'
34-
shell: pwsh
35-
run: dotnet run/build.dll --target=Test --dotnet_version=${{ matrix.dotnet_version }}
32+
33+
- name: '[Unit Test]'
34+
uses: nick-fields/retry@v3
35+
with:
36+
shell: pwsh
37+
timeout_minutes: 30
38+
max_attempts: 3
39+
retry_on: error
40+
command: 'dotnet run/build.dll --target=Test --dotnet_version=${{ matrix.dotnet_version }}'
3641

3742
-
3843
name: Test Summary

qodana.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ exclude:
110110
- GitVersion.Core/VersionCalculation/VersionSearchStrategies/TrackReleaseBranchesVersionStrategy.cs
111111
- GitVersion.Configuration/Builders/IgnoreConfigurationBuilder.cs
112112
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
113-
bootstrap: dotnet build src/GitVersion.slnx
113+
bootstrap: curl -fsSL https://dot.net/v1/dotnet-install.sh | bash -s -- --jsonfile /data/project/global.json -i /usr/share/dotnet && dotnet build src/GitVersion.slnx
114114
dotnet:
115115
frameworks: net8.0;net9.0
116116
solution: src/GitVersion.slnx

0 commit comments

Comments
 (0)