Update build.yml #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
# See https://josh-ops.com/posts/github-code-coverage/ | |
# Add coverlet.collector nuget package to test project - 'dotnet add <TestProject.cspoj> package coverlet | |
- name: Test | |
run: dotnet test --no-restore --verbosity normal --collect:"XPlat Code Coverage" --logger trx --results-directory coverage | |
- name: Copy Coverage To Predictable Location | |
run: cp coverage/*/coverage.cobertura.xml coverage/coverage.cobertura.xml | |
- name: Code Coverage Summary Report | |
uses: irongut/[email protected] | |
# uses: joshjohanning/[email protected] | |
with: | |
filename: coverage/coverage.cobertura.xml | |
badge: true | |
format: 'markdown' | |
output: 'both' | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
recreate: true | |
path: code-coverage-results.md |