Browse Source

Merge pull request #1094 from MarcoRossignoli/fixcoverage

Fix coverage
af/fast-dev-hack
James Jackson-South 6 years ago
committed by GitHub
parent
commit
37bf5bcdd3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      .github/workflows/build-and-test.yml
  2. 4
      ci-test.ps1
  3. 7
      codecov.yml
  4. 1
      tests/Directory.Build.props
  5. 20
      tests/Directory.Build.targets
  6. 14
      tests/coverlet.runsettings

7
.github/workflows/build-and-test.yml

@ -85,11 +85,14 @@ jobs:
CI: True
XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
# Avoid "Please provide the repository token to upload reports via `-t :repository-token`"
# https://community.codecov.io/t/whitelist-github-action-servers-to-upload-without-a-token/491/10
# https://github.community/t5/GitHub-Actions/Make-secrets-available-to-builds-of-forks/m-p/42814/highlight/true#M5129
- name: Update Codecov
uses: iansu/codecov-action-node@v1.0.0
if: matrix.options.codecov == true
if: matrix.options.codecov == true && startsWith(github.repository, 'SixLabors')
with:
token: ${{secrets.CODECOV_TOKEN}}
token: 0ef021c7-2679-4012-b42f-4bed33d99450
flags: unittests
Publish:

4
ci-test.ps1

@ -17,7 +17,7 @@ if ($codecov -eq 'true') {
# Allow toggling of profile to workaround any potential JIT errors caused by code injection.
dotnet clean -c $codecovProfile
dotnet test -c $codecovProfile -f $targetFramework /p:codecov=true
dotnet test --collect "XPlat Code Coverage" --settings .\tests\coverlet.runsettings -c $codecovProfile -f $targetFramework /p:CodeCov=true
}
elseif ($platform -eq '-x86' -and $targetFramework -match $netFxRegex) {
@ -34,4 +34,4 @@ elseif ($platform -eq '-x86' -and $targetFramework -match $netFxRegex) {
else {
dotnet test --no-build -c Release -f $targetFramework
}
}

7
codecov.yml

@ -0,0 +1,7 @@
# Documentation: https://docs.codecov.io/docs/codecov-yaml
codecov:
# Avoid "Missing base report"
# https://github.com/codecov/support/issues/363
# https://docs.codecov.io/docs/comparing-commits
allow_coverage_offsets: true

1
tests/Directory.Build.props

@ -32,7 +32,6 @@
<ItemGroup Condition="'$(codecov)' == 'true' AND '$(IsTestProject)' == 'true'">
<PackageReference Include="coverlet.collector" IsImplicitlyDefined="true" />
<PackageReference Include="coverlet.msbuild" IsImplicitlyDefined="true" />
</ItemGroup>
<ItemGroup>

20
tests/Directory.Build.targets

@ -23,30 +23,14 @@
<DotNetCliToolReference Update="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<!--Code coverage specific settings-->
<!--https://github.com/tonerdo/coverlet-->
<PropertyGroup Condition="'$(codecov)' == 'true' AND '$(IsTestProject)' == 'true'">
<CollectCoverage>true</CollectCoverage>
<UseSourceLink>true</UseSourceLink>
<Include>[SixLabors.*]*</Include>
<CoverletOutputFormat>lcov</CoverletOutputFormat>
<!--Output injects target framework into name despite explicit config. See build yml-->
<CoverletOutputPath>$(MSBuildThisFileDirectory)..\</CoverletOutputPath>
<CoverletOutput>$(CoverletOutputPath)$(AssemblyName).$(TargetFramework).lcov</CoverletOutput>
<!--Used by coverlet dues to reference issues-->
<!--https://github.com/tonerdo/coverlet/blob/master/Documentation/KnowIssues.md#4-failed-to-resolve-assembly-during-instrumentation-->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<!--Test Dependencies-->
<PackageReference Update="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Update="Colourful" Version="2.0.3" />
<PackageReference Update="coverlet.collector" Version="1.1.0" PrivateAssets="All"/>
<PackageReference Update="coverlet.msbuild" Version="2.8.0" PrivateAssets="All"/>
<PackageReference Update="coverlet.collector" Version="1.2.0" PrivateAssets="All"/>
<PackageReference Update="Magick.NET-Q16-AnyCPU" Version="7.14.4" />
<PackageReference Update="Microsoft.DotNet.RemoteExecutor" Version="5.0.0-beta.20069.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.5.0-preview-20200116-01" />
<PackageReference Update="Moq" Version="4.10.0" />
<PackageReference Update="Pfim" Version="0.9.1" />
<PackageReference Update="System.Drawing.Common" Version="4.7.0" />

14
tests/coverlet.runsettings

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>lcov</Format>
<Include>[SixLabors.*]*</Include>
<UseSourceLink>true</UseSourceLink>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
Loading…
Cancel
Save