Skip to content

Commit 181ecd8

Browse files
author
Jake Soenneker
committed
Move to new structure
1 parent e2a9ee5 commit 181ecd8

File tree

11 files changed

+75
-13
lines changed

11 files changed

+75
-13
lines changed

.github/workflows/build-and-test.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,32 @@ jobs:
2020
with:
2121
dotnet-version: 8.0.x
2222

23-
- name: Install dependencies
24-
run: dotnet restore
23+
- name: Install dependencies with retry
24+
run: |
25+
retries=5
26+
base_wait_time=15
27+
exponent=2
28+
29+
for i in $(seq 1 $retries); do
30+
if dotnet restore; then
31+
break
32+
fi
33+
34+
if [ $i -lt $retries ]; then
35+
wait_time=$(awk "BEGIN {print int($base_wait_time * ($exponent ^ ($i - 1)))}")
36+
echo "dotnet restore failed, retrying in $wait_time seconds..."
37+
sleep $wait_time
38+
else
39+
echo "dotnet restore failed after $retries retries."
40+
exit 1
41+
fi
42+
done
2543
2644
- name: Build
2745
run: dotnet build --configuration Release --no-restore
2846

2947
- name: Test
30-
run: dotnet test test/Soenneker.Utils.BackgroundQueue.Tests.csproj --no-restore --verbosity normal
48+
run: dotnet test test/Soenneker.Utils.BackgroundQueue.Tests/Soenneker.Utils.BackgroundQueue.Tests.csproj --no-restore --verbosity normal
3149

3250
- name: Pack
3351
run: dotnet pack --no-build --configuration Release --output .

.github/workflows/publish-package.yml

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
branches:
55
- main
66

7-
# Publish `v1.2.3` tags as releases.
87
tags:
98
- v*
109

@@ -28,17 +27,54 @@ jobs:
2827
with:
2928
dotnet-version: 8.0.x
3029

31-
- name: Install dependencies
32-
run: dotnet restore
30+
- name: Install dependencies with retry
31+
run: |
32+
retries=5
33+
base_wait_time=15
34+
exponent=2
35+
36+
for i in $(seq 1 $retries); do
37+
if dotnet restore; then
38+
break
39+
fi
40+
41+
if [ $i -lt $retries ]; then
42+
wait_time=$(awk "BEGIN {print int($base_wait_time * ($exponent ^ ($i - 1)))}")
43+
echo "dotnet restore failed, retrying in $wait_time seconds..."
44+
sleep $wait_time
45+
else
46+
echo "dotnet restore failed after $retries retries."
47+
exit 1
48+
fi
49+
done
3350
3451
- name: Build
3552
run: dotnet build --configuration Release --no-restore
3653

3754
- name: Test
38-
run: dotnet test test/Soenneker.Utils.BackgroundQueue.Tests.csproj --no-restore --verbosity normal
55+
run: dotnet test test/Soenneker.Utils.BackgroundQueue.Tests/Soenneker.Utils.BackgroundQueue.Tests.csproj --no-restore --verbosity normal
3956

4057
- name: Pack
4158
run: dotnet pack --no-build --configuration Release --output .
4259

43-
- name: Publish to nuGet
44-
run: dotnet nuget push **\*.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate
60+
- name: Publish to NuGet with retry
61+
run: |
62+
nupkg_files=$(find . -name "*.nupkg")
63+
retries=5
64+
base_wait_time=20
65+
exponent=3.5
66+
67+
for i in $(seq 1 $retries); do
68+
if dotnet nuget push $nupkg_files --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_TOKEN}} --skip-duplicate; then
69+
break
70+
fi
71+
72+
if [ $i -lt $retries ]; then
73+
wait_time=$(awk "BEGIN {print int($base_wait_time * ($exponent ^ ($i - 1)))}")
74+
echo "NuGet publish failed, retrying in $wait_time seconds..."
75+
sleep $wait_time
76+
else
77+
echo "NuGet publish failed after $retries retries."
78+
exit 1
79+
fi
80+
done

Soenneker.Utils.BackgroundQueue.sln

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
1616
.github\workflows\publish-package.yml = .github\workflows\publish-package.yml
1717
EndProjectSection
1818
EndProject
19-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Soenneker.Utils.BackgroundQueue.Tests", "test\Soenneker.Utils.BackgroundQueue.Tests.csproj", "{6456E465-9523-4612-9115-9D9B585B42E8}"
19+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Soenneker.Utils.BackgroundQueue.Tests", "test\Soenneker.Utils.BackgroundQueue.Tests\Soenneker.Utils.BackgroundQueue.Tests.csproj", "{6456E465-9523-4612-9115-9D9B585B42E8}"
20+
EndProject
21+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{8D2D7C4E-6519-4211-B09C-1B0E55A0F684}"
22+
EndProject
23+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{BA9DE495-DEC7-4A01-984B-8388B7ACD5A1}"
2024
EndProject
2125
Global
2226
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -38,8 +42,12 @@ Global
3842
EndGlobalSection
3943
GlobalSection(NestedProjects) = preSolution
4044
{D786EC1A-4F59-412F-8624-83E6E3525B0C} = {4E42254D-039C-40ED-B3F4-8C1A94A366D1}
41-
EndGlobalSection
45+
46+
{41850636-33B4-4228-AE59-A2113F66B9FA} = {8D2D7C4E-6519-4211-B09C-1B0E55A0F684}
47+
48+
{6456E465-9523-4612-9115-9D9B585B42E8} = {BA9DE495-DEC7-4A01-984B-8388B7ACD5A1}
49+
EndGlobalSection
4250
GlobalSection(ExtensibilityGlobals) = postSolution
4351
SolutionGuid = {B849EC5C-B7B3-4C90-9B66-CBC15CCB776A}
4452
EndGlobalSection
45-
EndGlobal
53+
EndGlobal
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/Soenneker.Utils.BackgroundQueue.Tests.csproj renamed to test/Soenneker.Utils.BackgroundQueue.Tests/Soenneker.Utils.BackgroundQueue.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</ItemGroup>
3333

3434
<ItemGroup>
35-
<ProjectReference Include="..\src\Soenneker.Utils.BackgroundQueue.csproj" />
35+
<ProjectReference Include="..\..\src\Soenneker.Utils.BackgroundQueue.csproj" />
3636
</ItemGroup>
3737

3838
</Project>
File renamed without changes.

0 commit comments

Comments
 (0)