-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to Cake for build orchestration.
Also: * Switch to artifacts output paths in .NET projects. * Simplify GitHub Actions workflows by moving logic into cathode.cake. * Upload build logs/artifacts from GitHub Actions workflows. * Improve the JetBrains Fleet experience in the repo. Closes #26.
- Loading branch information
Showing
17 changed files
with
200 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"files.exclude": [ | ||
"out", | ||
".idea", | ||
".vs" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,14 @@ jobs: | |
submodules: recursive | ||
- name: Set up .NET | ||
uses: actions/[email protected] | ||
- name: Build project | ||
- name: Run Cake | ||
run: | | ||
dotnet build | ||
./cake | ||
- name: Upload artifacts | ||
if: always() | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ github.workflow }}-${{ github.run_number }}-${{ github.run_attempt }}-${{ matrix.os }}-${{ matrix.cfg }} | ||
path: | | ||
out/log | ||
out/pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | ||
DOTNET_GENERATE_ASPNET_CERTIFICATE: false | ||
DOTNET_NOLOGO: true | ||
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} | ||
jobs: | ||
release: | ||
if: github.repository == 'vezel-dev/zig-toolsets' | ||
|
@@ -23,9 +24,14 @@ jobs: | |
submodules: recursive | ||
- name: Set up .NET | ||
uses: actions/[email protected] | ||
- name: Build project | ||
- name: Run Cake | ||
run: | | ||
dotnet build | ||
- name: Upload NuGet packages | ||
run: | | ||
dotnet nuget push pkg/feed/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_TOKEN }} --skip-duplicate | ||
./cake upload | ||
- name: Upload artifacts | ||
if: always() | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ github.workflow }}-${{ github.run_number }}-${{ github.run_attempt }}-${{ matrix.os }}-${{ matrix.cfg }} | ||
path: | | ||
out/log | ||
out/pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
.vs | ||
/out | ||
*.user | ||
/pkg/cache/*/* | ||
/pkg/feed/*.nupkg | ||
bin | ||
obj | ||
.idea | ||
.vs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
{ | ||
"files.exclude": { | ||
"**/.vs": true, | ||
"pkg/cache/*[!_._]": true, | ||
"pkg/feed/*.nupkg": true, | ||
"**/bin": true, | ||
"**/obj": true | ||
"out": true, | ||
"**/.idea": true, | ||
"**/.vs": true | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
set -eou pipefail | ||
|
||
cd -- "$(dirname -- "$(readlink -e -- "${BASH_SOURCE[0]}")")" | ||
|
||
dotnet tool restore | ||
dotnet cake zig-toolsets.cake -t "${1:-default}" "${@:2}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[Paths] | ||
Addins=out/bld/addins | ||
Cache=out/bld/cache | ||
Tools=out/bld/tools | ||
|
||
[Settings] | ||
SkipVerification=true | ||
EnableScriptCache=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"cake.tool": { | ||
"version": "4.0.0", | ||
"commands": [ | ||
"dotnet-cake" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#nullable enable | ||
|
||
// Arguments | ||
|
||
var target = Argument("t", "default"); | ||
|
||
// Environment | ||
|
||
var nugetToken = EnvironmentVariable("NUGET_TOKEN"); | ||
|
||
// Paths | ||
|
||
var root = Context.Environment.WorkingDirectory; | ||
var zigToolsetsProj = root.CombineWithFilePath("zig-toolsets.proj"); | ||
var @out = root.Combine("out"); | ||
var outLog = @out.Combine("log"); | ||
var outPkg = @out.Combine("pkg"); | ||
|
||
// Globs | ||
|
||
var nugetGlob = new GlobPattern(outPkg.Combine("release").CombineWithFilePath("*.nupkg").FullPath); | ||
|
||
// Utilities | ||
|
||
DotNetMSBuildSettings ConfigureMSBuild(string target) | ||
{ | ||
var prefix = $"{target}_{Environment.UserName}_{Environment.MachineName}_"; | ||
var time = DateTime.Now; | ||
|
||
string name; | ||
|
||
do | ||
{ | ||
name = $"{prefix}{time:yyyy-MM-dd_HH_mm_ss}.binlog"; | ||
time = time.AddSeconds(1); | ||
} | ||
while (System.IO.File.Exists(name)); | ||
|
||
return new() | ||
{ | ||
// TODO: https://github.com/dotnet/msbuild/issues/6756 | ||
NoLogo = true, | ||
BinaryLogger = new() | ||
{ | ||
Enabled = true, | ||
FileName = outLog.CombineWithFilePath(name).FullPath, | ||
}, | ||
ConsoleLoggerSettings = new() | ||
{ | ||
NoSummary = true, | ||
}, | ||
ArgumentCustomization = args => args.Append("-ds:false"), | ||
}; | ||
} | ||
|
||
// Tasks | ||
|
||
Task("default") | ||
.IsDependentOn("build") | ||
.IsDependentOn("pack"); | ||
|
||
Task("restore") | ||
.Does(() => | ||
DotNetRestore( | ||
zigToolsetsProj.FullPath, | ||
new() | ||
{ | ||
MSBuildSettings = ConfigureMSBuild("restore"), | ||
})); | ||
|
||
Task("build") | ||
.IsDependentOn("restore") | ||
.Does(() => | ||
DotNetBuild( | ||
zigToolsetsProj.FullPath, | ||
new() | ||
{ | ||
MSBuildSettings = ConfigureMSBuild("build"), | ||
NoRestore = true, | ||
})); | ||
|
||
Task("pack") | ||
.IsDependentOn("build") | ||
.Does(() => | ||
DotNetPack( | ||
zigToolsetsProj.FullPath, | ||
new() | ||
{ | ||
MSBuildSettings = ConfigureMSBuild("pack"), | ||
NoBuild = true, | ||
})); | ||
|
||
Task("upload") | ||
.WithCriteria(BuildSystem.GitHubActions.Environment.Workflow.Ref.StartsWith("refs/tags/v")) | ||
.IsDependentOn("pack") | ||
.Does(() => | ||
DotNetNuGetPush( | ||
nugetGlob.Pattern, | ||
new() | ||
{ | ||
Source = "https://api.nuget.org/v3/index.json", | ||
ApiKey = nugetToken, | ||
SkipDuplicate = true, | ||
})); | ||
|
||
RunTarget(target); |