From 7dd3100186c04443f50fb52fa86801ff872c96b7 Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Tue, 10 Sep 2024 07:40:19 +0300 Subject: [PATCH] Upgrade to NUKE 8.1 --- .github/workflows/build.yml | 12 +-- .github/workflows/pr.yml | 12 ++- .nuke/build.schema.json | 138 ++++++++++++++++---------------- build/Build.CI.GitHubActions.cs | 29 ++++--- build/_build.csproj | 2 +- 5 files changed, 99 insertions(+), 94 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 633ae5581..f062ef79d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,9 +33,9 @@ jobs: name: windows-latest runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: 'Cache: .nuke/temp, ~/.nuget/packages' - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | .nuke/temp @@ -47,7 +47,7 @@ jobs: NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }} - name: 'Publish: artifacts' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: artifacts path: artifacts @@ -55,9 +55,9 @@ jobs: name: ubuntu-latest runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: 'Cache: .nuke/temp, ~/.nuget/packages' - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | .nuke/temp @@ -69,7 +69,7 @@ jobs: NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }} - name: 'Publish: artifacts' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: artifacts path: artifacts diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2ae90d48c..8e993f88d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -25,14 +25,18 @@ on: - '**/*.*' - '!**/*.md' +concurrency: + group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: windows-latest: name: windows-latest runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: 'Cache: .nuke/temp, ~/.nuget/packages' - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | .nuke/temp @@ -44,9 +48,9 @@ jobs: name: ubuntu-latest runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: 'Cache: .nuke/temp, ~/.nuget/packages' - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | .nuke/temp diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 77854d44e..3dbabb0ae 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -1,19 +1,71 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "#/definitions/build", - "title": "Build Schema", + "properties": { + "Configuration": { + "type": "string", + "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", + "enum": [ + "Debug", + "Release" + ] + }, + "MyGetApiKey": { + "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" + } + }, "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", + "Pack", + "Publish", + "Restore", + "Test" + ] + }, + "Verbosity": { + "type": "string", + "description": "", + "enum": [ + "Verbose", + "Normal", + "Minimal", + "Quiet" + ] + }, + "NukeBuild": { "properties": { - "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" @@ -23,38 +75,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" }, - "NuGetApiKey": { - "type": "string", - "default": "Secrets must be entered via 'nuke :secrets [profile]'" - }, "Partition": { "type": "string", "description": "Partition to use on CI" @@ -78,47 +105,22 @@ "type": "array", "description": "List of targets to be skipped. Empty list skips all dependencies", "items": { - "type": "string", - "enum": [ - "Clean", - "Compile", - "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", - "Pack", - "Publish", - "Restore", - "Test" - ] + "$ref": "#/definitions/ExecutableTarget" } }, "Verbosity": { - "type": "string", "description": "Logging verbosity during build execution. Default is 'Normal'", - "enum": [ - "Minimal", - "Normal", - "Quiet", - "Verbose" - ] + "$ref": "#/definitions/Verbosity" } } } - } + }, + "$ref": "#/definitions/NukeBuild" } diff --git a/build/Build.CI.GitHubActions.cs b/build/Build.CI.GitHubActions.cs index f654bbc73..8591806a3 100644 --- a/build/Build.CI.GitHubActions.cs +++ b/build/Build.CI.GitHubActions.cs @@ -4,26 +4,25 @@ "pr", GitHubActionsImage.WindowsLatest, GitHubActionsImage.UbuntuLatest, - OnPullRequestBranches = new[] { "master", "main" }, - OnPullRequestIncludePaths = new[] { "**/*.*" }, - OnPullRequestExcludePaths = new[] { "**/*.md" }, + OnPullRequestBranches = ["master", "main"], + OnPullRequestIncludePaths = ["**/*.*"], + OnPullRequestExcludePaths = ["**/*.md"], PublishArtifacts = false, - InvokedTargets = new[] { nameof(Compile), nameof(Test), nameof(Pack) }, - CacheKeyFiles = new[] { "global.json", "src/**/*.csproj", "src/**/package.json" }), + InvokedTargets = [nameof(Compile), nameof(Test), nameof(Pack)], + CacheKeyFiles = ["global.json", "src/**/*.csproj", "src/**/package.json"], + ConcurrencyCancelInProgress = true) ] [GitHubActions( "build", GitHubActionsImage.WindowsLatest, GitHubActionsImage.UbuntuLatest, - OnPushBranches = new[] { "master", "main" }, - OnPushTags = new[] { "v*.*.*", "v*.*.*-*" }, - OnPushIncludePaths = new[] { "**/*.*" }, - OnPushExcludePaths = new[] { "**/*.md" }, + OnPushBranches = ["master", "main"], + OnPushTags = ["v*.*.*", "v*.*.*-*"], + OnPushIncludePaths = ["**/*.*"], + OnPushExcludePaths = ["**/*.md"], PublishArtifacts = true, - InvokedTargets = new[] { nameof(Compile), nameof(Test), nameof(Pack), nameof(Publish) }, - ImportSecrets = new [] { "NUGET_API_KEY", "MYGET_API_KEY" }, - CacheKeyFiles = new[] { "global.json", "src/**/*.csproj", "src/**/package.json" }) + InvokedTargets = [nameof(Compile), nameof(Test), nameof(Pack), nameof(Publish)], + ImportSecrets = ["NUGET_API_KEY", "MYGET_API_KEY"], + CacheKeyFiles = ["global.json", "src/**/*.csproj", "src/**/package.json"]) ] -public partial class Build -{ -} +public partial class Build; diff --git a/build/_build.csproj b/build/_build.csproj index 4fc772810..74ef7d34c 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -21,7 +21,7 @@ - +