зеркало из https://github.com/dotnet/winforms.git
86 строки
5.9 KiB
XML
86 строки
5.9 KiB
XML
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="Codecov">
|
|
|
|
<PropertyGroup>
|
|
<!-- We need to specify a framework in order for the Restore target to work -->
|
|
<TargetFramework>$(NetCurrent)</TargetFramework>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<PackageReference Include="Codecov" GeneratePathProperty="true" />
|
|
<PackageReference Include="ReportGenerator" GeneratePathProperty="true" />
|
|
</ItemGroup>
|
|
|
|
<Target Name="GatherCoverageInputs">
|
|
<PropertyGroup>
|
|
<_CodecovPath>$(PkgCodecov)\tools\Codecov.exe</_CodecovPath>
|
|
<_ReportGeneratorPath>$(PkgReportGenerator)\tools\net47\ReportGenerator.exe</_ReportGeneratorPath>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<!-- [...\artifacts\bin\][project]\[configuration]\[framework]\coverage\[project].coverage-->
|
|
<_CoverageReports Include="$(ArtifactsBinDir)*\$(Configuration)\*\coverage\*.coverage" />
|
|
<_UnitCoverageReports Include="@(_CoverageReports)" Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.IntegrationTests.coverage'))" />
|
|
<_IntegrationCoverageReports Include="@(_CoverageReports)" Condition="$([System.String]::Copy('%(Identity)').EndsWith('.IntegrationTests.coverage'))" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<Target Name="MergeCoverage" DependsOnTargets="GatherCoverageInputs">
|
|
<!-- Merge multiple coverlet reports into a single Cobertura report before uploading to codecov.io, in order to
|
|
reduce upload size and load on the codecov.io processing servers. -->
|
|
<Message Importance="high" Text=""$(_ReportGeneratorPath)" "-reports:@(_CoverageReports)" -targetdir:$(BaseOutputPath)coverage/full -reporttypes:Cobertura -filefilters:-*.g.cs" />
|
|
<Exec Condition="'@(_CoverageReports)' != ''" Command=""$(_ReportGeneratorPath)" "-reports:@(_CoverageReports)" -targetdir:$(BaseOutputPath)coverage/full -reporttypes:Cobertura -filefilters:-*.g.cs" />
|
|
|
|
<!-- Merge multiple coverlet reports into a single Cobertura report before uploading to codecov.io, in order to
|
|
reduce upload size and load on the codecov.io processing servers. -->
|
|
<Message Importance="high" Text=""$(_ReportGeneratorPath)" "-reports:@(_UnitCoverageReports)" -targetdir:$(BaseOutputPath)coverage/unit -reporttypes:Cobertura -filefilters:-*.g.cs" />
|
|
<Exec Condition="'@(_UnitCoverageReports)' != ''" Command=""$(_ReportGeneratorPath)" "-reports:@(_UnitCoverageReports)" -targetdir:$(BaseOutputPath)coverage/unit -reporttypes:Cobertura -filefilters:-*.g.cs" />
|
|
|
|
<!-- Merge multiple coverlet reports into a single Cobertura report before uploading to codecov.io, in order to
|
|
reduce upload size and load on the codecov.io processing servers. -->
|
|
<Message Importance="high" Text=""$(_ReportGeneratorPath)" "-reports:@(_IntegrationCoverageReports)" -targetdir:$(BaseOutputPath)coverage/integration -reporttypes:Cobertura -filefilters:-*.g.cs" />
|
|
<Exec Condition="'@(_IntegrationCoverageReports)' != ''" Command=""$(_ReportGeneratorPath)" "-reports:@(_IntegrationCoverageReports)" -targetdir:$(BaseOutputPath)coverage/integration -reporttypes:Cobertura -filefilters:-*.g.cs" />
|
|
</Target>
|
|
|
|
<Target Name="Codecov" DependsOnTargets="MergeCoverage">
|
|
|
|
<ItemGroup>
|
|
<_CodecovFullArgs Include="-f;$(BaseOutputPath)coverage\full\Cobertura.xml" />
|
|
<_CodecovUnitArgs Include="-f;$(BaseOutputPath)coverage\unit\Cobertura.xml" />
|
|
<_CodecovIntegrationArgs Include="-f;$(BaseOutputPath)coverage\integration\Cobertura.xml" />
|
|
|
|
<!-- Report an error if the upload fails -->
|
|
<_CodecovArgs Include="--required" />
|
|
|
|
<_CodecovFlags Include="$(Configuration)" Condition="'$(Configuration)' != ''" />
|
|
<_CodecovProductionFlags Include="@(_CodecovFlags)" />
|
|
<_CodecovProductionFlags Include="production" />
|
|
<_CodecovTestFlags Include="@(_CodecovFlags)" />
|
|
<_CodecovTestFlags Include="test" />
|
|
|
|
<_CodecovProductionUnitFlags Include="@(_CodecovProductionFlags)" />
|
|
<_CodecovProductionUnitFlags Include="unit" />
|
|
<_CodecovTestUnitFlags Include="@(_CodecovTestFlags)" />
|
|
<_CodecovTestUnitFlags Include="unit" />
|
|
|
|
<_CodecovProductionIntegrationFlags Include="@(_CodecovProductionFlags)" />
|
|
<_CodecovProductionIntegrationFlags Include="integration" />
|
|
<_CodecovTestIntegrationFlags Include="@(_CodecovTestFlags)" />
|
|
<_CodecovTestIntegrationFlags Include="integration" />
|
|
</ItemGroup>
|
|
|
|
<!-- Upload the unit test coverage file with a 'production' flag, which will be filtered by codecov.io to production code -->
|
|
<Message Importance="high" Text=""$(_CodecovPath)" @(_CodecovUnitArgs, ' ') @(_CodecovArgs, ' ') --flag @(_CodecovProductionUnitFlags, ',')" />
|
|
<Exec Condition="'@(_UnitCoverageReports)' != ''" Command=""$(_CodecovPath)" @(_CodecovUnitArgs, ' ') @(_CodecovArgs, ' ') --flag @(_CodecovProductionUnitFlags, ',')" />
|
|
|
|
<!-- Upload the integration test coverage file with a 'production' flag, which will be filtered by codecov.io to production code -->
|
|
<Message Importance="high" Text=""$(_CodecovPath)" @(_CodecovIntegrationArgs, ' ') @(_CodecovArgs, ' ') --flag @(_CodecovProductionIntegrationFlags, ',')" />
|
|
<Exec Condition="'@(_IntegrationCoverageReports)' != ''" Command=""$(_CodecovPath)" @(_CodecovIntegrationArgs, ' ') @(_CodecovArgs, ' ') --flag @(_CodecovProductionIntegrationFlags, ',')" />
|
|
|
|
<!-- Upload the full test coverage file with a 'test' flag, which will be filtered by codecov.io to test code. We
|
|
don't further separate this by integration vs. unit tests because the answer is clear from the file path. -->
|
|
<Message Importance="high" Text=""$(_CodecovPath)" @(_CodecovFullArgs, ' ') @(_CodecovArgs, ' ') --flag @(_CodecovTestFlags, ',')" />
|
|
<Exec Condition="'@(_CoverageReports)' != ''" Command=""$(_CodecovPath)" @(_CodecovFullArgs, ' ') @(_CodecovArgs, ' ') --flag @(_CodecovTestFlags, ',')" />
|
|
</Target>
|
|
|
|
</Project>
|