diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 37dead028a..ef4ff325e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: @@ -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 @@ -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: @@ -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: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index e0c1805f53..40647ecefe 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -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 @@ -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: @@ -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 diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 57501ad2b6..4aecb4ebff 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -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" @@ -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" @@ -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" } - } + ] } diff --git a/build/Build.CI.GitHubActions.cs b/build/Build.CI.GitHubActions.cs index bbf5ea69d1..e1e980906c 100644 --- a/build/Build.CI.GitHubActions.cs +++ b/build/Build.CI.GitHubActions.cs @@ -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", @@ -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 { @@ -49,7 +47,7 @@ protected override GitHubActionsJob GetJobs(GitHubActionsImage image, IReadOnlyC var newSteps = new List(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) diff --git a/build/Build.Pack.cs b/build/Build.Pack.cs index 7a0b4e0d76..4c1a971553 100644 --- a/build/Build.Pack.cs +++ b/build/Build.Pack.cs @@ -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; @@ -115,7 +114,7 @@ public partial class Build foreach (var artifact in artifacts) { - CopyFileToDirectory(artifact, ArtifactsDirectory); + artifact.CopyToDirectory(ArtifactsDirectory); } // patch npm version @@ -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); }); } diff --git a/build/Build.cs b/build/Build.cs index 7e42cbdb7c..9d94c7b99e 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -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; @@ -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) diff --git a/build/_build.csproj b/build/_build.csproj index feca84c4f1..8762b669da 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -16,12 +16,12 @@ - + - - + +