Skip to content

Commit 06771c0

Browse files
CI pipeline setup - build, test, fail on quality/coverage checks
Add test coverage into the build pipeline. Code coverage fails in the pipeline. Note that it does not report errors within the summary and will display as an error within the pipeline action. Pipeline failures cannot be merged into main. SAB-186
1 parent 693eb43 commit 06771c0

1 file changed

Lines changed: 28 additions & 28 deletions

File tree

.github/workflows/build.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
env:
1313
DOTNET_VERSION: "10.x"
14-
MIN_LINE_COVERAGE: "50"
14+
MIN_LINE_COVERAGE: "60"
1515

1616
jobs:
1717
build:
@@ -43,30 +43,30 @@ jobs:
4343
- name: Test
4444
run: dotnet test SchoolAccount.Web.slnx --configuration Release --no-restore --no-build -- --report-trx --coverage --coverage-output-format cobertura --coverage-settings ${{ github.workspace }}/coverage.config
4545

46-
# - name: Test report
47-
# uses: EnricoMi/publish-unit-test-result-action@v2
48-
# if: ${{ !cancelled() }}
49-
# with:
50-
# files: "TestResults/*.trx"
51-
#
52-
# - name: Merge coverage reports and enforce threshold
53-
# if: ${{ !cancelled() }}
54-
# uses: danielpalme/ReportGenerator-GitHub-Action@5
55-
# with:
56-
# reports: "TestResults/*.cobertura.xml"
57-
# targetdir: TestResults/Merged
58-
# reporttypes: "Cobertura;MarkdownSummaryGithub"
59-
# customSettings: "minimumCoverageThresholds:lineCoverage=${{ env.MIN_LINE_COVERAGE }}"
60-
#
61-
# - name: Write coverage job summary
62-
# if: ${{ !cancelled() }}
63-
# run: cat TestResults/Merged/SummaryGithub.md >> "$GITHUB_STEP_SUMMARY"
64-
#
65-
# - name: Add coverage comment to PR
66-
# if: ${{ !cancelled() && github.event_name == 'pull_request' }}
67-
# uses: marocchino/sticky-pull-request-comment@v3
68-
# with:
69-
# path: TestResults/Merged/SummaryGithub.md
70-
#
71-
# - name: Publish
72-
# run: dotnet publish SchoolAccount.Web.slnx --configuration Release --no-restore --no-build
46+
- name: Test report
47+
uses: EnricoMi/publish-unit-test-result-action@v2
48+
if: ${{ !cancelled() }}
49+
with:
50+
files: "TestResults/*.trx"
51+
52+
- name: Merge coverage reports and enforce threshold
53+
if: ${{ !cancelled() }}
54+
uses: danielpalme/ReportGenerator-GitHub-Action@5
55+
with:
56+
reports: "TestResults/*.cobertura.xml"
57+
targetdir: TestResults/Merged
58+
reporttypes: "Cobertura;MarkdownSummaryGithub"
59+
customSettings: "minimumCoverageThresholds:lineCoverage=${{ env.MIN_LINE_COVERAGE }}"
60+
61+
- name: Write coverage job summary
62+
if: ${{ !cancelled() }}
63+
run: cat TestResults/Merged/SummaryGithub.md >> "$GITHUB_STEP_SUMMARY"
64+
65+
- name: Add coverage comment to PR
66+
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
67+
uses: marocchino/sticky-pull-request-comment@v3
68+
with:
69+
path: TestResults/Merged/SummaryGithub.md
70+
71+
- name: Publish
72+
run: dotnet publish SchoolAccount.Web.slnx --configuration Release --no-restore --no-build

0 commit comments

Comments
 (0)