Update this readme file with your details.
This build system is powered by NUKE; please see their API documentation should you need to make any changes to the Build.cs file.
To install Nuke GlobalTool and SignClient, execute the following command at the root of this folder:
build.cmd
You can define your GitHub workflows in code and Nuke will generate the YAML files for you.
You can update or add to what exist in Build.CI.GitHubActions.cs (AutoGenerate has to be set to true):
[CustomGitHubActions("pr_validation",
GitHubActionsImage.WindowsLatest,
GitHubActionsImage.UbuntuLatest,
AutoGenerate = true,
OnPushBranches = new[] { "master", "dev" },
OnPullRequestBranches = new[] { "master", "dev" },
CacheKeyFiles = new[] { "global.json", "src/**/*.csproj" },
InvokedTargets = new[] { nameof(Tests) },
//causes the on push to not trigger - maybe path-ignore is the right approach!
//OnPushExcludePaths = new[] { "docs/**/*", "package.json", "README.md" },
PublishArtifacts = false)
]
[CustomGitHubActions("Docker_build",
GitHubActionsImage.UbuntuLatest,
AutoGenerate = true,
OnPushBranches = new[] { "master", "dev" },
OnPullRequestBranches = new[] { "master", "dev" },
CacheKeyFiles = new[] { "global.json", "src/**/*.csproj" },
InvokedTargets = new[] { nameof(BuildImage) },
ImportSecrets = new [] { "Docker_Username", "Docker_Password" },
//causes the on push to not trigger - maybe path-ignore is the right approach!
//OnPushExcludePaths = new[] { "docs/**/*", "package.json", "README.md" })
]
[CustomGitHubActions("Windows_release",
GitHubActionsImage.WindowsLatest,
AutoGenerate = true,
OnPushBranches = new[] { "refs/tags/*" },
CacheKeyFiles = new[] { "global.json", "src/**/*.csproj" },
InvokedTargets = new[] { nameof(BuildImage) },
ImportSecrets = new[] { "Nuget_Key" },
//causes the on push to not trigger - maybe path-ignore is the right approach!
//OnPushExcludePaths = new[] { "docs/**/*", "package.json", "README.md" })
]To generate or update existing workflow yaml file(s), execute any of the commands (e.g. build.cmd compile):
PS C:\Users\User\source\repos\Petabridge.App.Web> .\build.cmd compile
PowerShell Desktop version 5.1.19041.1320
Microsoft (R) .NET Core SDK version 6.0.101
11:42:25 [INF] Creating directory C:\Users\User\source\repos\Petabridge.App.Web\.github\workflows...
11:42:25 [INF] Creating directory C:\Users\User\source\repos\Petabridge.App.Web\.github\workflows...
11:42:25 [INF] Creating directory C:\Users\User\source\repos\Petabridge.App.Web\.github\workflows...
11:42:28 [WRN] Configuration files for GitHubActions (Windows_release) have changed.
11:42:28 [WRN] Configuration files for GitHubActions (pr_validation) have changed.
11:42:28 [WRN] Configuration files for GitHubActions (Docker_build) have changed.
Press any key to continue ...
███╗ ██╗██╗ ██╗██╗ ██╗███████╗
████╗ ██║██║ ██║██║ ██╔╝██╔════╝
██╔██╗ ██║██║ ██║█████╔╝ █████╗
██║╚██╗██║██║ ██║██╔═██╗ ██╔══╝
██║ ╚████║╚██████╔╝██║ ██╗███████╗
╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝This project comes with some ready-made commands, all of which can be listed via:
build.cmd help
If you desire to add more commands, please see the Fundamentals.
The ready-made commands you can start working with (both on Windows and Linux), are detailed as follows:
build.cmd Install- installs Nuke.GlobalTool - which is the default when no command is passed.build.cmd all- runs the following commands:BuildRelease,RunTests,NBenchandNuget.build.cmd compile- compiles the solution inReleasemode. The default mode isRelease, to compile inDebugmode =>--configuration debugbuild.cmd buildrelease- compiles the solution inReleasemode.build.cmd runtests- compiles the solution inReleasemode and runs the unit test suite (all projects that end with the.Tests.csprojsuffix). All of the output will be published to the./TestResultsfolder.build.cmd nbench- compiles the solution inReleasemode and runs the NBench performance test suite (all projects that end with the.Tests.Performance.csprojsuffix). All of the output will be published to the./PerfResultsfolder.build.cmd nuget- compiles the solution inReleasemode and creates Nuget packages from any project that does not have<IsPackable>false</IsPackable>set and uses the version number fromRELEASE_NOTES.md.build.cmd nuget --nugetprerelease dev- compiles the solution inReleasemode and creates Nuget packages from any project that does not have<IsPackable>false</IsPackable>set - but in this instance all projects will have aVersionSuffixof-beta{DateTime.UtcNow.Ticks}. It's typically used for publishing nightly releases.build.cmd nuget --nugetpublishurl $(nugetUrl) --nugetkey $(nugetKey)- compiles the solution inReleasemodem creates Nuget packages from any project that does not have<IsPackable>false</IsPackable>set using the version number fromRELEASE_NOTES.mdthen publishes those packages to the$(nugetUrl)using NuGet key$(nugetKey).build.cmd DocFx- compiles the solution inReleasemode and then uses DocFx to generate website documentation inside the./docs/_sitefolder. Use thebuild.cmd servedocson Windows to preview the documentation.
This build script is powered by NUKE; please see their API documentation should you need to make any changes to the build.cs file.
This project will automatically populate its release notes in all of its modules via the entries written inside RELEASE_NOTES.md and will automatically update the versions of all assemblies and NuGet packages via the metadata included inside Directory.Build.props.
RELEASE_NOTES.md
#### [0.1.0] / October 05 2019 ####
First release
In this instance, the NuGet and assembly version will be 0.1.0 based on what's available at the top of the RELEASE_NOTES.md file.
RELEASE_NOTES.md
#### [0.1.0] / October 05 2019 ####
First release
But in this case the NuGet and assembly version will be 0.1.0.
Petabridge.App uses Docker for deployment - to create Docker images for this project, please run the following command:
build.cmd Docker
By default Docker will look for every .csproj file that has a Dockerfile in the same directory - from there the name of the .csproj will be converted into the supported Docker image name format, so "Petabridge.App.csproj" will be converted to an image called petabridge.app:latest and petabridge.app:{VERSION}, where version is determined using the rules defined in the section below.
You can also specify a remote Docker registry URL and that will cause a copy of this Docker image to be published there as well:
The attached build script will automatically do the following based on the conventions of the project names added to this project:
- Any project name ending with
.Testswill automatically be treated as a XUnit2 project and will be included during the test stages of this build script; - Any project name ending with
.Tests.Performancewill automatically be treated as a NBench project and will be included during the test stages of this build script; and - Any project meeting neither of these conventions will be treated as a NuGet packaging target and its
.nupkgfile will automatically be placed in thebin\nugetfolder upon running thebuild.cmd allcommand.
This solution also supports DocFx for generating both API documentation and articles to describe the behavior, output, and usages of your project.
All of the relevant articles you wish to write should be added to the /docs/articles/ folder and any API documentation you might need will also appear there.
All of the documentation will be statically generated and the output will be placed in the /docs/_site/ folder.
To preview the documentation for this project, execute the following command at the root of this folder:
build.cmd servedocs
This will use the built-in docfx.console binary that is installed as part of the NuGet restore process from executing the above command to preview the fully-rendered documentation. For best results, do this immediately after calling build.cmd compile.