diff --git a/.github/workflows/BuildAndPack.yml b/.github/workflows/BuildAndPack.yml index 01dcfad..d425ab8 100644 --- a/.github/workflows/BuildAndPack.yml +++ b/.github/workflows/BuildAndPack.yml @@ -28,96 +28,53 @@ on: - '*' jobs: - ubuntu-latest: - name: ubuntu-latest - runs-on: ubuntu-latest + build-and-test: + strategy: + matrix: + include: + - os: windows + vm: windows-latest + - os: linux + vm: ubuntu-latest + - os: macos + vm: macos-15-intel + env: + MSBuildEnableWorkloadResolver: false + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: "true" + name: ${{ matrix.os}} + runs-on: ${{ matrix.vm}} steps: - - uses: actions/checkout@v1 - - uses: actions/setup-dotnet@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 with: dotnet-version: | - 2.1.x - 3.1.x - 5.0.x - 6.0.x - 7.0.x + 10.0.x + 9.0.x 8.0.x - - name: Cache .nuke/temp, ~/.nuget/packages - uses: actions/cache@v2 - with: - path: | - .nuke/temp - ~/.nuget/packages - key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }} - - name: Run './build.cmd Clean Test PushToNuGet' - run: ./build.cmd Clean Test PushToNuGet - env: - GithubToken: ${{ secrets.GITHUB_TOKEN }} - NuGetToken: ${{ secrets.NUGET_TOKEN }} - MSBuildEnableWorkloadResolver: false - - uses: actions/upload-artifact@v1 - with: - name: artifacts - path: artifacts - windows-latest: - name: windows-latest - runs-on: windows-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: | - 2.1.x - 3.1.x - 5.0.x - 6.0.x 7.0.x - 8.0.x - - name: Cache .nuke/temp, ~/.nuget/packages - uses: actions/cache@v2 - with: - path: | - .nuke/temp - ~/.nuget/packages - key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }} - - name: Run './build.cmd Clean Test PushToNuGet' - run: ./build.cmd Clean Test PushToNuGet - env: - GithubToken: ${{ secrets.GITHUB_TOKEN }} - NuGetToken: ${{ secrets.NUGET_TOKEN }} - MSBuildEnableWorkloadResolver: false - - uses: actions/upload-artifact@v1 - with: - name: artifacts - path: artifacts - macOS-latest: - name: macOS-latest - runs-on: macOS-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: | - 2.1.x - 3.1.x - 5.0.x 6.0.x - 7.0.x - 8.0.x + 3.1.x + 2.1.x + + # - run: dotnet new globaljson --sdk-version "8.0.402" --force - name: Cache .nuke/temp, ~/.nuget/packages - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | .nuke/temp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }} - - name: Run './build.cmd Clean Test PushToNuGet' + + - name: Run './build.cmd Clean Test PushToNuGet run: ./build.cmd Clean Test PushToNuGet env: - GithubToken: ${{ secrets.GITHUB_TOKEN }} - NuGetToken: ${{ secrets.NUGET_TOKEN }} - MSBuildEnableWorkloadResolver: false - - uses: actions/upload-artifact@v1 + NuGetToken: ${{ secrets.NUGET_TOKEN || 'NOT_SET'}} + + - uses: actions/upload-artifact@v4 + with: + name: packages-${{ matrix.os}} + path: artifacts/packages + - uses: actions/upload-artifact@v4 with: - name: artifacts - path: artifacts + name: results-${{ matrix.os}} + path: artifacts/results diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 443ac1e..e3a0f6d 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -1,60 +1,88 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Build Schema", - "$ref": "#/definitions/build", + "properties": { + "Configuration": { + "type": "string", + "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", + "enum": [ + "Debug", + "Release" + ] + }, + "GithubToken": { + "type": "string" + }, + "NuGetToken": { + "type": "string" + }, + "PackagesDirectory": { + "type": "string" + }, + "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", + "PushToNuGet", + "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" }, - "GithubToken": { - "type": "string" - }, "Help": { "type": "boolean", "description": "Shows the help text for this build assembly" }, "Host": { - "type": "string", "description": "Host for execution. Default is 'automatic'", - "enum": [ - "AppVeyor", - "AzurePipelines", - "Bamboo", - "Bitrise", - "GitHubActions", - "GitLab", - "Jenkins", - "Rider", - "SpaceAutomation", - "TeamCity", - "Terminal", - "TravisCI", - "VisualStudio", - "VSCode" - ] + "$ref": "#/definitions/Host" }, "NoLogo": { "type": "boolean", "description": "Disables displaying the NUKE logo" }, - "NuGetToken": { - "type": "string" - }, - "PackagesDirectory": { - "type": "string" - }, "Partition": { "type": "string", "description": "Partition to use on CI" @@ -78,47 +106,22 @@ "type": "array", "description": "List of targets to be skipped. Empty list skips all dependencies", "items": { - "type": "string", - "enum": [ - "Clean", - "Compile", - "Pack", - "PushToNuGet", - "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", - "PushToNuGet", - "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" } } } - } -} \ No newline at end of file + }, + "$ref": "#/definitions/NukeBuild" +} diff --git a/Directory.Build.props b/Directory.Build.props index 6b3f0dc..788bdee 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,7 @@ false + false diff --git a/build/Build.cs b/build/Build.cs index d086f6e..33b0cfd 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -1,7 +1,6 @@ using Nuke.Common; using Nuke.Common.CI; using Nuke.Common.CI.GitHubActions; -using Nuke.Common.Execution; using Nuke.Common.IO; using Nuke.Common.ProjectModel; using Nuke.Common.Tooling; @@ -11,20 +10,7 @@ using static Nuke.Common.IO.FileSystemTasks; using static Nuke.Common.Tools.DotNet.DotNetTasks; -[CheckBuildProjectConfigurations] [ShutdownDotNetAfterServerBuild] -[GitHubActions("BuildAndPack", - GitHubActionsImage.UbuntuLatest, - GitHubActionsImage.WindowsLatest, - GitHubActionsImage.MacOsLatest, - ImportGitHubTokenAs = nameof(GithubToken), - OnPushTags = new [] {"*"}, - OnPushBranches = new[] {"master", "main"}, - OnPullRequestBranches = new[] {"*"}, - AutoGenerate = false, - ImportSecrets = new[] {nameof(NuGetToken)}, - InvokedTargets = new[] {nameof(Clean), nameof(Test), nameof(PushToNuGet)} -)] class Build : NukeBuild { /// Support plugins are available for: @@ -49,19 +35,20 @@ class Build : NukeBuild [Parameter] readonly AbsolutePath PackagesDirectory = RootDirectory / "packages"; const string NugetOrgUrl = "https://api.nuget.org/v3/index.json"; - bool IsTag => GitHubActions.Instance?.GitHubRef?.StartsWith("refs/tags/") ?? false; + bool IsTag => GitHubActions.Instance?.Ref?.StartsWith("refs/tags/") ?? false; Target Clean => _ => _ .Before(Restore) .Executes(() => { - SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); - TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); + SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.CreateOrCleanDirectory()); + TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.CreateOrCleanDirectory()); if (!string.IsNullOrEmpty(PackagesDirectory)) { - EnsureCleanDirectory(PackagesDirectory); + PackagesDirectory.CreateOrCleanDirectory(); } - EnsureCleanDirectory(ArtifactsDirectory); + + ArtifactsDirectory.CreateOrCleanDirectory(); }); Target Restore => _ => _ diff --git a/build/_build.csproj b/build/_build.csproj index efbd890..dbf1f61 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 CS0649;CS0169 .. @@ -11,7 +11,10 @@ - + + + + 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 diff --git a/sample/WebDemoProject2_0/WebDemoProject2_0.csproj b/sample/WebDemoProject2_0/WebDemoProject2_0.csproj index f828056..84dcaab 100644 --- a/sample/WebDemoProject2_0/WebDemoProject2_0.csproj +++ b/sample/WebDemoProject2_0/WebDemoProject2_0.csproj @@ -21,7 +21,6 @@ - diff --git a/test/NetEscapades.Configuration.KubeSecrets.Tests/NetEscapades.Configuration.KubeSecrets.Tests.csproj b/test/NetEscapades.Configuration.KubeSecrets.Tests/NetEscapades.Configuration.KubeSecrets.Tests.csproj index 5316ede..24bdd6c 100644 --- a/test/NetEscapades.Configuration.KubeSecrets.Tests/NetEscapades.Configuration.KubeSecrets.Tests.csproj +++ b/test/NetEscapades.Configuration.KubeSecrets.Tests/NetEscapades.Configuration.KubeSecrets.Tests.csproj @@ -1,8 +1,8 @@  - netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 - net461;$(TargetFrameworks) + net6.0;net7.0;net8.0;net9.0;net10.0 + net48;netcoreapp2.1;netcoreapp3.1;$(TargetFrameworks) false @@ -13,7 +13,7 @@ - + diff --git a/test/NetEscapades.Configuration.Remote.Tests/NetEscapades.Configuration.Remote.Tests.csproj b/test/NetEscapades.Configuration.Remote.Tests/NetEscapades.Configuration.Remote.Tests.csproj index 73e06b9..244911f 100644 --- a/test/NetEscapades.Configuration.Remote.Tests/NetEscapades.Configuration.Remote.Tests.csproj +++ b/test/NetEscapades.Configuration.Remote.Tests/NetEscapades.Configuration.Remote.Tests.csproj @@ -2,8 +2,9 @@ - netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 - net461;$(TargetFrameworks) + + net6.0;net7.0;net8.0;net9.0;net10.0 + net48;netcoreapp3.1;$(TargetFrameworks) NetEscapades.Configuration.Remote.Tests NetEscapades.Configuration.Remote.Tests true @@ -19,7 +20,7 @@ - + diff --git a/test/NetEscapades.Configuration.Validation.Tests/NetEscapades.Configuration.Validation.Tests.csproj b/test/NetEscapades.Configuration.Validation.Tests/NetEscapades.Configuration.Validation.Tests.csproj index a97b6db..4dbf17f 100644 --- a/test/NetEscapades.Configuration.Validation.Tests/NetEscapades.Configuration.Validation.Tests.csproj +++ b/test/NetEscapades.Configuration.Validation.Tests/NetEscapades.Configuration.Validation.Tests.csproj @@ -1,52 +1,54 @@  - - netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 - net461;$(TargetFrameworks) - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + net6.0;net7.0;net8.0 + net48;netcoreapp3.1;$(TargetFrameworks) + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/NetEscapades.Configuration.Vault.Tests/NetEscapades.Configuration.Vault.Tests.csproj b/test/NetEscapades.Configuration.Vault.Tests/NetEscapades.Configuration.Vault.Tests.csproj index 002c88d..431cf96 100644 --- a/test/NetEscapades.Configuration.Vault.Tests/NetEscapades.Configuration.Vault.Tests.csproj +++ b/test/NetEscapades.Configuration.Vault.Tests/NetEscapades.Configuration.Vault.Tests.csproj @@ -1,8 +1,9 @@  - netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 - net461;$(TargetFrameworks) + + net6.0;net7.0;net8.0;net9.0;net10.0 + net48;netcoreapp3.1;$(TargetFrameworks) false @@ -19,7 +20,7 @@ - + diff --git a/test/NetEscapades.Configuration.Yaml.Tests/NetEscapades.Configuration.Yaml.Tests.csproj b/test/NetEscapades.Configuration.Yaml.Tests/NetEscapades.Configuration.Yaml.Tests.csproj index 34ee09d..b659359 100644 --- a/test/NetEscapades.Configuration.Yaml.Tests/NetEscapades.Configuration.Yaml.Tests.csproj +++ b/test/NetEscapades.Configuration.Yaml.Tests/NetEscapades.Configuration.Yaml.Tests.csproj @@ -1,8 +1,9 @@  - netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 - net461;$(TargetFrameworks) + + net6.0;net7.0;net8.0;net9.0;net10.0 + net48;netcoreapp3.1;$(TargetFrameworks) true NetEscapades.Configuration.Yaml.Tests NetEscapades.Configuration.Yaml.Tests @@ -35,4 +36,12 @@ + + + + + + + +