ci: enforce 80% line coverage gate on TeamsISO.Engine
Some checks failed
CI / build-and-test (push) Has been cancelled
Some checks failed
CI / build-and-test (push) Has been cancelled
This commit is contained in:
parent
5c039025fd
commit
f2b4e881e4
2 changed files with 42 additions and 0 deletions
|
|
@ -34,11 +34,39 @@ jobs:
|
||||||
--no-build
|
--no-build
|
||||||
--logger "trx;LogFileName=test-results.trx"
|
--logger "trx;LogFileName=test-results.trx"
|
||||||
--collect:"XPlat Code Coverage"
|
--collect:"XPlat Code Coverage"
|
||||||
|
--settings coverlet.runsettings
|
||||||
--filter "Category!=ndi&requires!=ndi"
|
--filter "Category!=ndi&requires!=ndi"
|
||||||
|
|
||||||
|
- name: Install ReportGenerator
|
||||||
|
run: dotnet tool install --global dotnet-reportgenerator-globaltool
|
||||||
|
|
||||||
|
- name: Generate coverage report
|
||||||
|
run: |
|
||||||
|
export PATH="$PATH:$HOME/.dotnet/tools"
|
||||||
|
reportgenerator \
|
||||||
|
-reports:"**/coverage.cobertura.xml" \
|
||||||
|
-targetdir:coverage-report \
|
||||||
|
-reporttypes:"Cobertura;TextSummary" \
|
||||||
|
-assemblyfilters:"+TeamsISO.Engine;-TeamsISO.Engine.NdiInterop"
|
||||||
|
|
||||||
|
- name: Enforce coverage threshold (80%)
|
||||||
|
run: |
|
||||||
|
summary=$(cat coverage-report/Summary.txt)
|
||||||
|
echo "$summary"
|
||||||
|
line_coverage=$(echo "$summary" | awk '/Line coverage/ {print $3}' | tr -d '%')
|
||||||
|
echo "Line coverage: $line_coverage%"
|
||||||
|
awk -v c="$line_coverage" 'BEGIN { if (c+0 < 80) { exit 1 } }'
|
||||||
|
|
||||||
- name: Upload test results
|
- name: Upload test results
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: test-results
|
name: test-results
|
||||||
path: '**/test-results.trx'
|
path: '**/test-results.trx'
|
||||||
|
|
||||||
|
- name: Upload coverage report
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: coverage-report
|
||||||
|
path: coverage-report/
|
||||||
|
|
|
||||||
14
coverlet.runsettings
Normal file
14
coverlet.runsettings
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<RunSettings>
|
||||||
|
<DataCollectionRunSettings>
|
||||||
|
<DataCollectors>
|
||||||
|
<DataCollector friendlyName="XPlat code coverage">
|
||||||
|
<Configuration>
|
||||||
|
<Format>cobertura,opencover</Format>
|
||||||
|
<Exclude>[*.Tests]*,[*.NdiInterop]*,[*.IntegrationTests]*</Exclude>
|
||||||
|
<ExcludeByAttribute>GeneratedCodeAttribute,CompilerGeneratedAttribute</ExcludeByAttribute>
|
||||||
|
</Configuration>
|
||||||
|
</DataCollector>
|
||||||
|
</DataCollectors>
|
||||||
|
</DataCollectionRunSettings>
|
||||||
|
</RunSettings>
|
||||||
Loading…
Reference in a new issue