Skip to content

Commit 1efa493

Browse files
author
Jake Soenneker
committed
Move to new structure
1 parent dc46378 commit 1efa493

File tree

6 files changed

+76
-14
lines changed

6 files changed

+76
-14
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.AsyncSingleton.Tests.csproj --no-restore --verbosity normal
48+
run: dotnet test test/Soenneker.Utils.AsyncSingleton.Tests/Soenneker.Utils.AsyncSingleton.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.AsyncSingleton.Tests.csproj --no-restore --verbosity normal
55+
run: dotnet test test/Soenneker.Utils.AsyncSingleton.Tests/Soenneker.Utils.AsyncSingleton.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.AsyncSingleton.sln

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
@@ -20,7 +20,7 @@
2020
</ItemGroup>
2121

2222
<ItemGroup>
23-
<ProjectReference Include="..\src\Soenneker.Utils.AsyncSingleton.csproj" />
23+
<ProjectReference Include="..\..\src\Soenneker.Utils.AsyncSingleton.csproj" />
2424
</ItemGroup>
2525

2626
</Project>

0 commit comments

Comments
 (0)