Skip to content

Commit 7485117

Browse files
author
Jake Soenneker
committed
Move to new structure
1 parent 348c6ff commit 7485117

File tree

6 files changed

+75
-14
lines changed

6 files changed

+75
-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.Extensions.Long.Tests.csproj --no-restore --verbosity normal
48+
run: dotnet test test/Soenneker.Extensions.Long.Tests/Soenneker.Extensions.Long.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 & 7 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

@@ -15,7 +14,6 @@ jobs:
1514
publish-package:
1615
runs-on: ubuntu-latest
1716

18-
#{Services}
1917
steps:
2018
- uses: actions/checkout@v4
2119

@@ -29,17 +27,54 @@ jobs:
2927
with:
3028
dotnet-version: 8.0.x
3129

32-
- name: Install dependencies
33-
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
3450
3551
- name: Build
3652
run: dotnet build --configuration Release --no-restore
3753

3854
- name: Test
39-
run: dotnet test test/Soenneker.Extensions.Long.Tests.csproj --no-restore --verbosity normal
55+
run: dotnet test test/Soenneker.Extensions.Long.Tests/Soenneker.Extensions.Long.Tests.csproj --no-restore --verbosity normal
4056

4157
- name: Pack
4258
run: dotnet pack --no-build --configuration Release --output .
4359

44-
- name: Publish to nuGet
45-
run: dotnet nuget push **\*.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_TOKEN}} --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.Extensions.Long.sln

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

test/Soenneker.Extensions.Long.Tests.csproj renamed to test/Soenneker.Extensions.Long.Tests/Soenneker.Extensions.Long.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</ItemGroup>
3131

3232
<ItemGroup>
33-
<ProjectReference Include="..\src\Soenneker.Extensions.Long.csproj" />
33+
<ProjectReference Include="..\..\src\Soenneker.Extensions.Long.csproj" />
3434
</ItemGroup>
3535

3636
</Project>

0 commit comments

Comments
 (0)