зеркало из
1
0
Форкнуть 0

Integrate chocolatey package creation into build script

This commit is contained in:
Charlie Poole 2017-08-03 15:35:45 -07:00
Родитель 85d421ef2d
Коммит 934888fe33
2 изменённых файлов: 127 добавлений и 8 удалений

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 a copyright holder of the extension software. The binaries are
identical to those in the NUnit.Extension.TeamCityEventListener nuget package.

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

@ -7,6 +7,15 @@
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
//////////////////////////////////////////////////////////////////////
@ -50,10 +59,23 @@ var PROJECT_DIR = Context.Environment.WorkingDirectory.FullPath + "/";
var PACKAGE_DIR = PROJECT_DIR + "package/";
var TOOLS_DIR = PROJECT_DIR + "tools/";
var BIN_DIR = PROJECT_DIR + "bin/" + configuration + "/";
var BIN_SRC = BIN_DIR; // Source of binaries used in packaging
var TEST_NUNIT_DIR = PROJECT_DIR + "bin/nunit/";
var TEST_PACKAGES_DIR = PROJECT_DIR + "bin/packages/";
var TEST_TEAMCITY_EXT_DIR = TEST_NUNIT_DIR + "NUnit.Extension.TeamCityEventListener/tools/";
// 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 += "/";
}
}
// Files
var SOLUTION_FILE = PROJECT_DIR + "teamcity-event-listener.sln";
var TEST_SOLUTION_FILE = PROJECT_DIR + "teamcity-event-listener-tests.sln";
@ -61,6 +83,30 @@ var NUNIT3_CONSOLE = TOOLS_DIR + "NUnit.ConsoleRunner/tools/nunit3-console.exe";
var TEST_ASSEMBLY = BIN_DIR + "teamcity-event-listener.tests.dll";
var INTEGRATION_TEST_ASSEMBLY = BIN_DIR + "nunit.integration.tests.dll";
// MetaData used in the nuget and chocolatey packages
var GITHUB_SITE = "https://github.com/nunit/teamcity-event-listener";
var WIKI_PAGE = "https://github.com/nunit/docs/wiki/Console-Command-Line";
var NUGET_ID = "NUnit.Extension.TeamCityEventListener";
var CHOCO_ID = "nunit-extension-teamcity-event-listener";
var TITLE = "NUnit 3 - Team City Event Listener Extension";
var AUTHORS = new [] { "Charlie Poole" };
var OWNERS = new [] { "Charlie Poole" };
var DESCRIPTION = "This extension sends specially formatted messages about test progress to TeamCity as each test executes, allowing TeamCity to monitor progress.";
var SUMMARY = "NUnit Team City Event Listener extension for TeamCity.";
var COPYRIGHT = "Copyright (c) 2017 Charlie Poole";
var RELEASE_NOTES = new [] { "See https://raw.githubusercontent.com/nunit/nunit-v2-result-writer/master/CHANGES.txt" };
var TAGS = new [] { "nunit", "test", "testing", "tdd", "runner" };
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");
// Package sources for nuget restore
var PACKAGE_SOURCE = new string[]
{
@ -107,6 +153,9 @@ Task("Build")
.IsDependentOn("NuGetRestore")
.Does(() =>
{
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()
@ -286,20 +335,76 @@ Task("IntegrationTest")
// PACKAGE
//////////////////////////////////////////////////////////////////////
Task("Package")
.IsDependentOn("Build")
Task("RePackageNuGet")
.Does(() =>
{
CreateDirectory(PACKAGE_DIR);
NuGetPack("teamcity-event-listener.nuspec", 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 = PACKAGE_DIR,
Files = new [] {
new NuSpecContent { Source = PROJECT_DIR + "LICENSE.txt" },
new NuSpecContent { Source = PROJECT_DIR + "CHANGES.txt" },
new NuSpecContent { Source = BIN_SRC + "teamcity-event-listener.dll", Target = "tools" }
}
});
});
Task("RePackageChocolatey")
.Does(() =>
{
CreateDirectory(PACKAGE_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 = PACKAGE_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 = BIN_SRC + "teamcity-event-listener.dll", Target = "tools" }
}
});
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
@ -321,6 +426,14 @@ Task("CheckIntegration")
.IsDependentOn("IntegrationTest")
.IsDependentOn("Package");
Task("Package")
.IsDependentOn("Build")
.IsDependentOn("RePackage");
Task("RePackage")
.IsDependentOn("RePackageNuGet")
.IsDependentOn("RePackageChocolatey");
Task("Travis")
.IsDependentOn("Build")
.IsDependentOn("Test");