Skip to content

Development: Actions workflows

Matteo Gregoricchio edited this page May 11, 2024 · 4 revisions

The CI/CD of serilog-ui is created and managed using Nuke, an open-source tool that helps in creating workflows through a C# console application.

The YML workflows files that power Github Actions are auto-generated by Nuke, when running the related command (see below).

on nuke: commands & info

The Nuke project is located inside the _build .csproj.
A main Build (partial) class contains and access all the configured CI/CD steps. Build partial class is divided into subfiles, to better divide the steps by their scope.

dotnet tool install Nuke.GlobalTool --global # install Nuke as dotnet tool

nuke # run Nuke build

nuke --plan # generate Nuke execution plan (https://nuke.build/docs/getting-started/execution/#execution-plans)

When you modify the _build project, it's preferable you run nuke --plan before concluding your job. Executing the Nuke compilation will make the tool re-generate any script/yml file, to include any update.

Workflows

There are 3 workflows:

  • DotNET Build: executes on pull request and push to master/dev. It compiles and test the backend code
  • JS workflow: executes on pull request and push to master/dev. It compiles and test the frontend code
  • Release: manual run. Builds & tests the whole repository, then pack + publish on Nuget the selected pkgs

Each build is analyzed with sonarqube and published to its project in SonarCloud.

frontend sonar project: https://sonarcloud.io/project/overview?id=followynne_serilog-ui_assets
backend sonar projects: https://sonarcloud.io/summary/overall?id=followynne_serilog-ui

A @Reporter Github Action runs at the end of the workflows, to collect and publish as artifacts results the test results for both analysis.

The Release workflow

Release workflow must be run manually.

Pack & Publish steps will prepare and nuget-publish the selected packages. These steps require either a release/* or a main/master branch to execute.

This workflow exposes input parameters.
Each parameter that is set to "true" will enable the Nuget publication for the related project.
When the workflow runs, all the prj set to "true" will be separately packed and then published, one by one.

With this setup, we'll be able to select which packages are ready for a release on a specific (branch) commit.

Local usage

If you want to use Nuke to compile & test on local, you just need to run nuke from the folder root!

The configuration already excludes any operation that requires the Github environment.

On Local, Nuke will clean the solution, restore dependencies, build frontend and backend and run all tests.

Nuke Execution plan (at 05/24)

execution-plan