-
-
Notifications
You must be signed in to change notification settings - Fork 283
248 lines (192 loc) · 9.91 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
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
name: CI-CD
on: [push, pull_request]
env:
solution: 'src\ReportGenerator.sln'
buildPlatform: Any CPU
buildConfiguration: Release
version: 5.1.26
dotnetSDKVersion: 7.0.401
nodeVersion: 18
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: 'Install npm'
uses: actions/setup-node@v3
with:
node-version: '${{ env.nodeVersion }}'
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1
- name: 'Install dependendies'
run: msbuild .\build.proj /t:Restore
working-directory: src
- name: 'Setup .NET Core'
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.dotnetSDKVersion }}
- name: 'Show dotnet info'
run: dotnet --info
- name: 'Show dotnet version'
run: dotnet --version
- name: 'Use NuGet 6.x'
uses: nuget/setup-nuget@v1
- name: 'NuGet Restore'
run: nuget restore ${{ env.solution }}
- name: 'Compile Solution'
run: msbuild '${{ env.solution }}' /p:configuration='${{ env.buildConfiguration }}' /p:platform='${{ env.buildPlatform }}'
- name: dotnet publish Console.NetCore 3.1
run: dotnet publish -c ${{ env.BuildConfiguration }} -f netcoreapp3.1 ReportGenerator.Console.NetCore.csproj
working-directory: src/ReportGenerator.Console.NetCore
- name: dotnet publish Console.NetCore 5.0
run: dotnet publish -c ${{ env.BuildConfiguration }} -f net5.0 ReportGenerator.Console.NetCore.csproj
working-directory: src/ReportGenerator.Console.NetCore
- name: dotnet publish Console.NetCore 6.0
run: dotnet publish -c ${{ env.BuildConfiguration }} -f net6.0 ReportGenerator.Console.NetCore.csproj
working-directory: src/ReportGenerator.Console.NetCore
- name: dotnet publish Console.NetCore 7.0
run: dotnet publish -c ${{ env.BuildConfiguration }} -f net7.0 ReportGenerator.Console.NetCore.csproj
working-directory: src/ReportGenerator.Console.NetCore
- name: dotnet publish DotnetGlobalTool 3.1
run: dotnet publish -c ${{ env.BuildConfiguration }} -f netcoreapp3.1 ReportGenerator.DotnetGlobalTool.csproj
working-directory: src/ReportGenerator.DotnetGlobalTool
- name: dotnet publish DotnetGlobalTool 5.0
run: dotnet publish -c ${{ env.BuildConfiguration }} -f net5.0 ReportGenerator.DotnetGlobalTool.csproj
working-directory: src/ReportGenerator.DotnetGlobalTool
- name: dotnet publish DotnetGlobalTool 6.0
run: dotnet publish -c ${{ env.BuildConfiguration }} -f net6.0 ReportGenerator.DotnetGlobalTool.csproj
working-directory: src/ReportGenerator.DotnetGlobalTool
- name: dotnet publish DotnetGlobalTool 7.0
run: dotnet publish -c ${{ env.BuildConfiguration }} -f net7.0 ReportGenerator.DotnetGlobalTool.csproj
working-directory: src/ReportGenerator.DotnetGlobalTool
- name: Test
run: dotnet test src\ReportGenerator.Core.Test\ReportGenerator.Core.Test.csproj --configuration ${{ env.BuildConfiguration }} --no-build /p:CollectCoverage=true /p:DeterministicSourcePaths=true /p:IncludeTestAssembly=true /p:CoverletOutputFormat=opencover%2ccobertura /p:CoverletOutput=../target/reports/coverage/
- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@5
with:
reports: 'src\target\reports\coverage\coverage.opencover.xml'
targetdir: 'src\target\reports\coverage'
reporttypes: 'HtmlInline_AzurePipelines;Cobertura;Badges;MarkdownSummaryGithub'
assemblyfilters: '-xunit*'
license: '${{ secrets.REPORTGENERATOR_LICENSE }}'
- name: 'Publish coverage summary'
run: cat src/target/reports/coverage/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
shell: bash
- name: 'Publish code coverage results'
uses: actions/upload-artifact@v3
with:
name: CoverageReport
path: src/target/reports/coverage
- name: 'Prepare VSIX release: NetCore'
run: |
mkdir src/AzureDevopsTask/ReportGenerator/tools/netcoreapp3.1
xcopy 'src\ReportGenerator.Console.NetCore\bin\Release\netcoreapp3.1\publish' 'src\AzureDevopsTask\ReportGenerator\tools\netcoreapp3.1' /s
- name: 'Prepare VSIX release: Install TFS Cross Platform Command Line Interface (tfx-cli)'
run: npm install -g tfx-cli
- name: 'Prepare VSIX release: npm install'
run: npm install
working-directory: src/AzureDevopsTask/ReportGenerator
- name: 'Prepare VSIX release: Compile TypeScript'
run: npm run tsc --
working-directory: src/AzureDevopsTask/ReportGenerator
- name: Create VSIX release
run: tfx extension create --manifest-globs vss-extension.json --output-path ../target/packages
working-directory: src/AzureDevopsTask
- name: 'Prepare ZIP release: mkdir'
run: |
mkdir tmpzip
mkdir tmpzip\net47
mkdir tmpzip\netcoreapp3.1
mkdir tmpzip\net5.0
mkdir tmpzip\net6.0
mkdir tmpzip\net7.0
- name: 'Prepare ZIP release'
run: |
xcopy "src\ReportGenerator.Console\bin\Release\Readme.txt" "tmpzip\"
xcopy "src\ReportGenerator.Console\bin\Release\LICENSE.txt" "tmpzip\"
xcopy "src\ReportGenerator.Console\bin\Release\appsettings.json" "tmpzip\net47\"
xcopy "src\ReportGenerator.Console\bin\Release\*.dll" "tmpzip\net47"
xcopy "src\ReportGenerator.Console\bin\Release\ReportGenerator.exe" "tmpzip\net47"
xcopy "src\ReportGenerator.Console\bin\Release\ReportGenerator.exe.config" "tmpzip\net47"
xcopy 'src\ReportGenerator.Console.NetCore\bin\Release\netcoreapp3.1\publish\*' 'tmpzip\netcoreapp3.1' /s
xcopy 'src\ReportGenerator.Console.NetCore\bin\Release\net5.0\publish\*' 'tmpzip\net5.0' /s
xcopy 'src\ReportGenerator.Console.NetCore\bin\Release\net6.0\publish\*' 'tmpzip\net6.0' /s
xcopy 'src\ReportGenerator.Console.NetCore\bin\Release\net7.0\publish\*' 'tmpzip\net7.0' /s
- name: 'Pack ZIP release'
run: Compress-Archive -Path tmpzip/* -DestinationPath src/target/packages/ReportGenerator_${{ env.Version }}.zip
- name: 'NuGet pack dotnet-reportgenerator-globaltool'
run: nuget pack src/Deployment/nuget/dotnet-reportgenerator-globaltool.nuspec -OutputDirectory src/target/packages -Version ${{ env.Version }}
- name: 'NuGet pack ReportGenerator.Core'
run: nuget pack src/Deployment/nuget/ReportGenerator.Core.nuspec -OutputDirectory src/target/packages -Version ${{ env.Version }}
- name: 'NuGet pack ReportGenerator'
run: nuget pack src/Deployment/nuget/ReportGenerator.nuspec -OutputDirectory src/target/packages -Version ${{ env.Version }}
- name: 'Chocolatey pack reportgenerator.portable'
run: .$env:USERPROFILE\.nuget\packages\chocolatey\1.4.0\tools\chocolateyInstall\choco.exe pack src/Deployment/chocolatey/reportgenerator.portable.nuspec --outputdirectory=src/target/packages --version=${{ env.Version }}
- name: 'Publish Artifact: packages'
uses: actions/upload-artifact@v3
with:
path: src/target/packages
name: packages
publish:
needs: build
runs-on: windows-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && startsWith(github.event.commits[0].message, 'Release ') }}
steps:
- uses: actions/checkout@v3
- name: 'Install npm'
uses: actions/setup-node@v3
with:
node-version: '${{ env.nodeVersion }}'
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1
- name: 'Install dependendies'
run: msbuild .\build.proj /t:Restore
working-directory: src
- name: 'Use NuGet 6.x'
uses: nuget/setup-nuget@v1
- uses: actions/download-artifact@v3
with:
name: packages
- name: GitHubRelease
uses: softprops/action-gh-release@v1
with:
name: ReportGenerator_${{ env.Version }}
body: This release requires .NET 4.7 or .NET Core 3.1/5.x/6.x/7.x.
tag_name: v${{ env.Version }}
files: ReportGenerator_${{ env.Version }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: 'Prepare FTP Upload'
run: |
mkdir ftp
copy "ReportGenerator_${{ env.Version }}.zip" "ftp\ReportGenerator_${{ env.Version }}.zip"
# - name: 'FTP Upload: ZIP Release'
# uses: SamKirkland/[email protected]
# with:
# server: ${{ secrets.FTP_HOST }}
# username: ${{ secrets.FTP_USER }}
# password: ${{ secrets.FTP_PASSWORD }}
# local-dir: ftp/
# server-dir: ${{ secrets.FTP_DIRECTORY }}
# protocol: ftps
# dangerous-clean-slate: true
# continue-on-error: true
- name: 'NuGet push dotnet-reportgenerator-globaltool'
run: nuget push dotnet-reportgenerator-globaltool.${{ env.Version }}.nupkg -ApiKey ${{ secrets.NUGETAPIKEY }} -Source https://www.nuget.org/api/v2/package
continue-on-error: true
- name: 'NuGet push ReportGenerator.Core'
run: nuget push ReportGenerator.Core.${{ env.Version }}.nupkg -ApiKey ${{ secrets.NUGETAPIKEY }} -Source https://www.nuget.org/api/v2/package
continue-on-error: true
- name: 'NuGet push ReportGenerator'
run: nuget push ReportGenerator.${{ env.Version }}.nupkg -ApiKey ${{ secrets.NUGETAPIKEY }} -Source https://www.nuget.org/api/v2/package
continue-on-error: true
- name: 'Chocolatey push reportgenerator.portable'
run: .$env:USERPROFILE\.nuget\packages\chocolatey\1.4.0\tools\chocolateyInstall\choco.exe push reportgenerator.portable.${{ env.Version }}.nupkg --apikey ${{ secrets.CHOCOLATEYAPIKEY }} --source https://push.chocolatey.org/
continue-on-error: true
- name: 'Prepare VSIX release: Install TFS Cross Platform Command Line Interface (tfx-cli)'
run: npm install -g tfx-cli
continue-on-error: true
- name: Publish VSIX release
run: tfx extension publish --vsix Palmmedia.reportgenerator-${{ env.Version }}.vsix -t ${{ secrets.VISUALSTUDIOMARKETPLACETOKEN }}
continue-on-error: true