Integrate chocolatey package in build

This commit is contained in:
Charlie Poole 2017-07-28 03:10:44 +01:00
Родитель 23edb097e4
Коммит dd1236454a
5 изменённых файлов: 176 добавлений и 61 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -174,6 +174,7 @@ deploy
lib
test-results
package
output
images
MockAssemblyResult.xml
PortabilityAnalysis*.html

10
CHANGES.txt Normal file
Просмотреть файл

@ -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
VERIFICATION.txt Normal file
Просмотреть файл

@ -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.

Просмотреть файл

@ -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-project-loader/master/CHANGES.txt" };
var TAGS = new [] { "nunit", "test", "testing", "tdd", "runner" };
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
@ -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)
{
@ -41,7 +65,7 @@ if (BuildSystem.IsRunningOnAppVeyor)
if (branch == "master" && !isPullRequest)
{
packageVersion = version + "-dev-" + buildNumber + dbgSuffix;
packageVersion = VERSION + "-dev-" + buildNumber + dbgSuffix;
}
else
{
@ -49,8 +73,6 @@ if (BuildSystem.IsRunningOnAppVeyor)
if (isPullRequest)
suffix += "-pr-" + AppVeyor.Environment.PullRequest.Number;
else if (AppVeyor.Environment.Repository.Branch.StartsWith("release", StringComparison.OrdinalIgnoreCase))
suffix += "-pre-" + buildNumber;
else
suffix += "-" + branch;
@ -58,9 +80,9 @@ if (BuildSystem.IsRunningOnAppVeyor)
if (suffix.Length > 21)
suffix = suffix.Substring(0, 21);
suffix = suffix.Replace(".", "");
suffix = suffix.Replace(".", "");
packageVersion = version + suffix;
packageVersion = VERSION + suffix;
}
}
@ -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[]
@ -107,7 +136,7 @@ Task("Clean")
Task("NuGetRestore")
.Does(() =>
{
NuGetRestore(SOLUTION_PATH, new NuGetRestoreSettings()
NuGetRestore(SOLUTION_FILE, new NuGetRestoreSettings()
{
Source = PACKAGE_SOURCE
});
@ -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)
);
}
});
//////////////////////////////////////////////////////////////////////
@ -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);
CreateDirectory(OUTPUT_DIR);
NuGetPack(NUSPEC_PATH, new NuGetPackSettings()
{
Version = packageVersion,
BasePath = BIN_DIR,
OutputDirectory = PACKAGE_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" }
}
});
});
//////////////////////////////////////////////////////////////////////
@ -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")

Просмотреть файл

@ -1,27 +0,0 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>NUnit.Extension.NUnitV2Driver</id>
<title>NUnit 3 - NUnit V2 Framework Driver Extension</title>
<version>$version$</version>
<authors>Charlie Poole</authors>
<owners>Charlie Poole</owners>
<licenseUrl>http://nunit.org/nuget/nunit3-license.txt</licenseUrl>
<projectUrl>http://nunit.org</projectUrl>
<iconUrl>https://cdn.rawgit.com/nunit/resources/master/images/icon/nunit_256.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<summary>NUnit Engine extension allowing execution of tests using NUnit 2.x.</summary>
<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.</description>
<releaseNotes></releaseNotes>
<language>en-US</language>
<tags>nunit test testing tdd runner</tags>
<copyright>Copyright (c) 2017 Charlie Poole</copyright>
</metadata>
<files>
<file src="../../LICENSE.txt" />
<file src="../../nunit.v2.driver.addins" target="tools"/>
<file src="nunit.v2.driver.dll" target="tools"/>
<file src="nunit.core.dll" target="tools"/>
<file src="nunit.core.interfaces.dll" target="tools"/>
</files>
</package>