Adding code coverage to tests in workflow (#75)
* Adding code coverage to tests in workflow This is using the pattern from the Aspire Community Toolkit which will publish coverage results to the GitHub Actions summary, as well as a comment on the PR (if the job was run by someone with permissions to write comments). Also added the GitHubActionsTestLogger so that it writes a nicer log out to the run. Fixes #11 * Feedback from code review * Slight change to structure * Bad indentation * Ensuring .NET SDK is installed * Disabling fail-fast so that jobs aren't terminated if one fails * Forgot to include coverlet.collector * Update Directory.Packages.props --------- Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
This commit is contained in:
parent
ed079b9711
commit
1f8ebee742
1 changed files with 251 additions and 140 deletions
30
.github/workflows/ci.yml
vendored
30
.github/workflows/ci.yml
vendored
|
|
@ -15,6 +15,7 @@ jobs:
|
|||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
configuration: [Debug, Release]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
@ -22,7 +23,7 @@ jobs:
|
|||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v2
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: |
|
||||
9.0.x
|
||||
|
|
@ -48,4 +49,29 @@ jobs:
|
|||
run: dotnet build --configuration ${{ matrix.configuration }}
|
||||
|
||||
- name: Test
|
||||
run: dotnet test --filter '(Execution!=Manual)' --no-build --configuration ${{ matrix.configuration }}
|
||||
run: >-
|
||||
dotnet test
|
||||
--filter '(Execution!=Manual)'
|
||||
--no-build
|
||||
--configuration ${{ matrix.configuration }}
|
||||
--logger "console;verbosity=normal"
|
||||
--logger "trx"
|
||||
--logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true"
|
||||
--blame
|
||||
--blame-hang-timeout 7m
|
||||
--blame-crash
|
||||
--results-directory testresults
|
||||
--collect "XPlat Code Coverage" -- RunConfiguration.CollectSourceInformation=true
|
||||
|
||||
- name: Upload test results artifact
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: testresults-${{ matrix.os }}-${{ matrix.configuration }}
|
||||
path: testresults/**
|
||||
|
||||
publish-coverage:
|
||||
if: github.actor != 'dependabot[bot]'
|
||||
needs: build
|
||||
uses: ./.github/workflows/code-coverage.yml
|
||||
secrets: inherit
|
||||
|
|
|
|||
Loading…
Reference in a new issue