From 29adf6eec9f8018d1d7b06918e7e451fbfd3b7eb Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Thu, 11 May 2017 20:35:07 +0100 Subject: [PATCH 01/17] added config --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..25c60da --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: csharp +mono: none +dotnet: 1.0.1 +dist: trusty +script: + - ./build.sh \ No newline at end of file From fb407e3941b6ced511e05efaf09125818260ec86 Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Thu, 11 May 2017 20:42:12 +0100 Subject: [PATCH 02/17] upgrade dotnet version --- travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 travis.yml diff --git a/travis.yml b/travis.yml new file mode 100644 index 0000000..2c23a83 --- /dev/null +++ b/travis.yml @@ -0,0 +1,6 @@ +language: csharp +mono: none +dotnet: 1.0.4 +dist: trusty +script: + - ./build.sh \ No newline at end of file From b1f94e922cd6e7e6dca09d86450636889a4176ff Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Thu, 11 May 2017 20:50:45 +0100 Subject: [PATCH 03/17] more mesing around --- travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/travis.yml b/travis.yml index 2c23a83..89ddb24 100644 --- a/travis.yml +++ b/travis.yml @@ -1,5 +1,8 @@ language: csharp -mono: none +os: + - linux +mono: + - latest dotnet: 1.0.4 dist: trusty script: From 2efd27707e2a70254a8fb141d149ed16f5f433ed Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Thu, 11 May 2017 20:54:14 +0100 Subject: [PATCH 04/17] lets try with mono --- travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/travis.yml b/travis.yml index 89ddb24..60e97fe 100644 --- a/travis.yml +++ b/travis.yml @@ -3,7 +3,6 @@ os: - linux mono: - latest -dotnet: 1.0.4 -dist: trusty + script: - ./build.sh \ No newline at end of file From ea36b1d9eb9fa192d0123749033d670447212444 Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Thu, 11 May 2017 20:58:02 +0100 Subject: [PATCH 05/17] aha! now lets try editing the correct file :) --- .travis.yml | 4 ++-- travis.yml | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 travis.yml diff --git a/.travis.yml b/.travis.yml index 25c60da..004d15f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: csharp mono: none -dotnet: 1.0.1 +dotnet: 1.0.4 dist: trusty script: - - ./build.sh \ No newline at end of file + - ./build.sh diff --git a/travis.yml b/travis.yml deleted file mode 100644 index 60e97fe..0000000 --- a/travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: csharp -os: - - linux -mono: - - latest - -script: - - ./build.sh \ No newline at end of file From 4605f8648a6afe4da5658975309ddb6fe7806c26 Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Thu, 11 May 2017 21:01:05 +0100 Subject: [PATCH 06/17] add mono --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 004d15f..c21a363 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,8 @@ language: csharp -mono: none +os: + - linux +mono: + - latest dotnet: 1.0.4 dist: trusty script: From 0f63048ef079198dd51750606f101350aef12d4b Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Thu, 11 May 2017 21:09:54 +0100 Subject: [PATCH 07/17] do full checkout so that gitversion has branch information to work with --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index c21a363..46a41b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: csharp os: - linux +before_install: + - git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags mono: - latest dotnet: 1.0.4 From 4cf90a3a140f3cbc7ffe86ad3c43a8503c4bb094 Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Fri, 12 May 2017 17:15:38 +0100 Subject: [PATCH 08/17] try again. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 46a41b8..1ded489 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: csharp os: - linux -before_install: +install: - git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags mono: - latest From 5ab431c65954c8ec18f07b64663fa7c955dc73fe Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Fri, 12 May 2017 17:50:09 +0100 Subject: [PATCH 09/17] ok, lets try this from http://stackoverflow.com/questions/32580821/how-can-i-customize-override-the-git-clone-step-in-travis-ci --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1ded489..9451f38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,10 @@ language: csharp os: - linux -install: - - git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags +before-install: + - git clone https://github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_REPO_SLUG + - cd $TRAVIS_REPO_SLUG + - git checkout -qf $TRAVIS_COMMIT mono: - latest dotnet: 1.0.4 From aadfd4626b3c47e2beda72b1b2b8e89f7bd2b482 Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Fri, 12 May 2017 17:57:38 +0100 Subject: [PATCH 10/17] ...and now lets try this from https://github.com/GitTools/GitVersion/issues/912 --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9451f38..d81730c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,7 @@ language: csharp os: - linux before-install: - - git clone https://github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_REPO_SLUG - - cd $TRAVIS_REPO_SLUG - - git checkout -qf $TRAVIS_COMMIT + - git fetch origin +refs/heads/*:refs/remotes/origin/* --unshallow mono: - latest dotnet: 1.0.4 From 847ee032d4b3486395a8a837b02663eca6eace62 Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Mon, 15 May 2017 19:18:15 +0100 Subject: [PATCH 11/17] doh! now lets try with the correct step name... --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d81730c..5ee799d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,10 @@ language: csharp os: - linux -before-install: - - git fetch origin +refs/heads/*:refs/remotes/origin/* --unshallow +before_install: + - git clone https://github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_REPO_SLUG + - cd $TRAVIS_REPO_SLUG + - git checkout -qf $TRAVIS_COMMIT mono: - latest dotnet: 1.0.4 From bade66216b39c818dc5feafc7fdba86179bdf14b Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Mon, 15 May 2017 19:53:02 +0100 Subject: [PATCH 12/17] =?UTF-8?q?Don=E2=80=99t=20do=20Windows-specific=20t?= =?UTF-8?q?asks=20when=20not=20running=20on=20Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.cake | 107 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 46 deletions(-) diff --git a/build.cake b/build.cake index ecf74bf..40aafe6 100644 --- a/build.cake +++ b/build.cake @@ -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; } }); @@ -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") @@ -186,7 +201,7 @@ Task("CreatePackages") "releaseNotes:releasenotes.md" }); - if (AppVeyor.IsRunningOnAppVeyor) + if (BuildSystem.IsRunningOnAppVeyor) { var path = packagesDir.ToString() + @"/**/*"; @@ -210,7 +225,7 @@ Task("ReleasePackagesToUnstableFeed") Task("EnsureStableReleaseRequirements") .Does(() => { - if (!AppVeyor.IsRunningOnAppVeyor) + if (!BuildSystem.IsRunningOnAppVeyor) { throw new Exception("Stable release should happen via appveyor"); } From d67c14197971e4adad9535e0a163106f99e65ce6 Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Mon, 15 May 2017 20:37:33 +0100 Subject: [PATCH 13/17] Update readme --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1790d8c..b63497f 100644 --- a/README.md +++ b/README.md @@ -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 From ab285eb2e573dbcd47a188d22dc6ab9fab5f5db3 Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Mon, 15 May 2017 21:03:02 +0100 Subject: [PATCH 14/17] Lets see if this fixes PR branches --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5ee799d..5f5660b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,7 @@ language: csharp os: - linux before_install: - - git clone https://github.com/$TRAVIS_REPO_SLUG.git $TRAVIS_REPO_SLUG - - cd $TRAVIS_REPO_SLUG - - git checkout -qf $TRAVIS_COMMIT + - git fetch origin +refs/heads/*:refs/remotes/origin/* --unshallow mono: - latest dotnet: 1.0.4 From 435e173e5c5aad5c9ed9b0f5cc925ee79b30f25a Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Tue, 16 May 2017 13:47:58 +0100 Subject: [PATCH 15/17] Hmm.. this seems to be what GitVersion uses for its own builds... --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5f5660b..798d8e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: csharp os: - linux before_install: - - git fetch origin +refs/heads/*:refs/remotes/origin/* --unshallow + - git fetch --unshallow mono: - latest dotnet: 1.0.4 From 8971a043775960a275ce40f5b37877f4214b7f47 Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Tue, 16 May 2017 18:13:16 +0100 Subject: [PATCH 16/17] Well, this is getting painful. --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 798d8e6..7bf6234 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,11 @@ language: csharp os: - linux +git: + depth:999999 before_install: - - git fetch --unshallow + - git status + - git branch mono: - latest dotnet: 1.0.4 From b8b16dcf5cb085fcf28a1af153b1dc1bff4b692f Mon Sep 17 00:00:00 2001 From: Philip Wood Date: Tue, 16 May 2017 18:16:51 +0100 Subject: [PATCH 17/17] Fix spacing. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7bf6234..923b209 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: csharp os: - linux git: - depth:999999 + depth: 999999 before_install: - git status - git branch