-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
182 lines (146 loc) · 6.58 KB
/
wf-build-release-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
name: Build, test, pack, push (CI)
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: windows-2019
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@v4
name: Checkout Code
- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
2.0.x
5.0.x
6.0.x
- name: Setup MSBuild Path
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Restore NuGet Packages
run: nuget restore QRCoder.sln
- name: Build library
run: msbuild QRCoder.sln /p:Configuration=Release /p:NoWarn="1182" /p:NoWarn="1701" /nr:false /t:Rebuild
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Compiled project
path: D:\a\qrcoder\qrcoder
test:
needs: build
runs-on: windows-2019
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: Compiled project
path: D:\a\qrcoder\qrcoder
- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
2.0.x
5.0.x
6.0.x
- name: Run test .NET 3.5
run: dotnet test -c Release -f net35 --nologo --no-build # No coverage for NET3.5 because of bug in combination with Coverlet+Stronh naming
- name: Run test .NET 4.52
run: dotnet test -c Release -f net452 --nologo --no-build # No coverage for NET4.5 because of bug in combination with Coverlet+Strong naming
- name: Run test .NET Core 1.1
run: dotnet test -c Release -f netcoreapp1.1 --nologo # No coverage for .NETCORE 1.1 because Coverlet doesn't support it https://github.com/coverlet-coverage/coverlet/issues/466
- name: Run test .NET Core 2.0
run: dotnet test -c Release -f netcoreapp2.0 --nologo /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Run test .NET 5.0
run: dotnet test -c Release -f net5.0 --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Run test .NET 5.0 Windows
run: dotnet test -c Release -f net5.0-windows --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Run test .NET 6.0
run: dotnet test -c Release -f net6.0 --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Run test .NET 6.0 Windows
run: dotnet test -c Release -f net6.0-windows --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Codecov update netcoreapp2.0
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./QRCoderTests/coverage.netcoreapp2.0.opencover.xml
flags: netcoreapp2.0
- name: Codecov update net5.0
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./QRCoderTests/coverage.net5.0.opencover.xml
flags: net5.0
- name: Codecov update net5.0-windows
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./QRCoderTests/coverage.net5.0-windows.opencover.xml
flags: net5.0-windows
- name: Codecov update net6.0
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./QRCoderTests/coverage.net5.0.opencover.xml
flags: net6.0
- name: Codecov update net6.0-windows
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./QRCoderTests/coverage.net5.0-windows.opencover.xml
flags: net6.0-windows
pack-push-ci:
needs: test
runs-on: windows-2019
env:
GH_PKG_SEC: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: Compiled project
path: D:\a\qrcoder\qrcoder
- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
2.0.x
5.0.x
6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Get assembly version QRCoder
run: echo "ASSEM_VER=$([Reflection.Assembly]::Loadfile( $(-join($pwd,"\QRCoder\bin\Release\net40\QRCoder.dll"))).GetName().version.ToString())" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Clean assembly version QRCoder
run: echo "ASSEM_VER_SHT=$($env:ASSEM_VER.substring(0, $env:ASSEM_VER.lastIndexOf(".")))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Calculate ci suffix QRCoder
run: echo "CI_TAG=-ci-$([datetime]::now.tostring("yyyyMMddHHmmss"))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Get assembly version QRCoder.Xaml
run: echo "ASSEM_VER_XAML=$([Reflection.Assembly]::Loadfile( $(-join($pwd,"\QRCoder.Xaml\bin\Release\net40\QRCoder.Xaml.dll"))).GetName().version.ToString())" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Clean assembly version QRCoder.Xaml
run: echo "ASSEM_VER_SHT_XAML=$($env:ASSEM_VER_XAML.substring(0, $env:ASSEM_VER_XAML.lastIndexOf(".")))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Calculate ci suffix QRCoder.Xaml
run: echo "CI_TAG_XAML=-ci-$([datetime]::now.tostring("yyyyMMddHHmmss"))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Build QRCoder NuGet package
run: dotnet pack QRCoder\QRCoder.csproj -c Release --no-build /p:PackageVersion="$env:ASSEM_VER_SHT$env:CI_TAG" /p:PackageReleaseNotes="- This is an automatic CI build ($env:CI_TAG)`n- Please don't use it in productive environments!"
- name: Build QRCoder.Xaml NuGet package
run: dotnet pack QRCoder.Xaml\QRCoder.Xaml.csproj -c Release --no-build /p:PackageVersion="$env:ASSEM_VER_SHT_XAML$env:CI_TAG_XAML" /p:PackageReleaseNotes="- This is an automatic CI build ($env:CI_TAG_XAML)`n- Please don't use it in productive environments!"
- name: Publish QRCoder and QRCoder.Xaml to Github packages
run: dotnet nuget push "**/*.nupkg" --no-symbols --skip-duplicate --api-key $env:GH_PKG_SEC --source https://nuget.pkg.github.com/codebude/index.json
clean:
needs: [build, test, pack-push-ci]
if: always()
runs-on: windows-2019
steps:
- name: Delete artifacts
uses: GeekyEggo/delete-artifact@v5
with:
name: Compiled project