Skip to content

pleonex/PleOps.Cake

Repository files navigation

PleOps Cake logo

Stable version   GitHub commits since latest release (by SemVer)   Build and release   MIT License  

Complete DevOps workflow and best-practices for .NET projects based on Cake.

  • ♻️ DevOps best practices for a software project
  • 🔧 Build, test and release tasks for .NET projects and documentation sites
  • 📚 Documentation explaining the workflow
  • 📋 Template repository ready to use

Tech stack

  • Projects: C# / .NET
  • Documentation: DocFX, GitHub page
  • CI: GitHub Actions
  • Release deployment: NuGet feeds, GitHub

Get started

Check out the documentation site to start learning how to use the library.

Feel free to ask any question in the project discussion.

Usage

The project ships a NuGet library with Cake Frosting tasks:

  • Cake.Frosting.PleOps.Recipe: Package in NuGet

To use it, create a new console application with the Cake Frosting template, add a reference to this recipe NuGet and its tasks will be available to use.

return new CakeHost()
    .AddAssembly(typeof(Cake.Frosting.PleOps.Recipe.PleOpsBuildContext).Assembly)
    .UseContext<Cake.Frosting.PleOps.Recipe.PleOpsBuildContext>()
    .UseLifetime<BuildLifetime>()
    .Run(args);

[TaskName("Default")]
[IsDependentOn(typeof(Cake.Frosting.PleOps.Recipe.Common.SetGitVersionTask))]
[IsDependentOn(typeof(Cake.Frosting.PleOps.Recipe.Common.CleanArtifactsTask))]
[IsDependentOn(typeof(Cake.Frosting.PleOps.Recipe.Dotnet.DotnetTasks.BuildProjectTask))]
public sealed class DefaultTask : FrostingTask
{
}

Tip

Find a detailed setup guide in the documentation site.

Preview releases

Preview releases are in an Azure DevOps NuGet feed. Add a nuget.config file in the repository root directory with the following content:

<?xml version="1.0" encoding="utf-8"?>
<!-- This file is only needed if you use preview versions of the recipe build system -->
<configuration>
  <packageSources>
    <clear/>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="PleOps-Preview" value="https://pkgs.dev.azure.com/benito356/NetDevOpsTest/_packaging/PleOps/nuget/v3/index.json" />
  </packageSources>
  <packageSourceMapping>
    <packageSource key="nuget.org">
      <package pattern="*" />
    </packageSource>
    <packageSource key="PleOps-Preview">
      <package pattern="Cake.Frosting.PleOps.Recipe" />
    </packageSource>
  </packageSourceMapping>
</configuration>

Build

The project requires to build .NET 8.0 SDK.

To build, test and generate artifacts run:

# Build and run tests (with code coverage!)
dotnet run --project build/orchestrator

# (Optional) Create bundles (nuget, zips, docs)
dotnet run --project build/orchestrator -- --target=Bundle

To build (and test) the recipe against the examples run:

dotnet run --project src/Cake.Frosting.PleOps.Samples.BuildSystem

Release

Create a new GitHub release with a tag v{Version} (e.g. v2.4) and that's it! This triggers a pipeline that builds and deploy the project.