Skip to content

Commit 13173f1

Browse files
authored
Remove AppVeyor, fix Code coverage in DevOps (#47)
1 parent fd67319 commit 13173f1

File tree

6 files changed

+46
-171
lines changed

6 files changed

+46
-171
lines changed

.azuredevops/Pipelines/build.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ stages:
3838
value: Release
3939
- name: ci_feed
4040
value: 39ce9363-a308-4580-8610-ee11f4953539/01001223-8651-4b73-a7ca-ba27c3e10a3c
41+
- name: COVERLET_EXCLUDE_ATTRIBUTE
42+
value: 'DebuggerNonUserCodeAttribute%2cExcludeFromCodeCoverageAttribute%2cGeneratedCodeAttribute%2cCompilerGeneratedAttribute'
4143

4244
steps:
4345
- script: git submodule update --init --recursive
@@ -111,14 +113,36 @@ stages:
111113
projects: '**/*.sln'
112114
configuration: $(BuildConfiguration)
113115

116+
# https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/dotnet-core?view=azure-devops&tabs=dotnetfive
114117
- task: DotNetCoreCLI@2
115118
displayName: "DotNet Test"
116119
inputs:
117120
command: test
118121
projects: '**/*[Tt]est/*.csproj'
119122
configuration: $(BuildConfiguration)
120123
nobuild: true
124+
arguments: '--collect:"XPlat Code Coverage" --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:ExcludeByAttribute=$(COVERLET_EXCLUDE_ATTRIBUTE) /p:ExcludeByFile=*\*Designer.cs /p:CoverletOutput=../_CoverageResults/ /p:MergeWith="../_CoverageResults/coverage.json" /p:CoverletOutputFormat=cobertura%2cjson'
125+
publishTestResults: true
126+
127+
# https://docs.codecov.com/docs/codecov-uploader
128+
- pwsh: |
129+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
130+
./codecov.exe -f "**/coverag*.cobertura.xml"
131+
displayName: Export coverage to CodeCov
132+
name: CodeCov
133+
134+
- pwsh: |
135+
dotnet tool install --tool-path . dotnet-reportgenerator-globaltool
136+
./reportgenerator "-reports:**/coverag*.cobertura.xml" "-targetdir:$(Agent.TempDirectory)" "-reporttypes:Cobertura"
137+
displayName: Merge coverage reports
138+
name: MergeCoverageReports
121139
140+
- task: PublishCodeCoverageResults@1
141+
displayName: 'Publish code coverage to devops'
142+
inputs:
143+
codeCoverageTool: Cobertura
144+
summaryFileLocation: '$(Agent.TempDirectory)/Cobertura.xml'
145+
122146
- task: DotNetCoreCLI@2
123147
displayName: 'DotNet Pack'
124148
inputs:
@@ -152,5 +176,5 @@ stages:
152176
packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg;$(Pipeline.Workspace)/**/*.snupkg;!$(Pipeline.Workspace)/**/*.symbols.nupkg'
153177
nuGetFeedType: internal
154178
publishVstsFeed: $(ci_feed)
155-
allowPackageConflicts: true
179+
allowPackageConflicts: false
156180
condition: and(succeeded(), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest'))

.scripts/Codecov.ps1

Lines changed: 0 additions & 26 deletions
This file was deleted.

.scripts/TestCoverage.ps1

Lines changed: 0 additions & 70 deletions
This file was deleted.

.scripts/pack.ps1

Lines changed: 0 additions & 16 deletions
This file was deleted.

appveyor.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

tests/Directory.Build.props

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<IsPackable>false</IsPackable>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="coverlet.msbuild">
9+
<PrivateAssets>all</PrivateAssets>
10+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
11+
</PackageReference>
12+
13+
<PackageReference Include="coverlet.collector">
14+
<PrivateAssets>all</PrivateAssets>
15+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
16+
</PackageReference>
17+
</ItemGroup>
18+
19+
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
20+
21+
</Project>

0 commit comments

Comments
 (0)