Skip to content

Commit

Permalink
Upgrade to NUKE 8.1
Browse files Browse the repository at this point in the history
* add .NET 9 SDK
  • Loading branch information
lahma committed Nov 16, 2024
1 parent 7d6df3a commit 8cfc585
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 109 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
with:
dotnet-version: |
6.0
- uses: actions/checkout@v3
9.0
- uses: actions/checkout@v4
- name: 'Run: Compile, Test, Pack, Publish'
run: ./build.cmd Compile Test Pack Publish
env:
Expand All @@ -53,22 +54,22 @@ jobs:
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: 'Publish: NSwag.zip'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: NSwag.zip
path: artifacts/NSwag.zip
- name: 'Publish: NSwag.Npm.zip'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: NSwag.Npm.zip
path: artifacts/NSwag.Npm.zip
- name: 'Publish: NSwagStudio.msi'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: NSwagStudio.msi
path: artifacts/NSwagStudio.msi
- name: 'Publish: NuGet Packages'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: NuGet Packages
path: artifacts/*.nupkg
Expand All @@ -80,7 +81,8 @@ jobs:
with:
dotnet-version: |
6.0
- uses: actions/checkout@v3
9.0
- uses: actions/checkout@v4
- name: 'Run: Compile, Test, Pack, Publish'
run: ./build.cmd Compile Test Pack Publish
env:
Expand All @@ -96,7 +98,8 @@ jobs:
with:
dotnet-version: |
6.0
- uses: actions/checkout@v3
9.0
- uses: actions/checkout@v4
- name: 'Run: Compile, Test, Pack, Publish'
run: ./build.cmd Compile Test Pack Publish
env:
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,27 @@ jobs:
with:
dotnet-version: |
6.0
- uses: actions/checkout@v3
9.0
- uses: actions/checkout@v4
- name: 'Run: Compile, Test, Pack'
run: ./build.cmd Compile Test Pack
- name: 'Publish: NSwag.zip'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: NSwag.zip
path: artifacts/NSwag.zip
- name: 'Publish: NSwag.Npm.zip'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: NSwag.Npm.zip
path: artifacts/NSwag.Npm.zip
- name: 'Publish: NSwagStudio.msi'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: NSwagStudio.msi
path: artifacts/NSwagStudio.msi
- name: 'Publish: NuGet Packages'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: NuGet Packages
path: artifacts/*.nupkg
Expand All @@ -73,7 +74,8 @@ jobs:
with:
dotnet-version: |
6.0
- uses: actions/checkout@v3
9.0
- uses: actions/checkout@v4
- name: 'Run: Compile, Test, Pack'
run: ./build.cmd Compile Test Pack
macos-latest:
Expand All @@ -84,6 +86,7 @@ jobs:
with:
dotnet-version: |
6.0
- uses: actions/checkout@v3
9.0
- uses: actions/checkout@v4
- name: 'Run: Compile, Test, Pack'
run: ./build.cmd Compile Test Pack
159 changes: 83 additions & 76 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,50 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/build",
"title": "Build Schema",
"definitions": {
"build": {
"type": "object",
"Host": {
"type": "string",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"ExecutableTarget": {
"type": "string",
"enum": [
"Clean",
"Compile",
"InstallDependencies",
"Pack",
"Publish",
"Restore",
"Test"
]
},
"Verbosity": {
"type": "string",
"description": "",
"enum": [
"Verbose",
"Normal",
"Minimal",
"Quiet"
]
},
"NukeBuild": {
"properties": {
"ChocoApiKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
Expand All @@ -27,42 +54,13 @@
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"MyGetApiKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
"$ref": "#/definitions/Host"
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"NpmAuthToken": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"NuGetApiKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
Expand All @@ -86,49 +84,58 @@
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"InstallDependencies",
"Pack",
"Publish",
"Restore",
"Test"
]
"$ref": "#/definitions/ExecutableTarget"
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"InstallDependencies",
"Pack",
"Publish",
"Restore",
"Test"
]
"$ref": "#/definitions/ExecutableTarget"
}
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
"$ref": "#/definitions/Verbosity"
}
}
}
},
"allOf": [
{
"properties": {
"ChocoApiKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
"Debug",
"Release"
]
},
"MyGetApiKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"NpmAuthToken": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"NuGetApiKey": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
}
}
},
{
"$ref": "#/definitions/NukeBuild"
}
}
]
}
12 changes: 5 additions & 7 deletions build/Build.CI.GitHubActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
OnPullRequestExcludePaths = ["**/*.md"],
PublishArtifacts = true,
InvokedTargets = [nameof(Compile), nameof(Test), nameof(Pack)],
CacheKeyFiles = new string[0],
JobConcurrencyCancelInProgress = false),
CacheKeyFiles = [],
ConcurrencyCancelInProgress = false),
]
[CustomGitHubActions(
"build",
Expand All @@ -30,11 +30,9 @@
PublishArtifacts = true,
InvokedTargets = [nameof(Compile), nameof(Test), nameof(Pack), nameof(Publish)],
ImportSecrets = ["NUGET_API_KEY", "MYGET_API_KEY", "CHOCO_API_KEY", "NPM_AUTH_TOKEN"],
CacheKeyFiles = new string[0])
CacheKeyFiles = [])
]
public partial class Build
{
}
public partial class Build;

class CustomGitHubActionsAttribute : GitHubActionsAttribute
{
Expand All @@ -49,7 +47,7 @@ protected override GitHubActionsJob GetJobs(GitHubActionsImage image, IReadOnlyC
var newSteps = new List<GitHubActionsStep>(job.Steps);

// only need to list the ones that are missing from default image
newSteps.Insert(0, new GitHubActionsSetupDotNetStep(["6.0"]));
newSteps.Insert(0, new GitHubActionsSetupDotNetStep(["6.0", "9.0"]));

var onWindows = image.ToString().StartsWith("windows", StringComparison.OrdinalIgnoreCase);
if (onWindows)
Expand Down
5 changes: 2 additions & 3 deletions build/Build.Pack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Nuke.Common.Tools.MSBuild;
using Nuke.Common.Tools.NuGet;

using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.MSBuild.MSBuildTasks;
using static Nuke.Common.Tools.NuGet.NuGetTasks;
Expand Down Expand Up @@ -115,7 +114,7 @@ public partial class Build

foreach (var artifact in artifacts)
{
CopyFileToDirectory(artifact, ArtifactsDirectory);
artifact.CopyToDirectory(ArtifactsDirectory);
}

// patch npm version
Expand All @@ -129,7 +128,7 @@ public partial class Build
ZipFile.CreateFromDirectory(NSwagStudioBinaries, ArtifactsDirectory / "NSwag.zip");

// NSwagStudio.msi
CopyFileToDirectory(ArtifactsDirectory / "bin" / "NSwagStudio.Installer" / Configuration / "NSwagStudio.msi", ArtifactsDirectory);
(ArtifactsDirectory / "bin" / "NSwagStudio.Installer" / Configuration / "NSwagStudio.msi").CopyToDirectory(ArtifactsDirectory);
});
}

11 changes: 5 additions & 6 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using Nuke.Common.Tools.Npm;
using Nuke.Common.Utilities.Collections;

using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.Chocolatey.ChocolateyTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.MSBuild.MSBuildTasks;
Expand Down Expand Up @@ -278,14 +277,14 @@ void CopyConsoleBinaries(AbsolutePath target)
if (IsRunningOnWindows)
{
var consoleX86Directory = ArtifactsDirectory / "publish" / consoleX86Project.Name / configuration;
CopyFileToDirectory(consoleX86Directory / "NSwag.x86.exe", target / "Win");
CopyFileToDirectory(consoleX86Directory / "NSwag.x86.exe.config", target / "Win");
(consoleX86Directory / "NSwag.x86.exe").CopyToDirectory(target / "Win");
(consoleX86Directory / "NSwag.x86.exe.config").CopyToDirectory(target / "Win");

CopyDirectoryRecursively(ArtifactsDirectory / "publish" / consoleProject.Name / configuration, target / "Win", DirectoryExistsPolicy.Merge);
(ArtifactsDirectory / "publish" / consoleProject.Name / configuration).Copy(target / "Win", ExistsPolicy.DirectoryMerge);
}

CopyDirectoryRecursively(ArtifactsDirectory / "publish" / consoleCoreProject.Name / (configuration + "_net6.0"), target / "Net60");
CopyDirectoryRecursively(ArtifactsDirectory / "publish" / consoleCoreProject.Name / (configuration + "_net8.0"), target / "Net80");
(ArtifactsDirectory / "publish" / consoleCoreProject.Name / (configuration + "_net6.0")).Copy(target / "Net60");
(ArtifactsDirectory / "publish" / consoleCoreProject.Name / (configuration + "_net8.0")).Copy(target / "Net80");
}

if (IsRunningOnWindows)
Expand Down
Loading

0 comments on commit 8cfc585

Please sign in to comment.