Skip to content
Permalink
Browse files

Code coverage

  • Loading branch information...
dahlia committed May 14, 2019
1 parent 96e40de commit d7b61c9907896d4d0d3850aa1b2d52fb1c468e86
@@ -1,5 +1,6 @@
parameters:
configuration: Debug
testArguments: ""

steps:

@@ -36,4 +37,12 @@ steps:
displayName: dotnet test
inputs:
command: test
arguments: --configuration ${{ parameters.configuration }}
projects: '**/*Tests/*.csproj'
arguments: >-
--configuration ${{ parameters.configuration }}
${{ parameters.testArguments }}
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '$(Agent.TempDirectory)/*.trx'
@@ -13,6 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.msbuild" Version="2.4.1">
@@ -17,7 +17,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.XUnit" Version="1.0.7" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.1-beta.61">
@@ -9,6 +9,52 @@ variables:

jobs:

- job: Windows_coverage
pool:
vmImage: 'vs2017-win2016'
steps:
- task: CmdLine@2
displayName: dotnet tool install Codecov.Tool
inputs:
script: dotnet tool install --global Codecov.Tool --version 1.5.0
- template: .azure-pipelines/dotnet-core.yml
parameters:
configuration: Debug
testArguments: >-
--logger trx
--collect "Code coverage"
- task: Bash@3
displayName: codecov
condition: "ne('', variables['codecovToken'])"
inputs:
targetType: inline
script: |
pushd '$(Agent.TempDirectory)'
curl \
-o microsoft.codecoverage.16.1.0.nupkg -L \
https://www.nuget.org/api/v2/package/Microsoft.CodeCoverage/16.1.0
unzip microsoft.codecoverage.16.1.0.nupkg
i=0
mkdir cov
for cov in **/*.coverage; do
echo build/netstandard1.0/CodeCoverage/CodeCoverage.exe analyze \
/output:"cov/$i.coveragexml" \
"$cov"
build/netstandard1.0/CodeCoverage/CodeCoverage.exe analyze \
/output:"cov/$i.coveragexml" \
"$cov"
i=$[i+1]
done
tmp_path="`pwd`"
popd
for cov in "$tmp_path"/cov/*.coveragexml; do
codecov -f "$cov" -t '$(codecovToken)'
done
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Agent.TempDirectory)\cov'
artifactName: coverage

- job: Linux
pool:
vmImage: 'ubuntu-16.04'

0 comments on commit d7b61c9

Please sign in to comment.
You can’t perform that action at this time.