Skip to content

Commit

Permalink
Switch to Cake for build orchestration.
Browse files Browse the repository at this point in the history
Also:

* Switch to artifacts output paths in .NET projects.
* Integrate markdownlint-cli2 as part of the build.
* Simplify GitHub Actions workflows by moving logic into zig-sdk.cake.
* Upload build logs/artifacts from GitHub Actions workflows.
* Improve the JetBrains Fleet experience in the repo.

Closes #87.
  • Loading branch information
alexrp committed Dec 28, 2023
1 parent 2f9ec58 commit f145085
Show file tree
Hide file tree
Showing 24 changed files with 841 additions and 130 deletions.
10 changes: 10 additions & 0 deletions .fleet/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"files.exclude": [
"out",
".idea",
".vs",
"bin",
"node_modules",
"obj"
]
}
47 changes: 14 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ jobs:
- macos-13
- ubuntu-22.04
- windows-2022
cfg:
- Debug
- Release
mode:
- Fast
- Safe
- Small
exclude:
- cfg: Debug
mode: Fast
- cfg: Debug
mode: Small
runs-on: ${{ matrix.os }}
steps:
- name: Clone repository
Expand All @@ -43,25 +31,18 @@ jobs:
submodules: recursive
- name: Set up .NET
uses: actions/[email protected]
- name: Build project
run: |
dotnet tool restore
dotnet build
- name: Restore samples
run: |
dotnet restore src/samples
- name: Build samples
run: |
dotnet build src/samples -c ${{ matrix.cfg }} --no-restore -p:ReleaseMode=${{ matrix.mode }}
- name: Test samples
run: |
dotnet test src/samples -c ${{ matrix.cfg }} --no-restore -p:ReleaseMode=${{ matrix.mode }}
- name: Pack samples
run: |
dotnet pack src/samples -c ${{ matrix.cfg }} --no-build
- name: Publish samples
run: |
dotnet publish src/samples -c ${{ matrix.cfg }} --no-build
- name: Clean samples
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version-file: doc/package.json
- name: Run Cake
run: |
dotnet clean src/samples -c ${{ matrix.cfg }}
./cake
- name: Upload artifacts
if: always()
uses: actions/[email protected]
with:
name: ${{ github.workflow }}-${{ github.run_number }}-${{ github.run_attempt }}-${{ matrix.os }}-Release
path: |
out/log
out/pkg
21 changes: 15 additions & 6 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_NOLOGO: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
package:
if: github.repository == 'vezel-dev/zig-sdk'
Expand All @@ -23,10 +24,18 @@ jobs:
submodules: recursive
- name: Set up .NET
uses: actions/[email protected]
- name: Build project
run: |
dotnet tool restore
dotnet build
- name: Upload GitHub packages
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version-file: doc/package.json
- name: Run Cake
run: |
dotnet gpr push pkg/feed/*.nupkg -k ${{ secrets.GITHUB_TOKEN }}
./cake upload-core-github
- name: Upload artifacts
if: always()
uses: actions/[email protected]
with:
name: ${{ github.workflow }}-${{ github.run_number }}-${{ github.run_attempt }}-windows-2022-Release
path: |
out/log
out/pkg
21 changes: 15 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-sdk'
Expand All @@ -23,10 +24,18 @@ jobs:
submodules: recursive
- name: Set up .NET
uses: actions/[email protected]
- name: Build project
run: |
dotnet tool restore
dotnet build
- name: Upload NuGet packages
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version-file: doc/package.json
- name: Run Cake
run: |
dotnet nuget push pkg/feed/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_TOKEN }} --skip-duplicate
./cake upload-core-nuget
- name: Upload artifacts
if: always()
uses: actions/[email protected]
with:
name: ${{ github.workflow }}-${{ github.run_number }}-${{ github.run_attempt }}-windows-2022-Release
path: |
out/log
out/pkg
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.vs
*.user
/pkg/cache/*/*
/pkg/feed/*.nupkg
/out
/src/samples/**/bin
/src/samples/**/obj
/src/samples/global.json
bin
obj
*.user
.idea
.vs
node_modules
11 changes: 6 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"files.exclude": {
"**/.vs": true,
"pkg/cache/*[!_._]": true,
"pkg/feed/*.nupkg": true,
"out": true,
"src/samples/**/bin": true,
"src/samples/**/obj": true,
"src/samples/global.json": true,
"**/bin": true,
"**/obj": true
"**/.idea": true,
"**/.vs": true,
"**/node_modules": true
}
}
49 changes: 0 additions & 49 deletions .vscode/tasks.json

This file was deleted.

10 changes: 8 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AnalysisLevel>latest-all</AnalysisLevel>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Configuration>Release</Configuration>
<EnablePackageValidation>true</EnablePackageValidation>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
Expand All @@ -26,10 +25,17 @@ packaging, and more, the Zig SDK makes it trivial to author native components as
part of your .NET solution - without all the hassle that is usually part and
parcel of building and packaging native code.</PackageDescription>
<PackageLicenseExpression>0BSD</PackageLicenseExpression>
<PackageOutputPath>$(MSBuildThisFileDirectory)pkg/feed/</PackageOutputPath>
<PackageProjectUrl>https://docs.vezel.dev/zig-sdk</PackageProjectUrl>
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
<RepositoryUrl>https://github.com/vezel-dev/zig-sdk.git</RepositoryUrl>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<UseArtifactsOutput>true</UseArtifactsOutput>
<ArtifactsPath>$(MSBuildThisFileDirectory)out</ArtifactsPath>
<ArtifactsProjectName>$([MSBuild]::MakeRelative('$(MSBuildThisFileDirectory)', '$(MSBuildProjectDirectory)'))</ArtifactsProjectName>
<ArtifactsPublishOutputName>pub</ArtifactsPublishOutputName>
<ArtifactsPackageOutputName>pkg</ArtifactsPackageOutputName>
</PropertyGroup>
</Project>
1 change: 0 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<Choose>
<When Condition="'$(IsPackable)' == 'true'">
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageIcon>zig.png</PackageIcon>
<PackageReadmeFile>PACKAGE.md</PackageReadmeFile>
</PropertyGroup>
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<div align="center">
<img src="zig.svg"
width="128" />
width="128"
alt="Zig SDK" />
</div>

<p align="center">
Expand Down Expand Up @@ -53,6 +54,11 @@ To install an SDK package in a project, add it to your `global.json` under the
For more information, please visit the
[project home page](https://docs.vezel.dev/zig-sdk).

## Building

Simply run `./cake` (a [Bash](https://www.gnu.org/software/bash) script) to
build artifacts.

## License

This project is licensed under the terms found in
Expand Down
8 changes: 4 additions & 4 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Patch-level releases should be done out of the relevant major/minor branch. For
example, both `1.0.1` and `1.0.5` should come out of `release/v1.0`. So, there
is no need to run `dotnet nbgv prepare-release` in this case.

Before tagging a release, build the release branch locally on all platforms that
you have access to and try the [sample projects](src/samples). Verify that
nothing has regressed. Also, ensure that the release branch builds and tests
successfully on [CI](https://github.com/vezel-dev/zig-sdk/actions).
Before tagging a release, run `./cake` in the release branch locally on all
platforms that you have access to, and try the [sample projects](src/samples).
Verify that nothing has regressed. Also, ensure that the release branch builds
and tests successfully on [CI](https://github.com/vezel-dev/zig-sdk/actions).

Next, run `dotnet nbgv tag` from the release branch to create a release tag,
followed by `git tag <tag> <tag> -f -m <tag> -s` to sign it, and then push it
Expand Down
7 changes: 7 additions & 0 deletions cake
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-sdk.cake -t "${1:-default}" "${@:2}"
8 changes: 8 additions & 0 deletions cake.config
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
8 changes: 8 additions & 0 deletions doc/.markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"globs": [
"**/*.md"
],
"ignores": [
"node_modules"
]
}
6 changes: 6 additions & 0 deletions doc/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
audit = false
engine-strict = true
fund = false
logs-dir = ../out/log/node
logs-max = 9007199254740991
save-exact = true
Loading

0 comments on commit f145085

Please sign in to comment.