mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-20 18:02:50 +08:00
code coverage working on windows and linux
This commit is contained in:
parent
9cb00ef159
commit
2dcaf27857
12
build.cake
12
build.cake
@ -19,7 +19,7 @@ var artifactsDir = Directory("artifacts");
|
||||
var artifactsForUnitTestsDir = artifactsDir + Directory("UnitTests");
|
||||
var unitTestAssemblies = @"./test/Ocelot.UnitTests/Ocelot.UnitTests.csproj";
|
||||
var minCodeCoverage = 80d;
|
||||
var coverallsRepoToken = "coveralls-repo-token-ocelot";
|
||||
var coverallsRepoToken = "OCELOT_COVERALLS_TOKEN";
|
||||
var coverallsRepo = "https://coveralls.io/github/TomPallister/Ocelot";
|
||||
|
||||
// acceptance testing
|
||||
@ -124,16 +124,19 @@ Task("RunUnitTests")
|
||||
Configuration = compileConfig,
|
||||
ResultsDirectory = artifactsForUnitTestsDir,
|
||||
ArgumentCustomization = args => args
|
||||
// this create the code coverage report
|
||||
.Append("--settings test/Ocelot.UnitTests/UnitTests.runsettings")
|
||||
};
|
||||
|
||||
EnsureDirectoryExists(artifactsForUnitTestsDir);
|
||||
DotNetCoreTest(unitTestAssemblies, testSettings);
|
||||
|
||||
if (IsRunningOnWindows())
|
||||
{
|
||||
var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir).First().CombineWithFilePath(File("coverage.opencover.xml"));
|
||||
ReportGenerator(coverageSummaryFile, artifactsForUnitTestsDir);
|
||||
Information(coverageSummaryFile);
|
||||
Information(artifactsForUnitTestsDir);
|
||||
// todo bring back report generator to get a friendly report
|
||||
// ReportGenerator(coverageSummaryFile, artifactsForUnitTestsDir);
|
||||
// https://github.com/danielpalme/ReportGenerator
|
||||
|
||||
if (IsRunningOnCircleCI())
|
||||
{
|
||||
@ -164,7 +167,6 @@ Task("RunUnitTests")
|
||||
var whereToCheck = !IsRunningOnCircleCI() ? coverallsRepo : artifactsForUnitTestsDir;
|
||||
throw new Exception(string.Format("Code coverage fell below the threshold of {0}%. You can find the code coverage report at {1}", minCodeCoverage, whereToCheck));
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
Task("RunAcceptanceTests")
|
||||
|
@ -1,8 +1,11 @@
|
||||
# call from ocelot repo root with
|
||||
# docker build -f ./docker/Dockerfile.build .
|
||||
|
||||
# docker build --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
|
||||
FROM mijitt0m/ocelot-build:0.0.1
|
||||
|
||||
ARG OCELOT_COVERALLS_TOKEN
|
||||
|
||||
ENV OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY ./. .
|
||||
|
@ -1,11 +1,13 @@
|
||||
# call from ocelot repo root with
|
||||
# docker build --build-arg OCELOT_NUTGET_API_KEY=$OCELOT_NUTGET_API_KEY --build-arg OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY -f ./docker/Dockerfile.release .
|
||||
# docker build --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN --build-arg OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.release .
|
||||
|
||||
FROM mijitt0m/ocelot-build:0.0.1
|
||||
|
||||
ARG OCELOT_GITHUB_API_KEY
|
||||
ARG OCELOT_COVERALLS_TOKEN
|
||||
ARG OCELOT_NUTGET_API_KEY
|
||||
ARG OCELOT_GITHUB_API_KEY
|
||||
|
||||
ENV OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN
|
||||
ENV OCELOT_NUTGET_API_KEY=$OCELOT_NUTGET_API_KEY
|
||||
ENV OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user