Skip to content

Commit 56140bf

Browse files
Merge pull request #459 from TransactionProcessing/task/#458-move-code-coverage-to-its-own-workflow
Task/#458 move code coverage to its own workflow
2 parents 7cbfead + b684705 commit 56140bf

2 files changed

Lines changed: 51 additions & 14 deletions

File tree

.github/workflows/codecoverage.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Code Coverage
2+
3+
on:
4+
push:
5+
# branches to consider in the event; optional, defaults to all
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
10+
jobs:
11+
codecoverage:
12+
name: "Code Coverage"
13+
env:
14+
ASPNETCORE_ENVIRONMENT: "Production"
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2.3.4
20+
21+
- name: Restore Nuget Packages
22+
run: dotnet restore EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}
23+
24+
- name: Build Code
25+
run: dotnet build EstateReportingAPI.sln --configuration Release
26+
27+
- name: Run Unit Tests
28+
run: |
29+
echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
30+
dotnet test "EstateReportingAPI.Tests\EstateReportingAPI.Tests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov1.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"
31+
32+
- name: Build Docker Image
33+
run: docker build . --file EstateReportingAPI/Dockerfile --tag estatereportingapi:latest
34+
35+
- name: Run Integration Tests
36+
run: |
37+
dotnet test "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov2.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"
38+
39+
- name: Install LCOV merger
40+
run: npm install -g lcov-result-merger
41+
42+
- name: Merge LCOV reports
43+
run: |
44+
mkdir -p coverage
45+
lcov-result-merger "*.info" > lcov.info
46+
47+
- name: Upload merged coverage to Codacy
48+
uses: codacy/codacy-coverage-reporter-action@v1
49+
with:
50+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
51+
coverage-reports: ./lcov.info

.github/workflows/nightlybuild.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,6 @@ jobs:
3737
run: |
3838
dotnet test "EstateReportingAPI.IntegrationTests\EstateReportingAPI.IntegrationTests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov2.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"
3939
40-
- name: Install LCOV merger
41-
run: npm install -g lcov-result-merger
42-
43-
- name: Merge LCOV reports
44-
run: |
45-
mkdir -p coverage
46-
lcov-result-merger "*.info" > lcov.info
47-
48-
- name: Upload merged coverage to Codacy
49-
uses: codacy/codacy-coverage-reporter-action@v1
50-
with:
51-
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
52-
coverage-reports: ./lcov.info
53-
5440
- uses: actions/upload-artifact@v4
5541
if: ${{ failure() }}
5642
with:

0 commit comments

Comments
 (0)