-
Notifications
You must be signed in to change notification settings - Fork 0
214 lines (183 loc) · 6.57 KB
/
ci.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
name: .NET Core
on:
push:
branches: [ main ]
pull_request:
types: [opened, synchronize, reopened, closed]
branches: [ main ]
jobs:
build:
runs-on: windows-2022
outputs:
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
solutionpath: src\Vetuviem.sln
unittestprojectpath: src\Vetuviem.UnitTests\Vetuviem.UnitTests.csproj
steps:
- name: Get Latest Visual Studio Version
shell: bash
run: |
dotnet tool update -g dotnet-vs
vs where release
vs update release Enterprise
vs modify release Enterprise +mobile +desktop +uwp +web
vs where release
- name: Checkout code
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
fetch-depth: 0
#- name: Setup .NET Core 3.1
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: 3.1.x
#- name: Setup .NET 5
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: 5.0.x
- name: Setup .NET 7
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Install DotNet workloads
shell: bash
run: |
dotnet workload install android ios tvos macos maui wasm-tools
dotnet workload list
- name: Install Windows SDK 10.0.16299
shell: pwsh
run: |
Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/p/?linkid=864422 -OutFile winsdk.exe
$startInfo = New-Object System.Diagnostics.ProcessStartInfo
$startInfo.FileName = "winsdk.exe"
$startInfo.Arguments = "/norestart /quiet"
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $startInfo
$process.Start()
$process.WaitForExit()
- name: NBGV
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Install dotnet tools
run: |
dotnet tool install --global dotMorten.OmdGenerator
dotnet tool install --global ConfigValidate
dotnet tool install --global dotnet-outdated-tool
dotnet tool install --global snitch
dotnet tool install --global dotnet-sonarscanner
dotnet tool install --global JetBrains.ReSharper.GlobalTools --version 2021.2.2
- name: Prepare Artifact Directory
run: |
mkdir artifacts
mkdir artifacts\nupkg
mkdir artifacts\outdated
mkdir artifacts\snitch
mkdir artifacts\omd
mkdir artifacts\docfx
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.3.1
- name: Restore Packages
run: |
dotnet restore ${{ env.solutionpath }} /bl:artifacts\\binlog\\restore.binlog
# msbuild used because we run targets not supported by dotnet build
- name: Run Build
run: |
msbuild /t:build /nowarn:MSB4011 /maxcpucount /p:NoPackageAnalysis=true /verbosity:minimal /p:Configuration=Release
working-directory: src
- name: Run Unit Tests
run: |
dotnet test ${{ env.unittestprojectpath }} --configuration Release --no-build /bl:artifacts\\binlog\\unittest.binlog --nologo --logger GitHubActions --blame-hang-timeout 60000 --results-directory artifacts\opencover --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
- name: Upload Code Coverage
shell: bash
run: |
echo $PWD
bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -t ${{ env.CODECOV_TOKEN }} -s '$PWD/artifacts/opencover' -f '*.xml'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Produce Nuget Packages
run: msbuild /t:pack /nowarn:MSB4011 /maxcpucount /p:NoPackageAnalysis=true /verbosity:minimal /p:Configuration=Release /p:PackageOutputPath=..\..\artifacts\nuget /p:ContinuousIntegrationBuild=true
working-directory: src
- name: List outdated packages
run: |
dotnet outdated -o artifacts\outdated\outdated.json src
- name: Run Resharper Duplicate Code Finder
run: |
jb dupfinder ${{ env.solutionpath }} -o=artifacts\dupfinder\report.xml
# only store binlog on failure
- name: store binlogs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: binlogs
path: artifacts/binlog
- name: store docfx
uses: actions/upload-artifact@v3
with:
name: docfx
path: artifacts/docfx
- name: store nuget packages
uses: actions/upload-artifact@v3
with:
name: nuget
path: artifacts/nuget/vetuviem.*.nupkg
- name: store omd
uses: actions/upload-artifact@v3
with:
name: omd
path: artifacts/omd
- name: store outdated
uses: actions/upload-artifact@v3
with:
name: outdated
path: artifacts/outdated
- name: store snitch
uses: actions/upload-artifact@v3
with:
name: snitch
path: artifacts/snitch
- name: store resharper dupfinder
uses: actions/upload-artifact@v3
with:
name: dupfinder
path: artifacts/dupfinder
release:
runs-on: ubuntu-latest
needs: build
if: contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
fetch-depth: 0
- name: Download NuGet Packages
uses: actions/download-artifact@v3
with:
name: nuget
- name: Changelog
uses: glennawatson/ChangeLog@v1
id: changelog
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.build.outputs.nbgv }}
release_name: ${{ needs.build.outputs.nbgv }}
body: |
${{ steps.changelog.outputs.commitLog }}
- name: NuGet Push
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
SOURCE_URL: https://api.nuget.org/v3/index.json
run: |
dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg