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 cathode.cake.
* Upload build logs/artifacts from GitHub Actions workflows.
* Improve the JetBrains Fleet experience in the repo.

Closes #123.
  • Loading branch information
alexrp committed Dec 5, 2023
1 parent 24222cb commit 3b5e025
Show file tree
Hide file tree
Showing 24 changed files with 742 additions and 98 deletions.
8 changes: 8 additions & 0 deletions .fleet/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"files.exclude": [
"out",
".idea",
".vs",
"node_modules"
]
}
18 changes: 15 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ jobs:
submodules: recursive
- name: Set up .NET
uses: actions/setup-dotnet@v3.2.0
- name: Build project
- name: Set up Node.js
uses: actions/setup-node@v4.0.0
with:
node-version-file: doc/package.json
- name: Run Cake
run: |
dotnet tool restore
dotnet publish -c ${{ matrix.cfg }}
./cake -c ${{ matrix.cfg }}
- name: Run samples
run: |
dotnet example --all \
Expand All @@ -48,3 +51,12 @@ jobs:
--skip scrolling \
--skip signals \
--skip width
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v3.1.3
with:
name: ${{ github.workflow }}-${{ github.run_number }}-${{ github.run_attempt }}-${{ matrix.os }}-${{ matrix.cfg }}
path: |
out/log
out/pkg
out/pub
22 changes: 16 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/cathode'
Expand All @@ -23,10 +24,19 @@ jobs:
submodules: recursive
- name: Set up .NET
uses: actions/setup-dotnet@v3.2.0
- name: Build project
run: |
dotnet tool restore
dotnet build
- name: Upload GitHub packages
- name: Set up Node.js
uses: actions/setup-node@v4.0.0
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/upload-artifact@v3.1.3
with:
name: ${{ github.workflow }}-${{ github.run_number }}-${{ github.run_attempt }}-windows-2022-Debug
path: |
out/log
out/pkg
out/pub
22 changes: 16 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/cathode'
Expand All @@ -23,10 +24,19 @@ jobs:
submodules: recursive
- name: Set up .NET
uses: actions/setup-dotnet@v3.2.0
- name: Build project
run: |
dotnet tool restore
dotnet build -c Release
- name: Upload NuGet packages
- name: Set up Node.js
uses: actions/setup-node@v4.0.0
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 -c Release
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v3.1.3
with:
name: ${{ github.workflow }}-${{ github.run_number }}-${{ github.run_attempt }}-windows-2022-Release
path: |
out/log
out/pkg
out/pub
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.vs
/out
*.user
/pkg/cache/*/*
/pkg/feed/*.nupkg
bin
obj
.idea
.vs
node_modules
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"console": "externalTerminal",
"cwd": "${workspaceFolder}/src/samples/${input:pickSample}",
"program": "${workspaceFolder}/src/samples/${input:pickSample}/bin/Debug/${input:pickSample}.dll"
"program": "${workspaceFolder}/out/bin/src/samples/${input:pickSample}/debug/${input:pickSample}.dll"
},
{
"name": ".NET: Launch (Integrated)",
Expand All @@ -57,7 +57,7 @@
},
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/src/samples/${input:pickSample}",
"program": "${workspaceFolder}/src/samples/${input:pickSample}/bin/Debug/${input:pickSample}.dll"
"program": "${workspaceFolder}/out/bin/src/samples/${input:pickSample}/debug/${input:pickSample}.dll"
},
{
"name": ".NET: Attach",
Expand Down
7 changes: 3 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"files.exclude": {
"out": true,
"**/.idea": true,
"**/.vs": true,
"pkg/cache/*[!_._]": true,
"pkg/feed/*.nupkg": true,
"**/bin": true,
"**/obj": 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>
<EnablePackageValidation>true</EnablePackageValidation>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<ImplicitUsings>true</ImplicitUsings>
Expand All @@ -27,12 +26,19 @@ Windows console host and the many limitations it had. $(Product) provides an API
centered around a VT100 terminal with some extensions from later models and
modern terminal emulators. It works on all desktop platforms that .NET supports.</PackageDescription>
<PackageLicenseExpression>0BSD</PackageLicenseExpression>
<PackageOutputPath>$(MSBuildThisFileDirectory)pkg/feed/</PackageOutputPath>
<PackageProjectUrl>https://docs.vezel.dev/cathode</PackageProjectUrl>
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
<PublishRelease>false</PublishRelease>
<RepositoryUrl>https://github.com/vezel-dev/cathode.git</RepositoryUrl>
<TargetFramework>net8.0</TargetFramework>
<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>
10 changes: 9 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="cathode.svg"
width="128" />
width="128"
alt="Cathode" />
</div>

<p align="center">
Expand Down Expand Up @@ -70,6 +71,13 @@ samples can be run with
For more information, please visit the
[project home page](https://docs.vezel.dev/cathode).

## Building

Simply run `./cake` (a [Bash](https://www.gnu.org/software/bash) script) to
build artifacts. This will use the `Debug` configuration by default, which is
suitable for development and debugging. Pass `-c Release` instead to use that
configuration, resulting in an optimized build.

## License

This project is licensed under the terms found in
Expand Down
11 changes: 8 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ 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, run `./cake` in the release branch locally on all
platforms that you have access to, and test the [sample programs](src/samples)
with all terminal emulators that you have access to. Verify that nothing has
regressed. Also, ensure that the release branch builds and tests successfully on
[CI](https://github.com/vezel-dev/cathode/actions).

emulators you have access to. Verify that nothing has regressed. Also, ensure that the release branch builds and tests
successfully on [CI](https://github.com/vezel-dev/cathode/actions).
Before tagging a release, build the release branch locally on all platforms that
you have access to and run the [sample programs](src/samples) with all terminal
emulators you have access to. Verify that nothing has regressed. Also, ensure
that the release branch builds and tests successfully on
[CI](https://github.com/vezel-dev/cathode/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 cathode.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

0 comments on commit 3b5e025

Please sign in to comment.