66 - ' v*.*.*' # Match version tags like v1.0.0
77
88jobs :
9- build :
9+ publish :
1010 runs-on : ubuntu-latest
1111 steps :
1212 - name : Checkout repository
13- uses : actions/checkout@v4
13+ uses : actions/checkout@v3
1414
1515 - name : Setup .NET
16- uses : actions/setup-dotnet@v4
16+ uses : actions/setup-dotnet@v3
1717 with :
1818 dotnet-version : ' 9.x'
1919
@@ -22,79 +22,39 @@ jobs:
2222
2323 - name : Build
2424 run : dotnet build CodeOfChaos.Extensions.sln --configuration Release --no-restore
25-
26- # Save build outputs as an artifact
27- - name : Upload build artifacts
28- uses : actions/upload-artifact@v4
29- with :
30- name : build-artifacts
31- path : |
32- src/**/bin/Release/
33- tests/**/bin/Release/**/*
34-
35- test-all :
36- needs : build
37- runs-on : ubuntu-latest
38- strategy :
39- matrix :
40- test-project :
41- - Tests.CodeOfChaos.Extensions
42- - Tests.CodeOfChaos.Extensions.Analyzers
43- - Tests.CodeOfChaos.Extensions.AspNetCore
44- - Tests.CodeOfChaos.Extensions.DependencyInjection
45- - Tests.CodeOfChaos.Extensions.DependencyInjection.Generators
46- - Tests.CodeOfChaos.Extensions.EntityFrameworkCore
47- - Tests.CodeOfChaos.Extensions.Serilog
48- steps :
49- - name : Checkout repository
50- uses : actions/checkout@v4
51-
52- - name : Setup .NET
53- uses : actions/setup-dotnet@v4
54- with :
55- dotnet-version : ' 9.x'
56-
57- # Download the build artifacts
58- - name : Download build artifacts
59- uses : actions/download-artifact@v4
60- with :
61- name : build-artifacts
62-
63- # Run tests using the artifacts
64- - name : Run tests for ${{ matrix.test-project }}
65- run : dotnet test -c Release --no-build --no-restore
66- working-directory : tests/${{ matrix.test-project }}
67-
68- publish :
69- needs : test-all
70- runs-on : ubuntu-latest
71- strategy :
72- matrix :
73- package :
74- - CodeOfChaos.Extensions
75- - CodeOfChaos.Extensions.Analyzers
76- - CodeOfChaos.Extensions.AspNetCore
77- - CodeOfChaos.Extensions.DependencyInjection
78- - CodeOfChaos.Extensions.DependencyInjection.Generators
79- - CodeOfChaos.Extensions.EntityFrameworkCore
80- - CodeOfChaos.Extensions.Serilog
81- steps :
82- - name : Checkout repository
83- uses : actions/checkout@v4
84-
85- - name : Setup .NET
86- uses : actions/setup-dotnet@v4
87- with :
88- dotnet-version : ' 9.x'
89-
90- # Download the build artifacts
91- - name : Download build artifacts
92- uses : actions/download-artifact@v4
93- with :
94- name : build-artifacts
95-
96- # Push the corresponding NuGet package
97- - name : Publish ${{ matrix.package }} to NuGet
25+
26+ # Ensure that the tests must pass
27+ # The job will fail automatically if any test fails because `dotnet test` exits with a non-zero code
28+ - name : Run tests - Extensions
29+ run : dotnet run -c Release --no-restore --no-build
30+ working-directory : " tests/Tests.CodeOfChaos.Extensions"
31+ - name : Run tests - Extensions.Analyzers
32+ run : dotnet run -c Release --no-restore --no-build
33+ working-directory : " tests/Tests.CodeOfChaos.Extensions.Analyzers"
34+ - name : Run tests - Extensions.AspNetCore
35+ run : dotnet run -c Release --no-restore --no-build
36+ working-directory : " tests/Tests.CodeOfChaos.Extensions.AspNetCore"
37+ - name : Run tests - Extensions.EntityFrameworkCore
38+ run : dotnet run -c Release --no-restore --no-build
39+ working-directory : " tests/Tests.CodeOfChaos.Extensions.EntityFrameworkCore"
40+ - name : Run tests - Extensions.Serilog
41+ run : dotnet run -c Release --no-restore --no-build
42+ working-directory : " tests/Tests.CodeOfChaos.Extensions.Serilog"
43+ - name : Run tests - Extensions.DependencyInjection
44+ run : dotnet run -c Release --no-restore --no-build
45+ working-directory : " tests/Tests.CodeOfChaos.Extensions.DependencyInjection"
46+ - name : Run tests - Extensions.DependencyInjection.Generators
47+ run : dotnet run -c Release --no-restore --no-build
48+ working-directory : " tests/Tests.CodeOfChaos.Extensions.DependencyInjection.Generators"
49+
50+ - name : Publish to NuGet
9851 env :
9952 NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
100- run : dotnet nuget push src/${{ matrix.package }}/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
53+ run : |
54+ dotnet nuget push src/CodeOfChaos.Extensions/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
55+ dotnet nuget push src/CodeOfChaos.Extensions.AspNetCore/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
56+ dotnet nuget push src/CodeOfChaos.Extensions.EntityFrameworkCore/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
57+ dotnet nuget push src/CodeOfChaos.Extensions.Serilog/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
58+ dotnet nuget push src/CodeOfChaos.Extensions.Analyzers/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
59+ dotnet nuget push src/CodeOfChaos.Extensions.DependencyInjection/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
60+ dotnet nuget push src/CodeOfChaos.Extensions.DependencyInjection.Generators/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
0 commit comments