Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 35 additions & 78 deletions .github/workflows/BuildAndPack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
141 changes: 72 additions & 69 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
}
}
}
}
}
},
"$ref": "#/definitions/NukeBuild"
}
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project>
<PropertyGroup>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<NuGetAudit>false</NuGetAudit>
</PropertyGroup>

<ItemGroup>
Expand Down
25 changes: 6 additions & 19 deletions build/Build.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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:
Expand All @@ -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 => _ => _
Expand Down
7 changes: 5 additions & 2 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
Expand All @@ -11,7 +11,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="5.3.0" />
<PackageReference Include="Nuke.Common" Version="8.1.1" />
<!-- Ensure we don't use vulnerable packages -->
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

</Project>
Loading
Loading