Skip to content
  • English Deutsch

benjamin-abt.com

Performance is a feature | Cloud - AI - Azure - .NET - Sustainability

  • Home
  • Blog
  • Portfolio
    • Overview
    • Workshops & Training
    • Publications
  • Contact
  • Home
  • Blog

Build and Test .NET Core with GitHub Actions

Build and Test .NET Core with GitHub Actions
May 18, 2020 2 min read BEN ABT
.NET ASP.NET Core

This article was written in 2020. Versions, tools and recommendations may have changed since then. Newer posts are collected under .NET.

What is GitHub Actions?

GitHub Actions is the counterpart to Azure DevOps Pipelines: a fully configurable automation tool for setting up workflows, such as building, testing and publishing software and applications.

Similar to Azure DevOps and other similar systems, the configuration and setup of the workflows is done via text files, more precisely YAML files.

The advantage of YAML files

The advantage of configuring directly in text files is that they live together with the source code of the application: the Git repository. The source code is thus always synchronized with the workflow configuration and can also live through the lifecycle with feature and release branches.

Templates

As in Azure DevOps, GitHub Actions provides corresponding workflow templates for various programming languages and tools - and they can be extended with your own templates.

My template to build .NET

Templates are not ready-made solutions, but only building blocks that can be used to put together your workflow accordingly.

Here you can see the basic workflow I use for .NET applications:

YAML
 1name: NETCore
 2
 3on:
 4    push:
 5      branches:
 6        - master
 7    pull_request:
 8      branches:
 9        - master
10
11env:
12  BuildConfig: Release
13  SolutionFile: MySolution.sln
14
15jobs:
16    build:
17      runs-on: ubuntu-latest
18      steps:
19      - uses: actions/checkout@v2
20        with:
21          fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
22      
23      - uses: aarnott/nbgv@v0.3 # https://github.com/AArnott/nbgv
24        id: nbgv
25
26      - name: Versioning
27        run: echo ${{ steps.nbgv.outputs.SemVer2 }}
28
29      - name: Build with dotnet
30        run: dotnet build
31              --configuration ${{ env.BuildConfig }}
32              /p:Version=${{ steps.nbgv.outputs.AssemblyVersion }}
33
34      - name: Test with dotnet
35        run: dotnet test ${{ env.SolutionFile }}

This workflow basically already exists in my Azure DevOps templates . It basically runs through the following steps:

  • Loading the source code in the corresponding Git Branch
  • Automatically generate a version based on Semantic Versioning using the Nerdbank.GitVersioning tool (an alternative would be GitVersion )
  • Compiling the source code (entire .NET Solution)
  • Testing the solution (e.g. unit tests)

In a real mission, this would usually be added here:

  • Checking for security issues with WhiteSource or GitHub Security , for example
  • Packaging of software and applications
  • Possibly publish the software, for example on NuGet, Azure, AWS, Docker.

Related articles

Production Rate Limiting in ASP.NET Core

Nov 3, 2026 - 16 min read

Production Rate Limiting in ASP.NET Core

Most ASP.NET Core rate-limiting examples stop after registering a fixed window. That is enough to demonstrate the middleware, but it is not …

Problem Details in ASP.NET Core and .NET 11

Oct 5, 2026 - 12 min read

Problem Details in ASP.NET Core and .NET 11

builder.Services.AddProblemDetails() registers infrastructure. It does not create an error contract. An ASP.NET Core request can fail during …

Resilience in .NET with Microsoft.Extensions.Resilience

Sep 21, 2026 - 11 min read

Resilience in .NET with Microsoft.Extensions.Resilience

Retries are the most visible resilience strategy and the easiest one to misuse. Repeating a failing call can recover from a short network …


BEN ABT

BEN ABT

Ben is Chief Engineering Officer and Principal Software Engineer at Medialesson.de, with a strong focus on .NET and Microsoft Azure. In his professional role, he designs and builds highly scalable platforms for hybrid and cloud-based scenarios. He also advises companies and C-levels on migrating to the sovereign cloud.

He runs myCSharp.de, the largest and most active German-speaking C# community forum, actively contributes to both his own and external open-source projects and regularly shares his knowledge through his blog, at community events, conferences and as a writer for technical magazines.

Let's Work Together

Looking for an experienced Platform Architect or Engineer for your next project? Whether it's cloud migration, platform modernization or building new solutions from scratch - I'm here to help you succeed.

New Platforms

Modernization

Training & Consulting

Contact Me
X Facebook LinkedIn WhatsApp
Back Next Blog Post

Open for work!

Contact Me
BEN ABT BEN ABT Software Engineer · Microsoft MVP Passionate about .NET, Azure, performance optimization and sustainable software engineering.

Medialesson GmbH Logo

Microsoft MVP Logo

Recent posts

View all
Production Rate Limiting in ASP.NET Core

Production Rate Limiting in ASP.NET Core

Nov 3, 2026
The Big Decimal Bugfix with .NET 11

The Big Decimal Bugfix with .NET 11

Nov 2, 2026
Distroless, Chiseled or Alpine: Choosing a .NET Base Image

Distroless, Chiseled or Alpine: Choosing a .NET Base Image

Oct 27, 2026
Stop Using nginx as Your Default Static File Server in Docker

Stop Using nginx as Your Default Static File Server in …

Oct 24, 2026
Containerizing .NET in 2026 Without a Dockerfile

Containerizing .NET in 2026 Without a Dockerfile

Oct 20, 2026

Tags

.NET (195) Csharp (99) ASP.NET Core (49) Azure (41) DevOps (17) Docker (15) Microsoft (14) EF Core (11) Microsoft MVP (11) Security (11) AI (10) GitHub (10) GitHub Copilot (10) ASP.NET (9) Synology (9) .NET 11 (8) Architecture (8) Raspberry (8) Azure Functions (7) Cloudflare (7)
benjamin-abt.com

About BEN

Benjamin Abt is a Software Engineer, Platform Architect and Microsoft MVP specializing in .NET, Azure, cloud architecture, performance optimization and sustainable software development.

Connect

  • Follow me on GitHub
  • Follow me on LinkedIn
  • Follow me on Mastodon
  • Microsoft MVP profile
  • Follow SchwabenCode on GitHub
  • Follow me on X

Quick Links

  • Portfolio
  • Blog
  • Workshops & Training
  • Publications
  • Get in Touch
  • Sitemap
Open for Work

© Copyright Benjamin Abt & SchwabenCode | 2011 - 2026

Content licensed under CC BY 4.0 unless otherwise noted.

  • Impressum
  • Privacy
  • Contact