Skip to content

Commit

Permalink
Move to new structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Soenneker committed Sep 17, 2024
1 parent 51b017b commit afbd09e
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 13 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,32 @@ jobs:
with:
dotnet-version: 8.0.x

- name: Install dependencies
run: dotnet restore
- name: Install dependencies with retry
run: |
retries=5
base_wait_time=15
exponent=2
for i in $(seq 1 $retries); do
if dotnet restore; then
break
fi
if [ $i -lt $retries ]; then
wait_time=$(awk "BEGIN {print int($base_wait_time * ($exponent ^ ($i - 1)))}")
echo "dotnet restore failed, retrying in $wait_time seconds..."
sleep $wait_time
else
echo "dotnet restore failed after $retries retries."
exit 1
fi
done
- name: Build
run: dotnet build --configuration Release --no-restore

- name: Test
run: dotnet test test/Soenneker.Extensions.MethodInfo.Tests.csproj --no-restore --verbosity normal
run: dotnet test test/Soenneker.Extensions.MethodInfo.Tests/Soenneker.Extensions.MethodInfo.Tests.csproj --no-restore --verbosity normal

- name: Pack
run: dotnet pack --no-build --configuration Release --output .
48 changes: 42 additions & 6 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
branches:
- main

# Publish `v1.2.3` tags as releases.
tags:
- v*

Expand All @@ -28,17 +27,54 @@ jobs:
with:
dotnet-version: 8.0.x

- name: Install dependencies
run: dotnet restore
- name: Install dependencies with retry
run: |
retries=5
base_wait_time=15
exponent=2
for i in $(seq 1 $retries); do
if dotnet restore; then
break
fi
if [ $i -lt $retries ]; then
wait_time=$(awk "BEGIN {print int($base_wait_time * ($exponent ^ ($i - 1)))}")
echo "dotnet restore failed, retrying in $wait_time seconds..."
sleep $wait_time
else
echo "dotnet restore failed after $retries retries."
exit 1
fi
done
- name: Build
run: dotnet build --configuration Release --no-restore

- name: Test
run: dotnet test test/Soenneker.Extensions.MethodInfo.Tests.csproj --no-restore --verbosity normal
run: dotnet test test/Soenneker.Extensions.MethodInfo.Tests/Soenneker.Extensions.MethodInfo.Tests.csproj --no-restore --verbosity normal

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

- name: Publish to nuGet
run: dotnet nuget push **\*.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate
- name: Publish to NuGet with retry
run: |
nupkg_files=$(find . -name "*.nupkg")
retries=5
base_wait_time=20
exponent=3.5
for i in $(seq 1 $retries); do
if dotnet nuget push $nupkg_files --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_TOKEN}} --skip-duplicate; then
break
fi
if [ $i -lt $retries ]; then
wait_time=$(awk "BEGIN {print int($base_wait_time * ($exponent ^ ($i - 1)))}")
echo "NuGet publish failed, retrying in $wait_time seconds..."
sleep $wait_time
else
echo "NuGet publish failed after $retries retries."
exit 1
fi
done
14 changes: 11 additions & 3 deletions Soenneker.Extensions.MethodInfo.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\publish-package.yml = .github\workflows\publish-package.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Soenneker.Extensions.MethodInfo.Tests", "test\Soenneker.Extensions.MethodInfo.Tests.csproj", "{6456E465-9523-4612-9115-9D9B585B42E8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Soenneker.Extensions.MethodInfo.Tests", "test\Soenneker.Extensions.MethodInfo.Tests\Soenneker.Extensions.MethodInfo.Tests.csproj", "{6456E465-9523-4612-9115-9D9B585B42E8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{8D2D7C4E-6519-4211-B09C-1B0E55A0F684}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{BA9DE495-DEC7-4A01-984B-8388B7ACD5A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -38,8 +42,12 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D786EC1A-4F59-412F-8624-83E6E3525B0C} = {4E42254D-039C-40ED-B3F4-8C1A94A366D1}
EndGlobalSection

{41850636-33B4-4228-AE59-A2113F66B9FA} = {8D2D7C4E-6519-4211-B09C-1B0E55A0F684}

{6456E465-9523-4612-9115-9D9B585B42E8} = {BA9DE495-DEC7-4A01-984B-8388B7ACD5A1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B849EC5C-B7B3-4C90-9B66-CBC15CCB776A}
EndGlobalSection
EndGlobal
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\src\Soenneker.Extensions.MethodInfo.csproj" />
<ProjectReference Include="..\..\src\Soenneker.Extensions.MethodInfo.csproj" />
</ItemGroup>

</Project>

0 comments on commit afbd09e

Please # to comment.