-
-
Notifications
You must be signed in to change notification settings - Fork 0
344 lines (279 loc) · 11.7 KB
/
dotnet.yml
File metadata and controls
344 lines (279 loc) · 11.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
name: .NET Build
on:
push:
branches:
- main
workflow_dispatch:
env:
DOTNET_VERSION: "8.0.x"
PROJECT_FILE: "source/FluentDataBuilder.sln"
VERSION: 8.0.${{ github.run_number }}
USERNAME: lk-code
NUGET_FILE: "**/*.nupkg"
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.1
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install SonarQube Cloud scanner
run: |
dotnet tool install --global dotnet-sonarscanner
- name: Install ReportGenerator
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool
- name: Install .NET Coverage
run: |
dotnet tool install --global dotnet-coverage
- name: Restore dependencies
run: dotnet restore ${{ env.PROJECT_FILE }}
- name: Begin SonarQube
shell: pwsh
env:
SONARTOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet-sonarscanner begin `
/k:"lk-code_fluent-data-builder" `
/o:"lk-code-github" `
/d:sonar.token="$env:SONARTOKEN" `
/d:sonar.host.url="https://sonarcloud.io" `
/d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml `
- name: .NET Build
shell: pwsh
run: |
dotnet build --no-restore ${{ env.PROJECT_FILE }}
- name: Collect Test Coverage
shell: pwsh
run: |
dotnet-coverage collect "dotnet test ${{ env.PROJECT_FILE }} --no-build" -f xml -o "coverage.xml"
- name: Initialize GitHub NuGet Provider
shell: pwsh
run: |
dotnet nuget add source --username ${{ env.USERNAME }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/lk-code/index.json"
- name: Build FluentDataBuilder
shell: pwsh
run: |
dotnet build -c Release source/FluentDataBuilder/FluentDataBuilder.csproj
- name: Pack FluentDataBuilder
shell: pwsh
run: |
dotnet pack -c Release source/FluentDataBuilder/FluentDataBuilder.csproj /p:PackageVersion=${{ env.VERSION }}
- name: Temporary NuGet FluentDataBuilder
shell: pwsh
run: |
dotnet nuget push source/FluentDataBuilder/nupkg/FluentDataBuilder.${{ env.VERSION }}.nupkg --source https://nuget.pkg.github.com/lk-code/index.json --api-key ${{ secrets.GITHUB_TOKEN }}
- name: Wait for FluentDataBuilder Published
shell: pwsh
run: |
$i = 0
$max = 10
$sleep = 5
$url = "https://nuget.pkg.github.com/lk-code/fluentdatabuilder/${{ env.VERSION }}.json"
$headers = @{
"Authorization" = "Bearer ${{ secrets.GITHUB_TOKEN }}"
}
do {
$i++
Write-Host "Waiting for NuGet to publish $url"
Start-Sleep -Seconds $sleep
} while ((Invoke-WebRequest -Uri $url -UseBasicParsing -Headers $headers).StatusCode -ne 200 -and $i -lt $max)
if ($i -eq $max) {
throw "NuGet not published after $max tries"
}
- name: Add NuGets FluentDataBuilder.Json
shell: pwsh
run: |
dotnet add source/FluentDataBuilder.Json/FluentDataBuilder.Json.csproj package FluentDataBuilder --version ${{ env.VERSION }}
- name: Build FluentDataBuilder.Json
shell: pwsh
run: |
dotnet build -c Release source/FluentDataBuilder.Json/FluentDataBuilder.Json.csproj
- name: Pack FluentDataBuilder.Json
shell: pwsh
run: |
dotnet pack -c Release source/FluentDataBuilder.Json/FluentDataBuilder.Json.csproj /p:PackageVersion=${{ env.VERSION }}
- name: Temporary NuGet FluentDataBuilder.Json
shell: pwsh
run: |
dotnet nuget push source/FluentDataBuilder.Json/nupkg/FluentDataBuilder.Json.${{ env.VERSION }}.nupkg --source https://nuget.pkg.github.com/lk-code/index.json --api-key ${{ secrets.GITHUB_TOKEN }}
- name: Wait for FluentDataBuilder.Json Published
shell: pwsh
run: |
$i = 0
$max = 10
$sleep = 5
$url = "https://nuget.pkg.github.com/lk-code/fluentdatabuilder.json/${{ env.VERSION }}.json"
$headers = @{
"Authorization" = "Bearer ${{ secrets.GITHUB_TOKEN }}"
}
do {
$i++
Write-Host "Waiting for NuGet to publish $url"
Start-Sleep -Seconds $sleep
} while ((Invoke-WebRequest -Uri $url -UseBasicParsing -Headers $headers).StatusCode -ne 200 -and $i -lt $max)
if ($i -eq $max) {
throw "NuGet not published after $max tries"
}
- name: Add NuGets FluentDataBuilder.NewtonsoftJson
shell: pwsh
run: |
dotnet add source/FluentDataBuilder.NewtonsoftJson/FluentDataBuilder.NewtonsoftJson.csproj package FluentDataBuilder --version ${{ env.VERSION }}
- name: Build FluentDataBuilder.NewtonsoftJson
shell: pwsh
run: |
dotnet build -c Release source/FluentDataBuilder.NewtonsoftJson/FluentDataBuilder.NewtonsoftJson.csproj
- name: Pack FluentDataBuilder.NewtonsoftJson
shell: pwsh
run: |
dotnet pack -c Release source/FluentDataBuilder.NewtonsoftJson/FluentDataBuilder.NewtonsoftJson.csproj /p:PackageVersion=${{ env.VERSION }}
- name: Temporary NuGet FluentDataBuilder.NewtonsoftJson
shell: pwsh
run: |
dotnet nuget push source/FluentDataBuilder.NewtonsoftJson/nupkg/FluentDataBuilder.NewtonsoftJson.${{ env.VERSION }}.nupkg --source https://nuget.pkg.github.com/lk-code/index.json --api-key ${{ secrets.GITHUB_TOKEN }}
- name: Wait for FluentDataBuilder.NewtonsoftJson Published
shell: pwsh
run: |
$i = 0
$max = 10
$sleep = 5
$url = "https://nuget.pkg.github.com/lk-code/fluentdatabuilder.newtonsoftjson/${{ env.VERSION }}.json"
$headers = @{
"Authorization" = "Bearer ${{ secrets.GITHUB_TOKEN }}"
}
do {
$i++
Write-Host "Waiting for NuGet to publish $url"
Start-Sleep -Seconds $sleep
} while ((Invoke-WebRequest -Uri $url -UseBasicParsing -Headers $headers).StatusCode -ne 200 -and $i -lt $max)
if ($i -eq $max) {
throw "NuGet not published after $max tries"
}
- name: Add NuGets FluentDataBuilder.Xml
shell: pwsh
run: |
dotnet add source/FluentDataBuilder.Xml/FluentDataBuilder.Xml.csproj package FluentDataBuilder --version ${{ env.VERSION }}
- name: Build FluentDataBuilder.Xml
shell: pwsh
run: |
dotnet build -c Release source/FluentDataBuilder.Xml/FluentDataBuilder.Xml.csproj
- name: Pack FluentDataBuilder.Xml
shell: pwsh
run: |
dotnet pack -c Release source/FluentDataBuilder.Xml/FluentDataBuilder.Xml.csproj /p:PackageVersion=${{ env.VERSION }}
- name: Temporary NuGet FluentDataBuilder.Xml
shell: pwsh
run: |
dotnet nuget push source/FluentDataBuilder.Xml/nupkg/FluentDataBuilder.Xml.${{ env.VERSION }}.nupkg --source https://nuget.pkg.github.com/lk-code/index.json --api-key ${{ secrets.GITHUB_TOKEN }}
- name: Wait for FluentDataBuilder.Xml Published
shell: pwsh
run: |
$i = 0
$max = 10
$sleep = 5
$url = "https://nuget.pkg.github.com/lk-code/fluentdatabuilder.xml/${{ env.VERSION }}.json"
$headers = @{
"Authorization" = "Bearer ${{ secrets.GITHUB_TOKEN }}"
}
do {
$i++
Write-Host "Waiting for NuGet to publish $url"
Start-Sleep -Seconds $sleep
} while ((Invoke-WebRequest -Uri $url -UseBasicParsing -Headers $headers).StatusCode -ne 200 -and $i -lt $max)
if ($i -eq $max) {
throw "NuGet not published after $max tries"
}
- name: Add NuGets FluentDataBuilder.Yaml
shell: pwsh
run: |
dotnet add source/FluentDataBuilder.Yaml/FluentDataBuilder.Yaml.csproj package FluentDataBuilder --version ${{ env.VERSION }}
- name: Build FluentDataBuilder.Yaml
shell: pwsh
run: |
dotnet build -c Release source/FluentDataBuilder.Yaml/FluentDataBuilder.Yaml.csproj
- name: Pack FluentDataBuilder.Yaml
shell: pwsh
run: |
dotnet pack -c Release source/FluentDataBuilder.Yaml/FluentDataBuilder.Yaml.csproj /p:PackageVersion=${{ env.VERSION }}
- name: Temporary NuGet FluentDataBuilder.Yaml
shell: pwsh
run: |
dotnet nuget push source/FluentDataBuilder.Yaml/nupkg/FluentDataBuilder.Yaml.${{ env.VERSION }}.nupkg --source https://nuget.pkg.github.com/lk-code/index.json --api-key ${{ secrets.GITHUB_TOKEN }}
- name: Wait for FluentDataBuilder.Yaml Published
shell: pwsh
run: |
$i = 0
$max = 10
$sleep = 5
$url = "https://nuget.pkg.github.com/lk-code/fluentdatabuilder.yaml/${{ env.VERSION }}.json"
$headers = @{
"Authorization" = "Bearer ${{ secrets.GITHUB_TOKEN }}"
}
do {
$i++
Write-Host "Waiting for NuGet to publish $url"
Start-Sleep -Seconds $sleep
} while ((Invoke-WebRequest -Uri $url -UseBasicParsing -Headers $headers).StatusCode -ne 200 -and $i -lt $max)
if ($i -eq $max) {
throw "NuGet not published after $max tries"
}
- name: Add NuGets FluentDataBuilder.Microsoft.Extensions.Configuration
shell: pwsh
run: |
dotnet add source/FluentDataBuilder.Microsoft.Extensions.Configuration/FluentDataBuilder.Microsoft.Extensions.Configuration.csproj package FluentDataBuilder --version ${{ env.VERSION }}
dotnet add source/FluentDataBuilder.Microsoft.Extensions.Configuration/FluentDataBuilder.Microsoft.Extensions.Configuration.csproj package FluentDataBuilder.Json --version ${{ env.VERSION }}
- name: Build FluentDataBuilder.Microsoft.Extensions.Configuration
shell: pwsh
run: |
dotnet build -c Release source/FluentDataBuilder.Microsoft.Extensions.Configuration/FluentDataBuilder.Microsoft.Extensions.Configuration.csproj
- name: Pack FluentDataBuilder.Microsoft.Extensions.Configuration
shell: pwsh
run: |
dotnet pack -c Release source/FluentDataBuilder.Microsoft.Extensions.Configuration/FluentDataBuilder.Microsoft.Extensions.Configuration.csproj /p:PackageVersion=${{ env.VERSION }}
- name: Temporary NuGet FluentDataBuilder.Microsoft.Extensions.Configuration
shell: pwsh
run: |
dotnet nuget push source/FluentDataBuilder.Microsoft.Extensions.Configuration/nupkg/FluentDataBuilder.Microsoft.Extensions.Configuration.${{ env.VERSION }}.nupkg --source https://nuget.pkg.github.com/lk-code/index.json --api-key ${{ secrets.GITHUB_TOKEN }}
- name: Wait for FluentDataBuilder.Microsoft.Extensions.Configuration Published
shell: pwsh
run: |
$i = 0
$max = 10
$sleep = 5
$url = "https://nuget.pkg.github.com/lk-code/fluentdatabuilder.microsoft.extensions.configuration/${{ env.VERSION }}.json"
$headers = @{
"Authorization" = "Bearer ${{ secrets.GITHUB_TOKEN }}"
}
do {
$i++
Write-Host "Waiting for NuGet to publish $url"
Start-Sleep -Seconds $sleep
} while ((Invoke-WebRequest -Uri $url -UseBasicParsing -Headers $headers).StatusCode -ne 200 -and $i -lt $max)
if ($i -eq $max) {
throw "NuGet not published after $max tries"
}
- name: End SonarQube
shell: pwsh
env:
SONARTOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet-sonarscanner end /d:sonar.token="$env:SONARTOKEN"
- name: Set Version Git Tag
run: |
git tag ${{ env.VERSION }}
git push origin ${{ env.VERSION }}
- name: Upload Build Artifact
uses: actions/upload-artifact@v4.6.0
with:
name: ${{ env.VERSION }}
path: "**/*.${{ env.VERSION }}.nupkg"
- name: Publish
run: dotnet nuget push "**/*.${{ env.VERSION }}.nupkg" --no-symbols --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source "nuget.org"