-
Notifications
You must be signed in to change notification settings - Fork 0
227 lines (220 loc) · 6.84 KB
/
Cogito.Serilog.yml
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
name: Cogito.Serilog
on:
workflow_dispatch:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
release:
types:
- created
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3
with:
versionSpec: 5.x
- name: Execute GitVersion
uses: gittools/actions/gitversion/execute@v3
with:
useConfigFile: true
- name: Add NuGet Source (GitHub)
shell: pwsh
run: dotnet nuget add source --username USERNAME --password $env:GITHUB_TOKEN --store-password-in-clear-text --name alethic $env:GITHUB_REPOS
env:
GITHUB_REPOS: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: NuGet Restore
run: dotnet restore Cogito.Serilog.sln
- name: Build
shell: pwsh
run: |
dotnet msbuild /m /bl `
/p:Configuration="Release" `
/p:Platform="Any CPU" `
/p:Version=${env:GitVersion_FullSemVer} `
/p:AssemblyVersion=${env:GitVersion_AssemblySemVer} `
/p:InformationalVersion=${env:GitVersion_InformationalVersion} `
/p:FileVersion=${env:GitVersion_AssemblySemFileVer} `
/p:PackageVersion=${env:GitVersion_FullSemVer} `
/p:RepositoryUrl="${env:GITHUB_SERVER_URL}/${env:GITHUB_REPOSITORY}.git" `
/p:PackageProjectUrl="${env:GITHUB_SERVER_URL}/${env:GITHUB_REPOSITORY}" `
/p:BuildInParallel=true `
/p:ContinuousIntegrationBuild=true `
Cogito.Serilog.dist.msbuildproj
- name: Upload MSBuild Log
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: msbuild.binlog
path: msbuild.binlog
- name: Upload NuGet Packages
uses: actions/upload-artifact@v4
with:
name: nuget
path: dist/nuget/*.nupkg
- name: Package Tests
run: tar czvf tests.tar.gz tests
working-directory: dist
- name: Upload Tests
uses: actions/upload-artifact@v4
with:
name: tests
path: dist/tests.tar.gz
test:
strategy:
matrix:
run:
- Cogito.Serilog.Tests
sys:
- win-x64
- linux-x64
- osx-x64
- osx-arm64
tfm:
- net481
- net6.0
- net8.0
exclude:
- tfm: net481
sys: linux-x64
- tfm: net481
sys: osx-x64
- tfm: net481
sys: osx-arm64
name: Test (${{ matrix.run }}:${{ matrix.tfm }}:${{ matrix.sys }})
timeout-minutes: 240
needs:
- build
runs-on: ${{ fromJSON('{"win-x64":["windows-2022"],"linux-x64":["ubuntu-22.04"],"osx-x64":["macos-13"],"osx-arm64":["macos-14"]}')[matrix.sys] }}
steps:
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Download Tests
uses: actions/download-artifact@v4
with:
name: tests
- name: Restore Tests
run: tar xzvf tests.tar.gz
- name: Execute Tests
timeout-minutes: 240
shell: pwsh
run: |
# assign powershell variables
$run = "${{ matrix.run }}"
$tfm = "${{ matrix.tfm }}"
$sys = "${{ matrix.sys }}"
# suite name can contain filter expression after ?
$split = $run.IndexOf("?")
if ($split -gt -1) {
$tst = $run.Substring(0, $split)
$qry = $run.Substring($split + 1)
} else {
$tst = $run
}
# scan and process test assemblies
$tests = $(gi .\tests\$tst\$tfm\*.Tests.dll)
if ($tests) {
$argl = @(
"-f", $tfm,
"-v:diag",
"--results-directory", "TestResults",
"--logger:console;verbosity=diag",
"--logger:trx"
)
$runsettings = $(gi .\tests\$tst\$tfm\*.runsettings)
if ($runsettings) {
$argl += "--settings:$runsettings"
}
if ($qry -ne "" -and $qry -ne $null) {
$argl += @("--filter", $qry)
Add-Content $env:GITHUB_ENV "`nRET=TestResults--$tst-$qry--$tfm--$sys"
} else {
Add-Content $env:GITHUB_ENV "`nRET=TestResults--$tst--$tfm--$sys"
}
dotnet test @argl $tests[0].FullName
}
- name: Archive Test Results
if: always() && startsWith(env.RET, 'TestResults--')
run: tar czvf TestResults.tar.gz TestResults
working-directory: ${{ env.WORKPATH }}
- name: Upload Test Results
if: always() && startsWith(env.RET, 'TestResults--')
uses: actions/upload-artifact@v4
with:
name: ${{ env.RET }}
path: TestResults.tar.gz
release:
name: Release
if: github.event_name != 'pull_request'
needs:
- test
runs-on: ubuntu-22.04
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3
with:
versionSpec: 5.x
- name: Execute GitVersion
id: GitVersion
uses: gittools/actions/gitversion/execute@v3
with:
useConfigFile: true
- name: Download NuGet Packages
uses: actions/download-artifact@v4
with:
name: nuget
path: dist/nuget
- name: Create Release
if: github.ref_type == 'tag'
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.GitVersion.outputs.semVer }}
allowUpdates: true
omitBodyDuringUpdate: true
artifacts: dist/nuget/*.nupkg,dist/nuget/*.snupkg,dist/doc.zip
makeLatest: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push NuGet (GitHub)
if: github.event_name != 'pull_request'
shell: pwsh
run: dotnet nuget push dist/nuget/*.nupkg --source $env:GITHUB_REPOS --api-key $env:GITHUB_TOKEN --skip-duplicate
env:
GITHUB_REPOS: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push NuGet
if: github.ref_type == 'tag'
shell: pwsh
run: dotnet nuget push dist/nuget/*.nupkg --source $env:NUGET_REPOS --api-key $env:NUGET_TOKEN --skip-duplicate
env:
NUGET_REPOS: https://api.nuget.org/v3/index.json
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}