Skip to content

Commit db3c9b7

Browse files
Merge pull request #682 from TransactionProcessing/task/#681-move-code-coverage-to-its-own-workflow
Task/#681 move code coverage to its own workflow
2 parents 15fc600 + 5d2513a commit db3c9b7

2 files changed

Lines changed: 47 additions & 14 deletions

File tree

.github/workflows/codecoverage.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
build:
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 FileProcessor.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}
23+
24+
- name: Build Code
25+
run: dotnet build FileProcessor.sln --configuration Release
26+
27+
- name: Run Unit Tests
28+
run: |
29+
echo "ASPNETCORE_ENVIRONMENT are > ${ASPNETCORE_ENVIRONMENT}"
30+
dotnet test "FileProcessor.BusinessLogic.Tests\FileProcessor.BusinessLogic.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+
dotnet test "FileProcessor.FileAggregate.Tests\FileProcessor.FileAggregate.Tests.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"
32+
dotnet test "FileProcessor.FileImportLogAggregate.Tests\FileProcessor.FileImportLogAggregate.Tests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov3.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"
33+
34+
- name: Install LCOV merger
35+
run: npm install -g lcov-result-merger
36+
37+
- name: Merge LCOV reports
38+
run: |
39+
mkdir -p coverage
40+
lcov-result-merger "*.info" > lcov.info
41+
42+
- name: Upload merged coverage to Codacy
43+
uses: codacy/codacy-coverage-reporter-action@v1
44+
with:
45+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
46+
coverage-reports: ./lcov.info
47+

.github/workflows/nightlybuild.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,6 @@ jobs:
3131
dotnet test "FileProcessor.BusinessLogic.Tests\FileProcessor.BusinessLogic.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"
3232
dotnet test "FileProcessor.FileAggregate.Tests\FileProcessor.FileAggregate.Tests.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"
3333
dotnet test "FileProcessor.FileImportLogAggregate.Tests\FileProcessor.FileImportLogAggregate.Tests.csproj" /p:CollectCoverage=true /p:Exclude="[xunit*]*" /p:ExcludeByAttribute="Obsolete" /p:ExcludeByAttribute="GeneratedCodeAttribute" /p:ExcludeByAttribute="CompilerGeneratedAttribute" /p:ExcludeByAttribute="ExcludeFromCodeCoverageAttribute" /p:CoverletOutput="../lcov3.info" /maxcpucount:1 /p:CoverletOutputFormat="lcov"
34-
35-
- name: Install LCOV merger
36-
run: npm install -g lcov-result-merger
37-
38-
- name: Merge LCOV reports
39-
run: |
40-
mkdir -p coverage
41-
lcov-result-merger "*.info" > lcov.info
42-
43-
- name: Upload merged coverage to Codacy
44-
uses: codacy/codacy-coverage-reporter-action@v1
45-
with:
46-
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
47-
coverage-reports: ./lcov.info
4834
4935
- name: Build Docker Image
5036
run: docker build . --file FileProcessor/Dockerfile --tag fileprocessor:latest

0 commit comments

Comments
 (0)