From 31ca6798cb87400a42aa4c24592641380e25c4db Mon Sep 17 00:00:00 2001 From: Sandro Figo Date: Wed, 18 Dec 2024 07:46:29 +0100 Subject: [PATCH 1/5] Update nuke to latest version --- build.ps1 | 17 +++++++++++------ build.sh | 13 +++++++++---- build/_build.csproj | 4 ++-- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/build.ps1 b/build.ps1 index bbaa118..4634dc0 100755 --- a/build.ps1 +++ b/build.ps1 @@ -18,11 +18,10 @@ $TempDirectory = "$PSScriptRoot\\.nuke\temp" $DotNetGlobalFile = "$PSScriptRoot\\global.json" $DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1" -$DotNetChannel = "Current" +$DotNetChannel = "STS" -$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1 $env:DOTNET_CLI_TELEMETRY_OPTOUT = 1 -$env:DOTNET_MULTILEVEL_LOOKUP = 0 +$env:DOTNET_NOLOGO = 1 ########################################################################### # EXECUTION @@ -56,14 +55,20 @@ else { # Install by channel or version $DotNetDirectory = "$TempDirectory\dotnet-win" if (!(Test-Path variable:DotNetVersion)) { - ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath } + ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath } } else { - ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath } + ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath } } $env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe" + $env:PATH = "$DotNetDirectory;$env:PATH" } -Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)" +Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)" + +if (Test-Path env:NUKE_ENTERPRISE_TOKEN) { + & $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null + & $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null +} ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet } ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments } diff --git a/build.sh b/build.sh index e8961f9..fdff0c6 100755 --- a/build.sh +++ b/build.sh @@ -14,11 +14,10 @@ TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp" DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json" DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh" -DOTNET_CHANNEL="Current" +DOTNET_CHANNEL="STS" export DOTNET_CLI_TELEMETRY_OPTOUT=1 -export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -export DOTNET_MULTILEVEL_LOOKUP=0 +export DOTNET_NOLOGO=1 ########################################################################### # EXECUTION @@ -54,9 +53,15 @@ else "$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path fi export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet" + export PATH="$DOTNET_DIRECTORY:$PATH" fi -echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)" +echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)" + +if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then + "$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true + "$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true +fi "$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet "$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@" diff --git a/build/_build.csproj b/build/_build.csproj index 0fbf3a9..470dae5 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 CS0649;CS0169 .. @@ -12,7 +12,7 @@ - + From a6c233ab623bec623d8bb436a8e036d78f6c4548 Mon Sep 17 00:00:00 2001 From: Sandro Figo Date: Wed, 18 Dec 2024 07:52:13 +0100 Subject: [PATCH 2/5] Set target framework of unit test project to net8.0 --- VoxReader.UnitTests/VoxReader.UnitTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VoxReader.UnitTests/VoxReader.UnitTests.csproj b/VoxReader.UnitTests/VoxReader.UnitTests.csproj index d1420c8..238af61 100644 --- a/VoxReader.UnitTests/VoxReader.UnitTests.csproj +++ b/VoxReader.UnitTests/VoxReader.UnitTests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 false From 6b1ffe272233dd8c7719926ce9cf0d6b84869c06 Mon Sep 17 00:00:00 2001 From: Sandro Figo Date: Wed, 18 Dec 2024 07:52:54 +0100 Subject: [PATCH 3/5] Update DotSettings in build project --- build/_build.csproj.DotSettings | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/_build.csproj.DotSettings b/build/_build.csproj.DotSettings index 7bc2848..0306022 100644 --- a/build/_build.csproj.DotSettings +++ b/build/_build.csproj.DotSettings @@ -16,6 +16,8 @@ False <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy> True True True @@ -24,4 +26,5 @@ True True True - True + True + True From 1436df2f79d261e08472a8e1662cf5eb21fb6c19 Mon Sep 17 00:00:00 2001 From: Sandro Figo Date: Wed, 18 Dec 2024 08:03:03 +0100 Subject: [PATCH 4/5] Clean up Build.cs after nuke update --- build/Build.cs | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/build/Build.cs b/build/Build.cs index 3eee41e..7d731ff 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -1,9 +1,6 @@ using System; using System.IO; -using System.Linq; using Microsoft.AspNetCore.StaticFiles; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using NuGet.Versioning; using Nuke.Common; using Nuke.Common.ChangeLog; @@ -21,23 +18,6 @@ using static Nuke.Common.IO.FileSystemTasks; using static Nuke.Common.IO.PathConstruction; -[GitHubActions( - "build", - GitHubActionsImage.UbuntuLatest, - AutoGenerate = false, - FetchDepth = 0, - OnPushBranches = new[] { "**" }, - InvokedTargets = new[] { nameof(Test) }, - EnableGitHubToken = true)] -[GitHubActions( - "release", - GitHubActionsImage.UbuntuLatest, - AutoGenerate = false, - FetchDepth = 0, - OnPushTags = new[] { "v[0-9]+.[0-9]+.[0-9]+" }, - InvokedTargets = new[] { nameof(PublishGitHubRelease) }, - EnableGitHubToken = true, - ImportSecrets = new[] { nameof(NuGetApiKey) })] class Build : NukeBuild { public static int Main() => Execute(x => x.Pack); @@ -48,7 +28,7 @@ class Build : NukeBuild [Solution(GenerateProjects = true)] readonly Solution Solution; - readonly AbsolutePath PublishDirectory = (AbsolutePath)Path.Combine(RootDirectory, "publish"); + readonly AbsolutePath PublishDirectory = Path.Combine(RootDirectory, "publish"); [GitRepository] readonly GitRepository GitRepository; @@ -86,7 +66,7 @@ class Build : NukeBuild .DependsOn(Validate) .Executes(() => { - EnsureCleanDirectory(PublishDirectory); + PublishDirectory.CreateOrCleanDirectory(); DotNetTasks.DotNetClean(s => s .SetProject(Solution)); }); From 584532596af177c6253606b40efa18dab27bf277 Mon Sep 17 00:00:00 2001 From: Sandro Figo Date: Wed, 18 Dec 2024 08:10:04 +0100 Subject: [PATCH 5/5] Update workflow files --- .github/workflows/release.yml | 22 +++------------------ .github/workflows/{build.yml => test.yml} | 24 ++++------------------- 2 files changed, 7 insertions(+), 39 deletions(-) rename .github/workflows/{build.yml => test.yml} (61%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa4f8d5..c415b11 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,19 +1,3 @@ -# ------------------------------------------------------------------------------ -# -# -# This code was generated. -# -# - To turn off auto-generation set: -# -# [GitHubActions (AutoGenerate = false)] -# -# - To trigger manual generation invoke: -# -# nuke --generate-configuration GitHubActions_release --host GitHubActions -# -# -# ------------------------------------------------------------------------------ - name: release on: @@ -23,15 +7,15 @@ on: jobs: nuke-build: - name: NUKE build + name: Release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Cache .nuke/temp, ~/.nuget/packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | .nuke/temp diff --git a/.github/workflows/build.yml b/.github/workflows/test.yml similarity index 61% rename from .github/workflows/build.yml rename to .github/workflows/test.yml index 1609059..3282bde 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/test.yml @@ -1,20 +1,4 @@ -# ------------------------------------------------------------------------------ -# -# -# This code was generated. -# -# - To turn off auto-generation set: -# -# [GitHubActions (AutoGenerate = false)] -# -# - To trigger manual generation invoke: -# -# nuke --generate-configuration GitHubActions_test --host GitHubActions -# -# -# ------------------------------------------------------------------------------ - -name: build +name: test on: push: @@ -32,15 +16,15 @@ on: jobs: nuke-build: - name: NUKE build + name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Cache .nuke/temp, ~/.nuget/packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | .nuke/temp