Skip to content

semaphoreci-demos/semaphore-demo-dotnet

Repository files navigation

Semaphore demo CI/CD pipeline using .NET

Example .NET application and CI/CD pipeline for integrating it with Semaphore 2.0.

This demo uses the preinstalled .NET 10 toolchain available on Semaphore's ubuntu2404 image.

Overview

The repository contains:

  • a .NET solution file
  • a console application
  • a reusable class library
  • an xUnit test project
  • a Semaphore pipeline that restores, builds, tests, publishes, and runs the app

The application prints a greeting generated by the core library. The tests validate that greeting behavior directly at the library level.

Project structure

.
├── .semaphore/
│   └── semaphore.yml
├── src/
│   ├── HelloSemaphore.App/
│   └── HelloSemaphore.Core/
├── tests/
│   └── HelloSemaphore.Tests/
├── Directory.Build.props
└── HelloSemaphore.sln

Running locally

If you have the .NET 10 SDK installed, run:

dotnet restore HelloSemaphore.sln
dotnet build HelloSemaphore.sln --configuration Release
dotnet test HelloSemaphore.sln --configuration Release
dotnet run --project src/HelloSemaphore.App/HelloSemaphore.App.csproj --configuration Release

To override the default runtime values:

DEMO_APP_NAME="Semaphore Demo" DEMO_ENVIRONMENT="dev" dotnet run --project src/HelloSemaphore.App/HelloSemaphore.App.csproj

Running on Semaphore

The pipeline is defined in .semaphore/semaphore.yml and runs these steps:

  1. Inspect Toolchain
  2. Restore
  3. Build
  4. Test
  5. Publish
  6. Run Demo

The workflow is intentionally verbose enough to show:

  • which projects were built
  • which tests were executed
  • where the test results were written
  • which files were produced by publish

Notes

The projects target net10.0 to match the current toolchain available on Semaphore's Ubuntu 24.04 image.

About

A Semaphore demo CI/CD pipeline using .NET 10, C#, and xUnit.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages