Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Latest commit

 

History

History
53 lines (39 loc) · 2.11 KB

README.md

File metadata and controls

53 lines (39 loc) · 2.11 KB

pageup-code-coverage-action

PageUp .Net code coverage action

Add this action for you PR's to enable code coverage reporting.

How to setup

Github workflow setup

Use the the below workflow template to configure concoverage reporting for your repo.

  • Depending on the current test coverage level, you may want to shift up or down the percentLowRange / percentHighRange range for the coverage reporting to incrementally move the dial upward on coverage
  • using failBuild You can optionally configure thebuidl to failif you drop

If you don't already have a workflow in github you will need to add the below yaml to .github/workflows/main.yaml

  name: CI
  on:
    pull_request:
      branches: [ "main" ]

  jobs:
    build:
      runs-on: ubuntu-latest
      if: github.event.pull_request.draft == false

      steps:
        - name: 🛒 Checkout code
          uses: actions/checkout@v3

        - name: 🔐 PageUp Code Scanning Action
          uses: PageUpPeopleOrg/pageup-codescanning-action@main      
          if: always()
        - name: 📈 PageUp Code Coverage report
          uses: PageUpPeopleOrg/pageup-code-coverage-action@main      
          if: always()
          with:
            failBuild: 'false'
            percentLowRange: '50'
            percentHighRange: '80'

.Net solution setup

By default, when running code coverage, all assemblies touched by the test are included in code coverage reporting. This is not ideal since it means 3rd party NUGET packages, as well as your tests assemblies get included in coverage which throws out the calculation and adds noise. Therefore, rather than trying to manage a long and complicated list of exclusions which may vary by project, we have opted for configuring what to include in coverage, rather than what to exclude.

To ensure only your code assemblies are included in code coverage and not include your test suite projects or nuget packages, perform the following:

In visual studio set the Company property to "PageUp" under each projects properties you whish to include

  • Project settings -> Package -> General -> "Company" => set to "PageUp"