1- name : CI
2-
3- on :
4- push :
5- branches : [ main ]
6- pull_request :
7- branches : [ main ]
8-
9- jobs :
10- build-and-test :
11- name : Build and Test
12- runs-on : ubuntu-latest
13-
14- steps :
15- - name : Checkout code
16- uses : actions/checkout@v4
17-
18- - name : Setup .NET
19- uses : actions/setup-dotnet@v4
20- with :
21- dotnet-version : ' 9.0.x'
22-
23- - name : Restore dependencies
24- run : dotnet restore
25-
26- - name : Build solution
27- run : dotnet build --no-restore --configuration Release --verbosity normal
28-
29- - name : Run tests
30- run : dotnet test --no-build --configuration Release --verbosity normal --collect:"XPlat Code Coverage" --results-directory TestResults/
31-
32- - name : Upload coverage reports to Codecov
33- uses : codecov/codecov-action@v4
34- with :
35- directory : TestResults/
36- fail_ci_if_error : false
37- verbose : true
38- env :
39- CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
40-
41- lint-and-format :
42- name : Lint and Format Check
43- runs-on : ubuntu-latest
44-
45- steps :
46- - name : Checkout code
47- uses : actions/checkout@v4
48-
49- - name : Setup .NET
50- uses : actions/setup-dotnet@v4
51- with :
52- dotnet-version : ' 9.0.x'
53-
54- - name : Restore dependencies
55- run : dotnet restore
56-
57- - name : Check format
58- run : dotnet format --verify-no-changes --verbosity diagnostic
59-
60- - name : Run analyzers
61- run : dotnet build --no-restore --configuration Release --verbosity normal
62-
63- security-scan :
64- name : Security Scan
65- runs-on : ubuntu-latest
66-
67- steps :
68- - name : Checkout code
69- uses : actions/checkout@v4
70-
71- - name : Setup .NET
72- uses : actions/setup-dotnet@v4
73- with :
74- dotnet-version : ' 9.0.x'
75-
76- - name : Restore dependencies
77- run : dotnet restore
78-
79- - name : Run vulnerability scan
80- run : dotnet list package --vulnerable --include-transitive || true
81-
82- benchmark :
83- name : Benchmarks
84- runs-on : ubuntu-latest
85- if : github.event_name == 'pull_request'
86-
87- steps :
88- - name : Checkout code
89- uses : actions/checkout@v4
90-
91- - name : Setup .NET
92- uses : actions/setup-dotnet@v4
93- with :
94- dotnet-version : ' 9.0.x'
95-
96- - name : Restore dependencies
97- run : dotnet restore
98-
99- - name : Build solution
100- run : dotnet build --no-restore --configuration Release --verbosity normal
101-
102- - name : Run benchmarks
103- run : |
104- cd benchmarks/StreamDingo.Benchmarks
105- timeout 180 dotnet run --configuration Release -- --job VeryShortRun --exporters json --memory || {
106- echo "Benchmark run completed or timed out"
107- exit 0
108- }
109-
110- - name : Upload benchmark results
111- uses : actions/upload-artifact@v4
112- with :
113- name : benchmark-results
114- path : benchmarks/StreamDingo.Benchmarks/BenchmarkDotNet.Artifacts/
115- retention-days : 7
116-
117- package :
118- name : Package
119- runs-on : ubuntu-latest
120- needs : [build-and-test, lint-and-format, security-scan]
121- if : github.ref == 'refs/heads/main'
122-
123- steps :
124- - name : Checkout code
125- uses : actions/checkout@v4
126-
127- - name : Setup .NET
128- uses : actions/setup-dotnet@v4
129- with :
130- dotnet-version : ' 9.0.x'
131-
132- - name : Restore dependencies
133- run : dotnet restore
134-
135- - name : Build and package
136- run : dotnet pack --no-restore --configuration Release --output ./artifacts
137-
138- - name : Upload package artifacts
139- uses : actions/upload-artifact@v4
140- with :
141- name : nuget-packages
142- path : ./artifacts/*.nupkg
1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ build-and-test :
11+ name : Build and Test
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+
18+ - name : Setup .NET
19+ uses : actions/setup-dotnet@v5
20+ with :
21+ dotnet-version : ' 9.0.x'
22+
23+ - name : Restore dependencies
24+ run : dotnet restore
25+
26+ - name : Build solution
27+ run : dotnet build --no-restore --configuration Release --verbosity normal
28+
29+ - name : Run tests
30+ run : dotnet test --no-build --configuration Release --verbosity normal --collect:"XPlat Code Coverage" --results-directory TestResults/
31+
32+ - name : Upload coverage reports to Codecov
33+ uses : codecov/codecov-action@v4
34+ with :
35+ directory : TestResults/
36+ fail_ci_if_error : false
37+ verbose : true
38+ env :
39+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
40+
41+ lint-and-format :
42+ name : Lint and Format Check
43+ runs-on : ubuntu-latest
44+
45+ steps :
46+ - name : Checkout code
47+ uses : actions/checkout@v4
48+
49+ - name : Setup .NET
50+ uses : actions/setup-dotnet@v5
51+ with :
52+ dotnet-version : ' 9.0.x'
53+
54+ - name : Restore dependencies
55+ run : dotnet restore
56+
57+ - name : Check format
58+ run : dotnet format --verify-no-changes --verbosity diagnostic
59+
60+ - name : Run analyzers
61+ run : dotnet build --no-restore --configuration Release --verbosity normal
62+
63+ security-scan :
64+ name : Security Scan
65+ runs-on : ubuntu-latest
66+
67+ steps :
68+ - name : Checkout code
69+ uses : actions/checkout@v4
70+
71+ - name : Setup .NET
72+ uses : actions/setup-dotnet@v5
73+ with :
74+ dotnet-version : ' 9.0.x'
75+
76+ - name : Restore dependencies
77+ run : dotnet restore
78+
79+ - name : Run vulnerability scan
80+ run : dotnet list package --vulnerable --include-transitive || true
81+
82+ benchmark :
83+ name : Benchmarks
84+ runs-on : ubuntu-latest
85+ if : github.event_name == 'pull_request'
86+
87+ steps :
88+ - name : Checkout code
89+ uses : actions/checkout@v4
90+
91+ - name : Setup .NET
92+ uses : actions/setup-dotnet@v5
93+ with :
94+ dotnet-version : ' 9.0.x'
95+
96+ - name : Restore dependencies
97+ run : dotnet restore
98+
99+ - name : Build solution
100+ run : dotnet build --no-restore --configuration Release --verbosity normal
101+
102+ - name : Run benchmarks
103+ run : |
104+ cd benchmarks/StreamDingo.Benchmarks
105+ timeout 180 dotnet run --configuration Release -- --job VeryShortRun --exporters json --memory || {
106+ echo "Benchmark run completed or timed out"
107+ exit 0
108+ }
109+
110+ - name : Upload benchmark results
111+ uses : actions/upload-artifact@v4
112+ with :
113+ name : benchmark-results
114+ path : benchmarks/StreamDingo.Benchmarks/BenchmarkDotNet.Artifacts/
115+ retention-days : 7
116+
117+ package :
118+ name : Package
119+ runs-on : ubuntu-latest
120+ needs : [build-and-test, lint-and-format, security-scan]
121+ if : github.ref == 'refs/heads/main'
122+
123+ steps :
124+ - name : Checkout code
125+ uses : actions/checkout@v4
126+
127+ - name : Setup .NET
128+ uses : actions/setup-dotnet@v5
129+ with :
130+ dotnet-version : ' 9.0.x'
131+
132+ - name : Restore dependencies
133+ run : dotnet restore
134+
135+ - name : Build and package
136+ run : dotnet pack --no-restore --configuration Release --output ./artifacts
137+
138+ - name : Upload package artifacts
139+ uses : actions/upload-artifact@v4
140+ with :
141+ name : nuget-packages
142+ path : ./artifacts/*.nupkg
143143 retention-days : 7
0 commit comments