Skip to content

Commit

Permalink
Merge pull request #1552 from nunit/issue-1545
Browse files Browse the repository at this point in the history
Use alpha label for dev builds
  • Loading branch information
CharliePoole authored Dec 23, 2024
2 parents eae095a + fde1ede commit 9f43d4e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 135 deletions.
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ commits-since-version-source-padding: 5
branches:
master:
regex: ^(main|version4)$
tag: dev
tag: alpha
release:
tag: pre
pull-request:
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# NUnit 3 Console and Engine #
# NUnit 3 Console and Engine

[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/81uhucr7tlq2kwup/branch/master?svg=true)](https://ci.appveyor.com/project/CharliePoole/nunit-console/branch/master) [![Azure Pipelines Build Status](https://nunit.visualstudio.com/NUnit/_apis/build/status/NUnit%20Engine%20&%20Console/NUnit%20Console%20CI?branchName=master)](https://nunit.visualstudio.com/NUnit/_build/latest?definitionId=13&branchName=master) [![NuGet Version and Downloads count](https://buildstats.info/nuget/NUnit.ConsoleRunner)](https://www.nuget.org/packages/NUnit.ConsoleRunner)

[![Follow NUnit](https://img.shields.io/twitter/follow/nunit.svg?style=social)](https://twitter.com/nunit) [![Slack](https://img.shields.io/badge/chat-on%20Slack-brightgreen)](https://join.slack.com/t/nunit/shared_invite/zt-jz58jw68-Led8y3WH4n2a~Y5WjuOpKA) [![nunit-discuss Google Groups](https://img.shields.io/badge/mailing%20list-nunit--discuss-blue.svg)](https://groups.google.com/forum/#!forum/nunit-discuss)

NUnit is a unit-testing framework for all .NET languages. Initially ported from JUnit, the current production release, version 3, has been completely rewritten with many new features and support for a wide range of .NET platforms.

## Table of Contents ##
## Table of Contents

- [Downloads](#downloads)
- [Documentation](#documentation)
- [Contributing](#contributing)
- [License](#license)
- [NUnit Projects](#nunit-projects)

## Downloads ##
## Downloads

The latest stable release of the NUnit Console is [available on NuGet](https://www.nuget.org/packages/NUnit.ConsoleRunner/), [Chocolatey](https://chocolatey.org/packages/nunit-console-runner), or can be [downloaded from GitHub](https://github.com/nunit/nunit-console/releases). Pre-release builds are [available on MyGet](https://www.myget.org/feed/nunit/package/nuget/NUnit.ConsoleRunner).

Expand All @@ -25,43 +25,43 @@ The Console/Engine are available in various packages:
- [NUnit.Engine](https://www.nuget.org/packages/NUnit.Engine/) & [NUnit.Engine.Api](https://www.nuget.org/packages/NUnit.Engine.Api/): Packages intended for custom runners integrating directly with the NUnit Engine.

Development builds of all packages are available from our MyGet feed at https://www.myget.org/feed/Packages/nunit
## Documentation ##
## Documentation

Documentation for all NUnit projects are available at [https://docs.nunit.org/](https://docs.nunit.org/).

## Contributing ##
## Contributing

For more information on contributing to the NUnit project, please see [CONTRIBUTING.md](https://github.com/nunit/nunit-console/blob/master/CONTRIBUTING.md) and the [Developer Docs](https://github.com/nunit/docs/wiki/Team-Practices#technical-practices).

NUnit 3.0 was created by [Charlie Poole](https://github.com/CharliePoole), [Rob Prouse](https://github.com/rprouse), [Simone Busoli](https://github.com/simoneb), [Neil Colvin](https://github.com/oznetmaster) and numerous community contributors. A complete list of contributors since the nunit-console repository was created can be [found on GitHub](https://github.com/nunit/nunit-console/graphs/contributors).

Earlier versions of NUnit were developed by Charlie Poole, James W. Newkirk, Alexei A. Vorontsov, Michael C. Two and Philip A. Craig.

## License ##
## License

NUnit is Open Source software and NUnit 3 is released under the [MIT license](https://github.com/nunit/docs/wiki/License). Earlier releases used the [NUnit license](http://www.nunit.org/nuget/license.html). Both of these licenses allow the use of NUnit in free and commercial applications and libraries without restrictions.

## NUnit Projects ##
## NUnit Projects

NUnit is made up of several projects. When reporting issues, please try to report issues in the correct project.

### Core Projects ###
### Core Projects

- [NUnit Test Framework](https://github.com/nunit/nunit) - The test framework used to write NUnit tests
- [NUnit Console and Engine](https://github.com/nunit/nunit-console) - Runs unit tests from the command line and provides the engine that is used by other test runners to run NUnit tests

### Visual Studio Extensions ###
### Visual Studio Extensions

- [NUnit 3 Visual Studio Adapter](https://github.com/nunit/nunit3-vs-adapter) - Visual Studio adapter for running NUnit 3 tests in Visual Studio and in VSTS/TFS builds
- [NUnit Visual Studio Templates](https://github.com/nunit/nunit-vs-templates) - Project templates and snippets for writing unit tests in Visual Studio
- [Visual Studio Test Generator](https://github.com/nunit/nunit-vs-testgenerator) - Generates NUnit tests in Visual Studio
- [NUnit 2 Visual Studio Adapter](https://github.com/nunit/nunit-vs-adapter) - Visual Studio adapter for running older NUnit 2.x tests in Visual Studio and in VSTS/TFS builds

### Other Projects ###
### Other Projects

- [NUnit Xamarin Runner](https://github.com/nunit/nunit.xamarin) - Runs NUnit 3 tests on mobile devices using the Xamarin framework

### NUnit Engine Extensions ###
### NUnit Engine Extensions

- [NUnit 2 Driver](https://github.com/nunit/nunit-v2-framework-driver) - Allows the NUnit 3 engine to run NUnit 2 tests
- [NUnit 2 Result Writer](https://github.com/nunit/nunit-v2-result-writer) - Writes test results in the legacy NUnit 2 format
Expand Down
125 changes: 2 additions & 123 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Load the recipe
#load nuget:?package=NUnit.Cake.Recipe&version=1.2.1-dev00002
#load nuget:?package=NUnit.Cake.Recipe&version=1.3.0-alpha.1
// Comment out above line and uncomment below for local tests of recipe changes
//#load ../NUnit.Cake.Recipe/recipe/*.cake

Expand Down Expand Up @@ -92,7 +92,7 @@ BuildSettings.Packages.AddRange(new PackageDefinition[] {
checks: new PackageCheck[]
{
HasFiles("nunit.exe"),
HasSomeDirectory(".store/nunit.consolerunner.netcore/**/tools/net8.0/any")
HasDirectory(".store/nunit.consolerunner.netcore/**/tools/net8.0/any")
.WithFiles(ENGINE_FILES).AndFiles(ConsoleFiles).AndFile("Microsoft.Extensions.DependencyModel.dll")
},
testRunner: new ConsoleRunnerSelfTester(BuildSettings.NuGetTestDirectory
Expand Down Expand Up @@ -205,68 +205,6 @@ Task("TestNetCorePackage")
NUnitConsoleRunnerNetCorePackage.RunPackageTests();
});

// Adhoc code to check content of a dotnet standalone executable
// TODO: Incorporate this in the recipe itself

private static ExtendedDirectoryCheck HasSomeDirectory(string pattern) => new ExtendedDirectoryCheck(pattern);

public class ExtendedDirectoryCheck : PackageCheck
{
private string _directoryPattern;
private List<FilePath> _files = new List<FilePath>();

public ExtendedDirectoryCheck(string directoryPattern)
{
// Assume it has no wildcard - checked in ApplyTo method
_directoryPattern = directoryPattern;
}

public ExtendedDirectoryCheck WithFiles(params FilePath[] files)
{
_files.AddRange(files);
return this;
}

public ExtendedDirectoryCheck AndFiles(params FilePath[] files)
{
return WithFiles(files);
}

public ExtendedDirectoryCheck WithFile(FilePath file)
{
_files.Add(file);
return this;
}

public ExtendedDirectoryCheck AndFile(FilePath file)
{
return AndFiles(file);
}

public override bool ApplyTo(DirectoryPath testDirPath)
{
if (_directoryPattern.Contains('*') || _directoryPattern.Contains('?')) // Wildcard
{
var absDirPattern = testDirPath.Combine(_directoryPattern).ToString();
foreach (var dir in _context.GetDirectories(absDirPattern))
{
// Use first one found
return CheckFilesExist(_files.Select(file => dir.CombineWithFilePath(file)));
}
}
else // No wildcard
{
var absDirPath = testDirPath.Combine(_directoryPattern);
if (!CheckDirectoryExists(absDirPath))
return false;

return CheckFilesExist(_files.Select(file => absDirPath.CombineWithFilePath(file)));
}

return false;
}
}

//////////////////////////////////////////////////////////////////////
// TEST RUNNERS
//////////////////////////////////////////////////////////////////////
Expand All @@ -288,65 +226,6 @@ public class ConsoleRunnerSelfTester : TestRunner, IPackageTestRunner
}
}

//////////////////////////////////////////////////////////////////////
// ADDITIONAL TARGETS USED FOR RECOVERY AND DEBUGGING
//////////////////////////////////////////////////////////////////////

// Some of these targets may be moved into the recipe itself in the future.

// When a NuGet package was published successfully but the corresponding symbols
// package failed, use this target locally after correcting the error.
// TODO: This task is extemely complicated because it has to copy lots of code
// from the recipe. It would be simpler if it were integrated in the recipe.
// TODO: This has been tested on NUnit.ConsoleRunner, so the branches with either
// zero or one packages are speculative at this point. They will need testing
// if this is incorporated into the recipe.
Task("PublishSymbolsPackage")
.Description("Re-publish a specific symbols package to NuGet after a failure")
.Does(() =>
{
if (!BuildSettings.ShouldPublishToNuGet)
Information("Nothing to publish to NuGet from this run.");
else if (CommandLineOptions.NoPush)
Information("NoPush option suppressing publication to NuGet");
else
{
List<PackageDefinition> packages;

if (BuildSettings.Packages.Count == 0)
throw new Exception("No packages exist!");
else if (BuildSettings.Packages.Count == 1)
{
if (BuildSettings.Packages[0].PackageType != PackageType.NuGet)
throw new Exception("The only package is not a NuGet package");

packages = BuildSettings.Packages;
}
else // count is > 1
{
if (!CommandLineOptions.PackageSelector.Exists)
throw new Exception("Multiple packages exist. Specify a nuget package id using the '--where' option");

packages = new List<PackageDefinition>();

foreach (var package in BuildSettings.Packages)
if (package.IsSelectedBy(CommandLineOptions.PackageSelector.Value))
packages.Add(package);

if (packages.Count > 1)
throw new Exception("The '--where' option selected multiple packages");

if (packages[0].PackageType != PackageType.NuGet)
throw new Exception("The selected package is a {package.PackageType} package. It must be a package for nuget.org.");
}

// At this point we have a single NuGet package in packages
var packageName = $"{packages[0].PackageId}.{BuildSettings.PackageVersion}.snupkg";
var packagePath = BuildSettings.PackageDirectory + packageName;
NuGetPush(packagePath, new NuGetPushSettings() { ApiKey = BuildSettings.NuGetApiKey, Source = BuildSettings.NuGetPushUrl });
}
});

//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 9f43d4e

Please sign in to comment.