build works on windows

pull/1381/head
TomPallister 4 years ago
parent a5a1606c3e
commit 71a1053d70

@ -18,7 +18,7 @@ var artifactsDir = Directory("artifacts");
// unit testing // unit testing
var artifactsForUnitTestsDir = artifactsDir + Directory("UnitTests"); var artifactsForUnitTestsDir = artifactsDir + Directory("UnitTests");
var unitTestAssemblies = @"./test/Ocelot.UnitTests/Ocelot.UnitTests.csproj"; var unitTestAssemblies = @"./test/Ocelot.UnitTests/Ocelot.UnitTests.csproj";
var minCodeCoverage = 80d; var minCodeCoverage = 0.80d;
var coverallsRepoToken = "OCELOT_COVERALLS_TOKEN"; var coverallsRepoToken = "OCELOT_COVERALLS_TOKEN";
var coverallsRepo = "https://coveralls.io/github/ThreeMammals/Ocelot"; var coverallsRepo = "https://coveralls.io/github/ThreeMammals/Ocelot";
@ -180,15 +180,15 @@ Task("RunUnitTests")
{ {
Configuration = compileConfig, Configuration = compileConfig,
ResultsDirectory = artifactsForUnitTestsDir, ResultsDirectory = artifactsForUnitTestsDir,
ArgumentCustomization = args => args ArgumentCustomization = args => args
// this create the code coverage report // this create the code coverage report
.Append("--settings test/Ocelot.UnitTests/UnitTests.runsettings") .Append("--collect:\"XPlat Code Coverage\"")
}; };
EnsureDirectoryExists(artifactsForUnitTestsDir); EnsureDirectoryExists(artifactsForUnitTestsDir);
DotNetCoreTest(unitTestAssemblies, testSettings); DotNetCoreTest(unitTestAssemblies, testSettings);
var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir).First().CombineWithFilePath(File("coverage.opencover.xml")); var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir).First().CombineWithFilePath(File("coverage.cobertura.xml"));
Information(coverageSummaryFile); Information(coverageSummaryFile);
Information(artifactsForUnitTestsDir); Information(artifactsForUnitTestsDir);
@ -215,8 +215,8 @@ Task("RunUnitTests")
Information("We are not running on the build server so we won't publish the coverage report to coveralls.io"); Information("We are not running on the build server so we won't publish the coverage report to coveralls.io");
} }
var sequenceCoverage = XmlPeek(coverageSummaryFile, "//CoverageSession/Summary/@sequenceCoverage"); var sequenceCoverage = XmlPeek(coverageSummaryFile, "//coverage/@line-rate");
var branchCoverage = XmlPeek(coverageSummaryFile, "//CoverageSession/Summary/@branchCoverage"); var branchCoverage = XmlPeek(coverageSummaryFile, "//coverage/@line-rate");
Information("Sequence Coverage: " + sequenceCoverage); Information("Sequence Coverage: " + sequenceCoverage);

@ -89,7 +89,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.0.0" /> <PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.0.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0"> <PackageReference Include="coverlet.collector" Version="1.3.0">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference> </PackageReference>

Loading…
Cancel
Save