Run Dotnet Tests

June 27, 2026 · View on GitHub

Test .NET solutions or projects across multiple platforms with code coverage reporting. Sets up the .NET 9 (STS) and .NET 10 (LTS) SDKs side-by-side, configures NuGet sources (including GHCR for private packages), runs tests with coverage collection, and uploads the report to GitHub Code Quality (native PR coverage).

Permissions: the calling job must grant code-quality: write for the GitHub Code Quality upload. The coverage is merged into a single Cobertura report (via ReportGenerator) and uploaded once, from the Linux matrix leg only. The upload is best-effort (it never fails the build) and requires the repo's Code Quality to be enabled (Settings → Code quality).

Inputs

NameDescriptionRequiredDefault
github-tokenGitHub token to access the repository-
working-directoryDirectory to run the tests in.

Usage

Basic

steps:
  - name: Test .NET project
    uses: devantler-tech/actions/run-dotnet-tests@main
    with:
      github-token: ${{ secrets.GITHUB_TOKEN }}

Custom working directory

steps:
  - name: Test .NET project
    uses: devantler-tech/actions/run-dotnet-tests@main
    with:
      github-token: ${{ secrets.GITHUB_TOKEN }}
      working-directory: src/MyProject