Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try push to github package server #4443

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "1.1.0",
"version": "2.1.0",
"commands": [
"dotnet-cake"
]
Expand All @@ -15,4 +15,4 @@
]
}
}
}
}
55 changes: 18 additions & 37 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,27 @@ jobs:
steps:
- name: ⤵️ Checkout Source
uses: actions/checkout@v3

- name: 🛠️ Setup .NET Core SDK 3.1.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'

- name: 🛠️ Setup .NET Core SDK 6.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
fetch-depth: 0 # Needed to gets tags until https://github.com/actions/checkout/issues/701 is fixed

- name: 🛠️ Setup .NET Core SDK 7.0.x
- name: 🛠️ Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
dotnet-version: |
6.0.x
7.0.x

- name: 🛠️ Install dotnet tools
run: dotnet tool restore

- name: 🔨 Build and Test
run: dotnet cake --target=Test --test-run-name=Windows --configuration=Release
run: dotnet cake --target=Test --test-run-name=Windows --configuration=Release --tag="$(git describe)"

- name: 📦 Package
run: dotnet cake --target=Package
run: dotnet cake --target=Package --configuration=Release --tag="$(git describe)"

- name: 📦 Publish package
run: dotnet nuget push --skip-duplicate --source https://nuget.pkg.github.com/nunit/index.json --api-key "${{secrets.GITHUB_TOKEN}}" 'package\*.nupkg'

- name: 💾 Upload build artifacts
uses: actions/upload-artifact@v2
Expand All @@ -63,20 +60,12 @@ jobs:
- name: ⤵️ Checkout Source
uses: actions/checkout@v3

- name: 🛠️ Setup .NET Core SDK 3.1.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'

- name: 🛠️ Setup .NET Core SDK 6.0.x
- name: 🛠️ Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: 🛠️ Setup .NET Core SDK 7.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
dotnet-version: |
6.0.x
7.0.x

- name: 🛠️ Install F#
run: sudo apt-get install fsharp
Expand All @@ -103,20 +92,12 @@ jobs:
- name: ⤵️ Checkout Source
uses: actions/checkout@v3

- name: 🛠️ Setup .NET Core SDK 3.1.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'

- name: 🛠️ Setup .NET Core SDK 6.0.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: 🛠️ Setup .NET Core SDK 7.0.x
- name: 🛠️ Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
dotnet-version: |
6.0.x
7.0.x

- name: 🛠️ Install dotnet tools
run: dotnet tool restore
Expand Down
19 changes: 0 additions & 19 deletions appveyor.yml

This file was deleted.

78 changes: 23 additions & 55 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#tool NUnit.ConsoleRunner&version=3.12.0

//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////

var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var branch = Argument("branch", "unknown");
var tag = Argument("tag", "4.0.0-alpha-dev");

//////////////////////////////////////////////////////////////////////
// SET ERROR LEVELS
Expand All @@ -17,11 +17,8 @@ var ErrorDetail = new List<string>();
// SET PACKAGE VERSION
//////////////////////////////////////////////////////////////////////

var version = "4.0.0";
var modifier = "-alpha-1";

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

//////////////////////////////////////////////////////////////////////
// DEFINE RUN CONSTANTS
Expand Down Expand Up @@ -72,44 +69,12 @@ var NetFrameworkTestRuntime = RuntimeFrameworks.Except(NetCoreTestRuntimes).Sing

Setup(context =>
{
if (BuildSystem.IsRunningOnAppVeyor)
if (BuildSystem.IsRunningOnGitHubActions)
{
var tag = AppVeyor.Environment.Repository.Tag;

if (tag.IsTag)
if (BuildSystem.IsPullRequest)
{
packageVersion = tag.Name;
packageVersion = tag + "-pr-" + branch;
}
else
{
var buildNumber = AppVeyor.Environment.Build.Number.ToString("00000");
var branch = AppVeyor.Environment.Repository.Branch;
var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;

if (branch == "master" && !isPullRequest)
{
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 += "-" + System.Text.RegularExpressions.Regex.Replace(branch, "[^0-9A-Za-z-]+", "-");

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

packageVersion = version + suffix;
}
}

AppVeyor.UpdateBuildVersion(packageVersion);
}

Information("Building {0} version {1} of NUnit.", configuration, packageVersion);
Expand Down Expand Up @@ -137,7 +102,7 @@ Task("NuGetRestore")
.Description("Restores NuGet Packages")
.Does(() =>
{
DotNetCoreRestore(SOLUTION_FILE);
DotNetRestore(SOLUTION_FILE);
});

//////////////////////////////////////////////////////////////////////
Expand All @@ -149,15 +114,19 @@ Task("Build")
.IsDependentOn("NuGetRestore")
.Does(() =>
{
DotNetCoreBuild(SOLUTION_FILE, CreateDotNetCoreBuildSettings());
DotNetBuild(SOLUTION_FILE, CreateDotNetBuildSettings());
});

DotNetCoreBuildSettings CreateDotNetCoreBuildSettings() =>
new DotNetCoreBuildSettings
DotNetBuildSettings CreateDotNetBuildSettings() =>
new DotNetBuildSettings
{
Configuration = configuration,
NoRestore = true,
Verbosity = DotNetCoreVerbosity.Minimal
Verbosity = DotNetVerbosity.Minimal,
MSBuildSettings = new DotNetMSBuildSettings
{
Version = packageVersion
}
};

//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -229,7 +198,7 @@ var RootFiles = new FilePath[]
// Not all of these are present in every framework
// The Microsoft and System assemblies are part of the BCL
// used by the .NET 4.0 framework. 4.0 tests will not run without them.
var FrameworkFiles = new FilePath[]
var FrameworkFiles = new String[]
{
"mock-assembly.dll",
"mock-assembly.exe",
Expand Down Expand Up @@ -270,7 +239,7 @@ Task("CreateImage")
var imageBinDir = CurrentImageDir + "bin/";

CreateDirectory(imageBinDir);
Information("Created imagedirectory at:" + imageBinDir);
Information("Created imagedirectory at: " + imageBinDir);
var directories = new String[]
{
NUNITFRAMEWORKBIN,
Expand All @@ -281,11 +250,11 @@ Task("CreateImage")
{
foreach (var runtime in LibraryFrameworks)
{
var targetDir = imageBinDir + Directory(runtime);
var sourceDir = dir + Directory(runtime);
var targetDir = imageBinDir + runtime;
var sourceDir = dir + runtime;
CreateDirectory(targetDir);
Information("Created directory " + targetDir);
foreach (FilePath file in FrameworkFiles)
foreach (var file in FrameworkFiles)
{
var sourcePath = sourceDir + "/" + file;
if (FileExists(sourcePath))
Expand All @@ -300,8 +269,8 @@ Task("CreateImage")

foreach (var dir in RuntimeFrameworks)
{
var targetDir = imageBinDir + Directory(dir);
var sourceDir = NUNITLITERUNNERBIN + Directory(dir);
var targetDir = imageBinDir + dir;
var sourceDir = NUNITLITERUNNERBIN + dir;
Information("Copying " + sourceDir + " to " + targetDir);
CopyDirectory(sourceDir, targetDir);
}
Expand All @@ -320,8 +289,7 @@ Task("PackageFramework")
BasePath = CurrentImageDir,
OutputDirectory = PACKAGE_DIR,
Symbols = true,
// snupkg is not yet supported by Cake, https://github.com/cake-build/cake/issues/2362
ArgumentCustomization = args => args.Append("-SymbolPackageFormat snupkg")
SymbolPackageFormat = "snupkg"
};

NuGetPack("nuget/framework/nunit.nuspec", settings);
Expand Down