GitHub Actions: Setup Check-In build

1 minute read

In this article we gonna create continious integration check-in build using GitHub Actions that will be launched at every new commit or pull request in specific branches.

Create build workflow

All you need to do is to create new .yml file at your repository:


With that content:

name: Check-in

  GITHUB_TOKEN: ${{ github.token }}  # set this to access token to
  TEST_PROJECT_NAME: Project.Tests   # set this to your test project name

    branches: [ master ]
    branches: [ master ]

    name: Build and test
    runs-on: windows-latest

      - uses: actions/checkout@v2
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
          dotnet-version: 3.1.101 # use your dotnet version

      - name: Restore dependencies
        run: dotnet restore

      - name: Build solution
        run: dotnet build --configuration Release --no-restore

      - name: Test solution and collect coverage # Your test framework support required (i.e. NUnit/xUnit)
        run: dotnet test --no-restore --verbosity normal /p:CollectCoverage=true /p:CoverletOutput=coverage/ /p:CoverletOutputFormat=lcov

      - name: Publish test coverage report to # Coveralls support required
        uses: coverallsapp/github-action@v1.1.2 # update this version to latest if possible
          github-token: ${{ env.GITHUB_TOKEN }}
          path-to-lcov: ./{{ env.TEST_PROJECT_NAME }}/coverage/

NUnit support

Install NUnit + NUnit3TestAdapter NuGet packages in your test project(s) to be able to execute unit tests:

dotnet add package NUnit
dotnet add package NUnit3TestAdapter

Code Coverage

If you want to publish code coverage results at your project’s readme file, you can do following:

Login at coveralls through GitHub.

Install coverall.msbuild NuGet package in your test project(s):

dotnet add package coverlet.msbuild

Place badge that could be found at coveralls repository location into your readme file