Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: csharp
os:
- linux
git:
depth: 999999
before_install:
- git status
- git branch
mono:
- latest
dotnet: 1.0.4
dist: trusty
script:
- ./build.sh
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,21 @@ Note that this mechanism is not as strongly typed as the other methods; you will

## Build Status

The repository is built on [AppVeyor](https://ci.appveyor.com/project/binarymash/responses).

### Stable

[![Build status](https://ci.appveyor.com/api/projects/status/p51dvusrw32u9b17/branch/master?svg=true)](https://ci.appveyor.com/project/binarymash/responses/branch/master)

[![Coverage Status](https://coveralls.io/repos/github/binarymash/responses/badge.svg?branch=master)](https://coveralls.io/github/binarymash/responses?branch=master)
| Environment | Environment Config | Build Server | Status | Coverage
|--------------|--------------------|--------------|--------|---------
| Windows | Visual Studio 2017 | Appveyor | [![Build status](https://ci.appveyor.com/api/projects/status/p51dvusrw32u9b17/branch/master?svg=true)](https://ci.appveyor.com/project/binarymash/responses/branch/master) | [![Coverage Status](https://coveralls.io/repos/github/binarymash/responses/badge.svg?branch=master)](https://coveralls.io/github/binarymash/responses?branch=master)
| Ubuntu 14.04 | SDK 1.0.4 | Travis | [![Build Status](https://travis-ci.org/binarymash/responses.svg?branch=master)](https://travis-ci.org/binarymash/responses) | -

### Development

### Development

[![Build status](https://ci.appveyor.com/api/projects/status/p51dvusrw32u9b17/branch/develop?svg=true)](https://ci.appveyor.com/project/binarymash/responses/branch/develop)

[![Coverage Status](https://coveralls.io/repos/github/binarymash/responses/badge.svg?branch=develop)](https://coveralls.io/github/binarymash/responses?branch=develop)
| Environment | Environment Config | Build Server | Status | Coverage
|--------------|--------------------|--------------|--------|---------
| Windows | Visual Studio 2017 | Appveyor | [![Build status](https://ci.appveyor.com/api/projects/status/p51dvusrw32u9b17/branch/develop?svg=true)](https://ci.appveyor.com/project/binarymash/responses/branch/develop) | [![Coverage Status](https://coveralls.io/repos/github/binarymash/responses/badge.svg?branch=develop)](https://coveralls.io/github/binarymash/responses?branch=develop)
| Ubuntu 14.04 | SDK 1.0.4 | Travis | [![Build Status](https://travis-ci.org/binarymash/responses.svg?branch=develop)](https://travis-ci.org/binarymash/responses) | -

Development builds are published to https://www.myget.org/F/binarymash-unstable/api/v3/index.json
107 changes: 61 additions & 46 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ Task("Version")
var nugetVersion = versioning.NuGetVersion;
Information("SemVer version number: " + nugetVersion);

if (AppVeyor.IsRunningOnAppVeyor)
if (BuildSystem.IsLocalBuild)
{
Information("Persisting version number...");
PersistVersion(committedVersion, nugetVersion);
buildVersion = nugetVersion;
Information("We are not running on build server, so we won't persist the version number.");
}
else
{
Information("We are not running on build server, so we won't persist the version number.");
Information("Persisting version number...");
PersistVersion(committedVersion, nugetVersion);
buildVersion = nugetVersion;
}
});

Expand Down Expand Up @@ -117,55 +117,70 @@ Task("RunUnitTestsCoverageReport")
.IsDependentOn("Compile")
.Does(context =>
{
var coverageSummaryFile = artifactsForUnitTestsDir + File("coverage.xml");

EnsureDirectoryExists(artifactsForUnitTestsDir);

OpenCover(tool =>
{
tool.DotNetCoreTest(unitTestAssemblies);
},
new FilePath(coverageSummaryFile),
new OpenCoverSettings()
{
Register="user",
ArgumentCustomization=args=>args.Append(@"-oldstyle -returntargetcode")
}
.WithFilter("+[BinaryMash.*]*")
.WithFilter("-[xunit*]*")
.WithFilter("-[BinaryMash.*.Tests]*")
);

ReportGenerator(coverageSummaryFile, artifactsForUnitTestsDir);

if (AppVeyor.IsRunningOnAppVeyor)
if (IsRunningOnWindows())
{
var repoToken = EnvironmentVariable(coverallsRepoToken);
if (string.IsNullOrEmpty(repoToken))
var coverageSummaryFile = artifactsForUnitTestsDir + File("coverage.xml");

EnsureDirectoryExists(artifactsForUnitTestsDir);

OpenCover(tool =>
{
tool.DotNetCoreTest(unitTestAssemblies);
},
new FilePath(coverageSummaryFile),
new OpenCoverSettings()
{
Register="user",
ArgumentCustomization=args=>args.Append(@"-oldstyle -returntargetcode")
}
.WithFilter("+[BinaryMash.*]*")
.WithFilter("-[xunit*]*")
.WithFilter("-[BinaryMash.*.Tests]*")
);

ReportGenerator(coverageSummaryFile, artifactsForUnitTestsDir);

if (BuildSystem.IsRunningOnAppVeyor)
{
var repoToken = EnvironmentVariable(coverallsRepoToken);
if (string.IsNullOrEmpty(repoToken))
{
throw new Exception(string.Format("Coveralls repo token not found. Set environment variable '{0}'", coverallsRepoToken));
}

Information("Uploading test coverage to coveralls.io");
CoverallsNet(coverageSummaryFile, CoverallsNetReportType.OpenCover, new CoverallsNetSettings()
{
RepoToken = repoToken
});
}
else
{
throw new Exception(string.Format("Coveralls repo token not found. Set environment variable '{0}'", coverallsRepoToken));
Information("We are not running on the authoritative build server so we won't publish the coverage report to coveralls.io");
}

Information("Uploading test coverage to coveralls.io");
CoverallsNet(coverageSummaryFile, CoverallsNetReportType.OpenCover, new CoverallsNetSettings()
var sequenceCoverage = XmlPeek(coverageSummaryFile, "//CoverageSession/Summary/@sequenceCoverage");
var branchCoverage = XmlPeek(coverageSummaryFile, "//CoverageSession/Summary/@branchCoverage");

Information("Sequence Coverage: " + sequenceCoverage);

if(double.Parse(sequenceCoverage) < minCodeCoverage)
{
RepoToken = repoToken
});
throw new Exception(string.Format("Code coverage fell below the threshold of {0}%", minCodeCoverage));
};
}
else
{
Information("We are not running on the build server so we won't publish the coverage report to coveralls.io");
}
var settings = new DotNetCoreTestSettings
{
Configuration = compileConfig,
};

var sequenceCoverage = XmlPeek(coverageSummaryFile, "//CoverageSession/Summary/@sequenceCoverage");
var branchCoverage = XmlPeek(coverageSummaryFile, "//CoverageSession/Summary/@branchCoverage");
EnsureDirectoryExists(artifactsForUnitTestsDir);
DotNetCoreTest(unitTestAssemblies, settings);

Information("Sequence Coverage: " + sequenceCoverage);

if(double.Parse(sequenceCoverage) < minCodeCoverage)
{
throw new Exception(string.Format("Code coverage fell below the threshold of {0}%", minCodeCoverage));
};
Warning("We are not running on Windows, so cannot test code coverage. If coverage is insufficient then the build will fail at this point when building on Windows.");
}
});

Task("RunTests")
Expand All @@ -186,7 +201,7 @@ Task("CreatePackages")
"releaseNotes:releasenotes.md"
});

if (AppVeyor.IsRunningOnAppVeyor)
if (BuildSystem.IsRunningOnAppVeyor)
{
var path = packagesDir.ToString() + @"/**/*";

Expand All @@ -210,7 +225,7 @@ Task("ReleasePackagesToUnstableFeed")
Task("EnsureStableReleaseRequirements")
.Does(() =>
{
if (!AppVeyor.IsRunningOnAppVeyor)
if (!BuildSystem.IsRunningOnAppVeyor)
{
throw new Exception("Stable release should happen via appveyor");
}
Expand Down