Feat/abstraction #2
This file contains hidden or 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: | |
push: | |
branches: [ main, master, develop ] | |
pull_request: | |
branches: [ main, master, develop ] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test with coverage | |
run: dotnet test --no-build --verbosity normal --settings tests/Phoenix.MarketData.Infrastructure.Tests/coverage.runsettings | |
- name: Install ReportGenerator | |
run: dotnet tool install -g dotnet-reportgenerator-globaltool | |
- name: Generate HTML coverage report | |
run: | | |
reportgenerator \ | |
"-reports:tests/**/TestResults/**/coverage.cobertura.xml" \ | |
"-targetdir:coverage-report" \ | |
"-reporttypes:Html;Cobertura" | |
- name: Check code coverage threshold | |
uses: irongut/CodeCoverageSummary@v1.3.0 | |
with: | |
filename: coverage-report/Cobertura.xml | |
badge: true | |
format: markdown | |
output: both | |
thresholdAlert: 10 | |
thresholdCritical: 5 | |
thresholdWarning: 20 | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: coverage-report | |
if-no-files-found: error | |
- 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 |