Skip to content

Commit

Permalink
Merge pull request #17 from nunit/issue-16
Browse files Browse the repository at this point in the history
Integrate chocolatey package in build
  • Loading branch information
CharliePoole authored Jul 30, 2017
2 parents 23edb09 + 72bac3f commit 01616d3
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 63 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ deploy
lib
test-results
package
output
images
MockAssemblyResult.xml
PortabilityAnalysis*.html
Expand Down
10 changes: 10 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NUnit V2 Framework Driver Extension 3.6 - January 10, 2017

Issues Resolved:
* 3 Change API reference to released version
* 5 NUnit 3 console should produce xml events for ITestEventListener which contain unique id in the scope of all test agents for NUnit 2 tests
* 7 Explicitness of tests is ignored in the presence of a negated filter

NUnit V2 Framework Driver Extension 3.5 - October 6, 2016

The first independent release of the vs-project-loader extension.
6 changes: 6 additions & 0 deletions VERIFICATION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.

This package is published by the NUnit Project itself. The binaries are
identical to those in the NUnit.Extension.NUnitV2Driver nuget package.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ build_script:
test: off

artifacts:
- path: package\*.nupkg
- path: output\*.nupkg
195 changes: 160 additions & 35 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
#tool nuget:?package=NUnit.ConsoleRunner&version=3.5.0
#tool nuget:?package=NUnit.ConsoleRunner&version=3.7.0

//////////////////////////////////////////////////////////////////////
// PROJECT-SPECIFIC
//////////////////////////////////////////////////////////////////////

// When copying the script to support a different extension, the
// main changes needed should be in this section.

var SOLUTION_FILE = "nunit.v2.driver.sln";
var NUSPEC_FILE = "nunit.v2.driver.nuspec";
var UNIT_TEST_ASSEMBLY = "nunit.v2.driver.tests.dll";
var INTEGRATION_TEST_ASSEMBLY = "v2-tests/v2-test-assembly.dll";
var GITHUB_SITE = "https://github.com/nunit/nunit-v2-framework-driver";
var WIKI_PAGE = "https://github.com/nunit/docs/wiki/Console-Command-Line";
var NUGET_ID = "NUnit.Extension.NUnitV2Driver";
var CHOCO_ID = "nunit-extension-nunit-v2-driver";
var VERSION = "3.6.1";

// Metadata used in the nuget and chocolatey packages
var TITLE = "NUnit 3 - NUnit V2 Framework Driver Extension";
var AUTHORS = new [] { "Charlie Poole" };
var OWNERS = new [] { "Charlie Poole" };
var DESCRIPTION = "This extension allows NUnit to load and run tests compiled against earlier versions of the NUnit framework. Versions 2.0 through 2.6.4 are supported.";
var SUMMARY = "NUnit Engine extension allowing execution of tests using NUnit 2.x.";
var COPYRIGHT = "Copyright (c) 2017 Charlie Poole";
var RELEASE_NOTES = new [] { "See https://raw.githubusercontent.com/nunit/nunit-v2-framework-driver/master/CHANGES.txt" };
var TAGS = new [] { "nunit", "test", "testing", "tdd", "runner" };

//////////////////////////////////////////////////////////////////////
// ARGUMENTS
Expand All @@ -15,15 +33,21 @@ var INTEGRATION_TEST_ASSEMBLY = "v2-tests/v2-test-assembly.dll";
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Debug");

// Special (optional) arguments for the script. You pass these
// through the Cake bootscrap script via the -ScriptArgs argument
// for example:
// ./build.ps1 -t RePackageNuget -ScriptArgs --nugetVersion="3.9.9"
// ./build.ps1 -t RePackageNuget -ScriptArgs '--binaries="rel3.9.9" --nugetVersion="3.9.9"'
var nugetVersion = Argument("nugetVersion", (string)null);
var chocoVersion = Argument("chocoVersion", (string)null);
var binaries = Argument("binaries", (string)null);

//////////////////////////////////////////////////////////////////////
// SET PACKAGE VERSION
//////////////////////////////////////////////////////////////////////

var version = "3.6.1";
var modifier = "";

var dbgSuffix = configuration == "Debug" ? "-dbg" : "";
var packageVersion = version + modifier + dbgSuffix;
var packageVersion = VERSION + dbgSuffix;

if (BuildSystem.IsRunningOnAppVeyor)
{
Expand All @@ -41,26 +65,24 @@ if (BuildSystem.IsRunningOnAppVeyor)

if (branch == "master" && !isPullRequest)
{
packageVersion = version + "-dev-" + buildNumber + dbgSuffix;
packageVersion = VERSION + "-dev-" + buildNumber + dbgSuffix;
}
else
{
var suffix = "-ci-" + buildNumber + dbgSuffix;

if (isPullRequest)
suffix += "-pr-" + AppVeyor.Environment.PullRequest.Number;
else if (AppVeyor.Environment.Repository.Branch.StartsWith("release", StringComparison.OrdinalIgnoreCase))
suffix += "-pre-" + buildNumber;
else
suffix += "-" + branch;

// Nuget limits "special version part" to 20 chars. Add one for the hyphen.
if (suffix.Length > 21)
suffix = suffix.Substring(0, 21);

suffix = suffix.Replace(".", "");
suffix = suffix.Replace(".", "");

packageVersion = version + suffix;
packageVersion = VERSION + suffix;
}
}

Expand All @@ -73,14 +95,21 @@ if (BuildSystem.IsRunningOnAppVeyor)

// Directories
var PROJECT_DIR = Context.Environment.WorkingDirectory.FullPath + "/";
var PACKAGE_DIR = PROJECT_DIR + "package/";
var BIN_DIR = PROJECT_DIR + "bin/" + configuration + "/";
var BIN_SRC = BIN_DIR; // Source of binaries used in packaging
var OUTPUT_DIR = PROJECT_DIR + "output/";

// Files
var SOLUTION_PATH = PROJECT_DIR + SOLUTION_FILE;
var NUSPEC_PATH = PROJECT_DIR + NUSPEC_FILE;
var UNIT_TEST_PATH = BIN_DIR + UNIT_TEST_ASSEMBLY;
var INTEGRATION_TEST_PATH = BIN_DIR + INTEGRATION_TEST_ASSEMBLY;
// Adjust BIN_SRC if --binaries option was given
if (binaries != null)
{
BIN_SRC = binaries;
if (!System.IO.Path.IsPathRooted(binaries))
{
BIN_SRC = PROJECT_DIR + binaries;
if (!BIN_SRC.EndsWith("/"))
BIN_SRC += "/";
}
}

// Package sources for nuget restore
var PACKAGE_SOURCE = new string[]
Expand All @@ -107,7 +136,7 @@ Task("Clean")
Task("NuGetRestore")
.Does(() =>
{
NuGetRestore(SOLUTION_PATH, new NuGetRestoreSettings()
NuGetRestore(SOLUTION_FILE, new NuGetRestoreSettings()
{
Source = PACKAGE_SOURCE
});
Expand All @@ -121,11 +150,27 @@ Task("Build")
.IsDependentOn("NuGetRestore")
.Does(() =>
{
DotNetBuild(SOLUTION_PATH, settings => settings
.WithTarget("Build")
.SetConfiguration(configuration)
.SetVerbosity(Verbosity.Minimal)
);
if (binaries != null)
throw new Exception("The --binaries option may only be specified when re-packaging an existing build.");
if(IsRunningOnWindows())
{
MSBuild(SOLUTION_FILE, new MSBuildSettings()
.SetConfiguration(configuration)
.SetMSBuildPlatform(MSBuildPlatform.Automatic)
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false)
.SetPlatformTarget(PlatformTarget.MSIL)
);
}
else
{
XBuild(SOLUTION_FILE, new XBuildSettings()
.WithTarget("Build")
.WithProperty("Configuration", configuration)
.SetVerbosity(Verbosity.Minimal)
);
}
});

//////////////////////////////////////////////////////////////////////
Expand All @@ -136,26 +181,98 @@ Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
NUnit3(UNIT_TEST_PATH);
NUnit3(INTEGRATION_TEST_PATH);
NUnit3(BIN_DIR + UNIT_TEST_ASSEMBLY);
NUnit3(BIN_DIR + INTEGRATION_TEST_ASSEMBLY);
});

//////////////////////////////////////////////////////////////////////
// PACKAGE
//////////////////////////////////////////////////////////////////////

Task("Package")
.IsDependentOn("Build")
// Additional package metadata
var PROJECT_URL = new Uri("http://nunit.org");
var ICON_URL = new Uri("https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png");
var LICENSE_URL = new Uri("http://nunit.org/nuget/nunit3-license.txt");
var PROJECT_SOURCE_URL = new Uri( GITHUB_SITE );
var PACKAGE_SOURCE_URL = new Uri( GITHUB_SITE );
var BUG_TRACKER_URL = new Uri(GITHUB_SITE + "/issues");
var DOCS_URL = new Uri(WIKI_PAGE);
var MAILING_LIST_URL = new Uri("https://groups.google.com/forum/#!forum/nunit-discuss");

Task("RePackageNuGet")
.Does(() =>
{
CreateDirectory(PACKAGE_DIR);
NuGetPack(NUSPEC_PATH, new NuGetPackSettings()
{
Version = packageVersion,
BasePath = BIN_DIR,
OutputDirectory = PACKAGE_DIR
});
CreateDirectory(OUTPUT_DIR);
NuGetPack(
new NuGetPackSettings()
{
Id = NUGET_ID,
Version = nugetVersion ?? packageVersion,
Title = TITLE,
Authors = AUTHORS,
Owners = OWNERS,
Description = DESCRIPTION,
Summary = SUMMARY,
ProjectUrl = PROJECT_URL,
IconUrl = ICON_URL,
LicenseUrl = LICENSE_URL,
RequireLicenseAcceptance = false,
Copyright = COPYRIGHT,
ReleaseNotes = RELEASE_NOTES,
Tags = TAGS,
//Language = "en-US",
OutputDirectory = OUTPUT_DIR,
Files = new [] {
new NuSpecContent { Source = PROJECT_DIR + "LICENSE.txt" },
new NuSpecContent { Source = PROJECT_DIR + "CHANGES.txt" },
new NuSpecContent { Source = PROJECT_DIR + "nunit.v2.driver.addins", Target = "tools" },
new NuSpecContent { Source = BIN_SRC + "nunit.v2.driver.dll", Target = "tools" },
new NuSpecContent { Source = BIN_SRC + "nunit.core.dll", Target = "tools" },
new NuSpecContent { Source = BIN_SRC + "nunit.core.interfaces.dll", Target = "tools" }
}
});
});

Task("RePackageChocolatey")
.Does(() =>
{
CreateDirectory(OUTPUT_DIR);
ChocolateyPack(
new ChocolateyPackSettings()
{
Id = CHOCO_ID,
Version = chocoVersion ?? packageVersion,
Title = TITLE,
Authors = AUTHORS,
Owners = OWNERS,
Description = DESCRIPTION,
Summary = SUMMARY,
ProjectUrl = PROJECT_URL,
IconUrl = ICON_URL,
LicenseUrl = LICENSE_URL,
RequireLicenseAcceptance = false,
Copyright = COPYRIGHT,
ProjectSourceUrl = PROJECT_SOURCE_URL,
DocsUrl= DOCS_URL,
BugTrackerUrl = BUG_TRACKER_URL,
PackageSourceUrl = PACKAGE_SOURCE_URL,
MailingListUrl = MAILING_LIST_URL,
ReleaseNotes = RELEASE_NOTES,
Tags = TAGS,
//Language = "en-US",
OutputDirectory = OUTPUT_DIR,
Files = new [] {
new ChocolateyNuSpecContent { Source = PROJECT_DIR + "LICENSE.txt", Target = "tools" },
new ChocolateyNuSpecContent { Source = PROJECT_DIR + "CHANGES.txt", Target = "tools" },
new ChocolateyNuSpecContent { Source = PROJECT_DIR + "VERIFICATION.txt", Target = "tools" },
new ChocolateyNuSpecContent { Source = PROJECT_DIR + "nunit.v2.driver.addins", Target = "tools" },
new ChocolateyNuSpecContent { Source = BIN_SRC + "nunit.v2.driver.dll", Target = "tools" },
new ChocolateyNuSpecContent { Source = BIN_SRC + "nunit.core.dll", Target = "tools" },
new ChocolateyNuSpecContent { Source = BIN_SRC + "nunit.core.interfaces.dll", Target = "tools" }
}
});
});

//////////////////////////////////////////////////////////////////////
Expand All @@ -166,6 +283,14 @@ Task("Rebuild")
.IsDependentOn("Clean")
.IsDependentOn("Build");

Task("Package")
.IsDependentOn("Build")
.IsDependentOn("RePackage");

Task("RePackage")
.IsDependentOn("RePackageNuGet")
.IsDependentOn("RePackageChocolatey");

Task("Appveyor")
.IsDependentOn("Build")
.IsDependentOn("Test")
Expand Down
27 changes: 0 additions & 27 deletions nunit.v2.driver.nuspec

This file was deleted.

0 comments on commit 01616d3

Please sign in to comment.