1 min read

If you have a test project and you want to exclude it from GitHub actions what you will do?
You need to run the test with filter and put the namespace of the project you want to exclude like this dotnet test --filter FullyQualifiedName!~name.space.you.want.to.exclude --configuration Release.
We can use that on GitHub action like this

name: .NET Core
on: 
  push:
    branches:
      - main # Your default release branch
jobs:
  build:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 5.0.101
    - name: Build and Test with dotnet
      run: dotnet test --configuration Release
      run: dotnet test --filter FullyQualifiedName!~name.space.you.want.to.exclude --configuration Release

That is all, now you can exclude one project from tests and that will be useful on integration tests.

About the author

For the last decade, Shady Nagy has worked with a variety of web technologies. He is currently focused on code quality. On his day to day job, he is working as a team leader engineer. As a digital nomad, he is living where the WiFi and sun are 😎
Do you want to know more? Visit my website!