OneBuild conventions
The build pipeline
Orchestration of OneBuild’s build and loading of modules is handled by an Invoke-Build script, giving OneBuild a light weight task orientated build script. Invoke-Build has some thorough documentation about how it works and its concepts for those interested in the detail.
OneBuild defines and executes the following top-level tasks for each commit build
- Invoke-Commit: The default OneBuild task. Invoke-Commit is the entry point to and initiates the complete commit build.
- Invoke-HardcoreClean: Aggressively and recursively deletes all /obj and /bin folders from the build path as well as the \BuildOutput folder.
- Set-VersionNumber: Sets the consistent build number of the form [major].[minor].[buildCounter].[revision]. This task has a few dependent tasks that either read from or create the OneBuild VersionNumber.xml file.
- Invoke-Compile: Cleans and Rebuilds a Visual Studio solution file (identified by convention) to generate compiled .NET assemblies.
- Invoke-UnitTests: Executes all unit tests (currently only supports NUnit) for compiled .NET assemblies matching a defined naming convention, outputting results to XML file.
- New-Packages: Generates new Nuget ([packageName].[version].nupkg) and optional Symbols({packageName].[version].symbols.nupkg) package(s) by passing all .nuspec files found in the solution root folder.
The build convention
Much of the logic within each task of the build pipeline relies heavily on convention, thus no configuration. Adhere to the following convention and OneBuild should just work.
Execution
- The OneBuild
OneBuild.bat
bootstrap script and Invoke-Build OneBuild.build.ps1
build script must sit alongside the Visual Studio solution file(s) you intend to build. If you install with NuGet these are copied for you when executing PM> Install-Package Nunit
Set-VersionNumber
- The path to your installed git.exe must exist within your Windows PATH variable.
Invoke-Compile
- A Visual Studio solution files (.sln) must exist within the root folder of the solution.
- If there are multiple solution files, when ordered (ascending alphabetically) the first is chosen.
Invoke-UnitTests
- To be executed with NUnit, NUnit test assemblies must
- Contain "nunit" (case-insensitive) in their assembly and directory names.
- Be output into a common output folder named \bin, regardless of Visual Studio build configuration.
New-Packages
- To generate output nuget packages
- One or more valid .nuspec files must exist within the root folder of the solution.
Other early assumptions
- You use Git for version control (TFS support coming soon)
- The 3 part Semantic Versioning style is used for all NuGet package versioning. For Git repos a global commit count (4th part) and the short commit Id (informational text) are added to the assembly versions.
- You use NUnit for unit testing (Support for MSTest never coming ;), but other OSS test frameworks for sure.)
- You want to use NuGet for packaging up your assemblies