зеркало из
1
0
Форкнуть 0
This commit is contained in:
Charlie Poole 2021-09-17 11:52:07 -07:00
Родитель 73d6d23eff
Коммит 4fa8cd3eda
7 изменённых файлов: 106 добавлений и 110 удалений

56
GitReleaseManager.yaml Normal file
Просмотреть файл

@ -0,0 +1,56 @@
# The labels that will be used to include issues in release notes.
issue-labels-include:
- Feature
- Enhancement
- Bug
- Build
- Documentation
# The labels that will NOT be used when including issues in release notes.
issue-labels-exclude:
- Refactor
# Overrides default pluralization and header names for specific labels.
issue-labels-alias:
- name: Build
header: Build
plural: Build
- name: Documentation
header: Documentation
plural: Documentation
# Configuration values used when creating new releases
create:
include-footer: true
footer-heading: Packages
footer-content: >-
There are two different packages available for the extension.
<ul>
<li>For a chocolatey install: `nunit-extension-nunit-v2-result-writer.{milestone}.nupkg`
<li>For a nuget install: `NUnit.Extension.NUnitV2ResultWriter.{milestone}.nupkg`
</ul>
You may also download the extension from
[chocolatey.org](https://chocolatey.org/packages/nunit-extension-nunit-v2-result-writer/)
or [nuget.org](https://nuget.org/packages/NUnit.Extension.NUnitV2ResultWriter/).
footer-includes-milestone: true
milestone-replace-text: '{milestone}'
include-sha-section: true
sha-section-heading: "SHA256 Hashes of the release artifacts"
sha-section-line-format: "- `{1}\t{0}`"
allow-update-to-published: false
# Configuration values used when exporting release notes
export:
include-created-date-in-title: true
created-date-string-format: MMMM dd, yyyy
perform-regex-removal: false
# regex-text: '### Where to get it(\r\n)*You can .*\.'
# multiline-regex: false
# Configuration values used when closing a milestone
close:
# Whether to add comments to issues closed with the published milestone release.
use-issue-comments: true
issue-comment: |-
:tada: This issue has been resolved in version {milestone} :tada:
The release is available on:
- [GitHub Release](https://github.com/{owner}/{repository}/releases/tag/{milestone})
- [NuGet Package](https://www.nuget.org/packages/NUnit.Extension.NUnitV2ResultWriter/{milestone})
- [Chocolatey Package](https://chocolatey.org/packages/nunit-extension-nunit-v2-result-writer/{milestone})

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

@ -1,4 +1,5 @@
#tool nuget:?package=GitVersion.CommandLine&version=5.0.0
#tool nuget:?package=GitReleaseManager&version=0.11.0
#tool nuget:?package=NUnit.ConsoleRunner&version=3.12.0
#tool nuget:?package=NUnit.ConsoleRunner&version=3.11.1
#tool nuget:?package=NUnit.ConsoleRunner&version=3.10.0
@ -12,7 +13,7 @@ const string NUGET_ID = "NUnit.Extension.NUnitProjectLoader";
const string CHOCO_ID = "nunit-extension-nunit-project-loader";
const string GITHUB_OWNER = "nunit";
const string GITHUB_REPO = "nunit-project-loader";
const string DEFAULT_VERSION = "3.8.0";
const string DEFAULT_VERSION = "3.7.1";
const string DEFAULT_CONFIGURATION = "Release";
// Load scripts after defining constants
@ -26,7 +27,7 @@ var target = Argument("target", "Default");
// Additional arguments defined in the cake scripts:
// --configuration
// --version
// --packageVersion
//////////////////////////////////////////////////////////////////////
// SETUP AND TEARDOWN
@ -65,16 +66,6 @@ Task("Clean")
CleanDirectory(parameters.OutputDirectory);
});
Task("CleanAll")
.Does<BuildParameters>((parameters) =>
{
Information("Cleaning all output directories");
CleanDirectory(parameters.ProjectDirectory + "bin/");
Information("Deleting object directories");
DeleteObjectDirectories(parameters);
});
//////////////////////////////////////////////////////////////////////
// INITIALIZE FOR BUILD
//////////////////////////////////////////////////////////////////////
@ -383,21 +374,6 @@ Task("CreateDraftRelease")
}
});
Task("ExportDraftRelease")
.Description("Export draft release locally for use in updating CHANGES.md")
.Does<BuildParameters>((parameters) =>
{
if (parameters.IsReleaseBranch && parameters.IsLocalBuild)
{
string milestone = parameters.BranchName.Substring(8);
GitReleaseManagerExport(parameters.GitHubAccessToken, GITHUB_OWNER, GITHUB_REPO, "DraftRelease.md",
new GitReleaseManagerExportSettings() { TagName = milestone });
}
else
Error("ExportDraftRelease may only be run locally, using a release branch!");
});
//////////////////////////////////////////////////////////////////////
// CREATE A PRODUCTION RELEASE
//////////////////////////////////////////////////////////////////////

42
cake/local-targets.cake Normal file
Просмотреть файл

@ -0,0 +1,42 @@
////////////////////////////////////////////////////////////////////
// TARGETS FOR DEVELOPER USE ON LOCAL MACHINE
//////////////////////////////////////////////////////////////////////
using System;
// Dependent task for all local targets
Task("MustBeLocalBuild")
.Does<BuildParameters>((parameters) =>
{
if (!parameters.IsLocalBuild)
throw new Exception($"{parameters.Target} may only be run locally!");
});
Task("CleanAll")
.Description("Clean both configs and all obj directories")
.IsDependentOn("MustBeLocalBuild")
.Does<BuildParameters>((parameters) =>
{
Information("Cleaning all output directories");
CleanDirectory(parameters.ProjectDirectory + "bin/");
Information("Deleting object directories");
DeleteObjectDirectories(parameters);
});
// Download existing draft release for modification or for use in
// updating the CHANGES.md file.
Task("DownloadDraftRelease")
.Description("Download draft release for local use")
.IsDependentOn("MustBeLocalBuild")
.Does<BuildParameters>((parameters) =>
{
if (!parameters.IsReleaseBranch)
throw new Exception("DownloadDraftRelease requires a release branch!");
string milestone = parameters.BranchName.Substring(8);
GitReleaseManagerExport(parameters.GitHubAccessToken, GITHUB_OWNER, GITHUB_REPO, "DraftRelease.md",
new GitReleaseManagerExportSettings() { TagName = milestone });
});

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

@ -5,6 +5,7 @@
#load "./test-results.cake"
#load "./test-reports.cake"
#load "./utilities.cake"
#load "./local-targets.cake"
using System;

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

@ -23,8 +23,8 @@ public class BuildVersion
IsReleaseBranch = BranchName.StartsWith("release-");
// TODO: Get GitVersion to work on Linux
string packageVersion = context.HasArgument("version")
? context.Argument("version", DEFAULT_VERSION)
string packageVersion = context.HasArgument("packageVersion")
? context.Argument("packageVersion", DEFAULT_VERSION)
: CalculatePackageVersion();
int dash = packageVersion.IndexOf('-');

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

@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
build.sh = build.sh
CHANGES.txt = CHANGES.txt
FailingAssembly.nunit = FailingAssembly.nunit
GitReleaseManager.yaml = GitReleaseManager.yaml
GitVersion.yml = GitVersion.yml
LICENSE.txt = LICENSE.txt
nunit-project-loader.nuspec = nunit-project-loader.nuspec
@ -26,6 +27,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cake", "cake", "{1E689680-AB9D-497E-8FC3-B541A9A24EEC}"
ProjectSection(SolutionItems) = preProject
cake\local-targets.cake = cake\local-targets.cake
cake\package-checks.cake = cake\package-checks.cake
cake\package-tests.cake = cake\package-tests.cake
cake\packaging.cake = cake\packaging.cake

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

@ -1,81 +0,0 @@
//////////////////////////////////////////////////////////////////////
// PACKAGE CHECKS
//////////////////////////////////////////////////////////////////////
private static class Check
{
public static void That(string testDir, params PackageCheck[] checks)
{
foreach (var check in checks)
check.ApplyTo(testDir);
}
}
private static FileCheck HasFile(string file) => HasFiles(new[] { file });
private static FileCheck HasFiles(params string[] files) => new FileCheck(files);
private static DirectoryCheck HasDirectory(string dir) => new DirectoryCheck(dir);
public abstract class PackageCheck
{
public abstract void ApplyTo(string testDir);
}
public class FileCheck : PackageCheck
{
string[] _files;
public FileCheck(string[] files)
{
_files = files;
}
public override void ApplyTo(string testDir)
{
foreach (string file in _files)
{
if (!System.IO.File.Exists(System.IO.Path.Combine(testDir, file)))
throw new Exception($"File {file} was not found.");
}
}
}
public class DirectoryCheck : PackageCheck
{
private string _path;
private List<string> _files = new List<string>();
public DirectoryCheck(string path)
{
_path = path;
}
public DirectoryCheck WithFiles(params string[] files)
{
_files.AddRange(files);
return this;
}
public DirectoryCheck WithFile(string file)
{
_files.Add(file);
return this;
}
public override void ApplyTo(string testDir)
{
string combinedPath = System.IO.Path.Combine(testDir, _path);
if (!System.IO.Directory.Exists(combinedPath))
throw new Exception($"Directory {_path} was not found.");
if (_files != null)
{
foreach (var file in _files)
{
if (!System.IO.File.Exists(System.IO.Path.Combine(combinedPath, file)))
throw new Exception($"File {file} was not found in directory {_path}.");
}
}
}
}