1818 - name : Setup .NET
1919 uses : actions/setup-dotnet@v5
2020
21+ - name : Cache NuGet packages
22+ uses : actions/cache@v4
23+ with :
24+ path : ~/.nuget/packages
25+ key : ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
26+ restore-keys : |
27+ ${{ runner.os }}-nuget-
28+
2129 - run : dotnet restore --verbosity minimal
2230
2331 - run : dotnet build --configuration Debug /p:ContinuousIntegrationBuild=true
3543 build_and_test_release :
3644 name : Build and test (RELEASE)
3745 runs-on : ubuntu-latest
46+ strategy :
47+ matrix :
48+ framework : [net8.0, net10.0]
3849
3950 steps :
4051 - name : Checkout repository
@@ -48,20 +59,27 @@ jobs:
4859 - name : Setup .NET
4960 uses : actions/setup-dotnet@v5
5061
62+ - name : Cache NuGet packages
63+ uses : actions/cache@v4
64+ with :
65+ path : ~/.nuget/packages
66+ key : ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
67+ restore-keys : |
68+ ${{ runner.os }}-nuget-
69+
5170 - run : dotnet restore --verbosity minimal
5271
5372 - run : dotnet build --configuration Release -p:ContinuousIntegrationBuild=true -p:DebugType=Embedded -p:VersionPrefix=$VERSION_PREFIX --version-suffix $VERSION_SUFFIX
5473
55- - name : Run tests (net8.0)
56- run : dotnet run --project ./code/WorldDomination.SimpleObservability.Tests/WorldDomination.SimpleObservability.Tests.csproj --configuration Release --no-build --framework net8.0
57-
58- - name : Run tests (net10.0)
59- run : dotnet run --project ./code/WorldDomination.SimpleObservability.Tests/WorldDomination.SimpleObservability.Tests.csproj --configuration Release --no-build --framework net10.0
74+ - name : Run tests (${{ matrix.framework }})
75+ run : dotnet run --project ./code/WorldDomination.SimpleObservability.Tests/WorldDomination.SimpleObservability.Tests.csproj --configuration Release --no-build --framework ${{ matrix.framework }}
6076
6177 - run : dotnet pack --configuration Release --no-build --output ./artifacts -p:DebugType=Embedded -p:VersionPrefix=$VERSION_PREFIX --version-suffix $VERSION_SUFFIX
78+ if : matrix.framework == 'net8.0'
6279
6380 - name : Publish artifacts
6481 uses : actions/upload-artifact@v5
82+ if : matrix.framework == 'net8.0'
6583 with :
6684 name : NuGetPackage.${{ env.VERSION_PREFIX }}-${{ env.VERSION_SUFFIX }}
6785 path : ./artifacts/
0 commit comments