Skip to content

Commit 0cdcd20

Browse files
Merge pull request #69 from vivopensource/68-add-coverage-info-on-repo
Adds coverage info #68
2 parents 929edd0 + 24ec8c5 commit 0cdcd20

File tree

4 files changed

+171
-65
lines changed

4 files changed

+171
-65
lines changed

.github/workflows/pull_request.yml

Lines changed: 74 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
name: Pull Request
33

44
on:
@@ -8,35 +8,88 @@ on:
88

99
jobs:
1010

11-
test:
11+
test-linux:
12+
13+
runs-on: ubuntu-latest
14+
15+
env:
16+
Solution_Name: GofPatterns.sln
17+
Test_Project_Path: GofPatternsTests\GofPatternsTests.csproj
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Install .NET Core
26+
uses: actions/setup-dotnet@v3
27+
with:
28+
dotnet-version: 6.0.x
1229

13-
strategy:
14-
matrix:
15-
configuration: [Debug]
16-
os: [windows-latest, ubuntu-latest]
30+
- name: Restore dependencies
31+
run: dotnet restore
1732

18-
runs-on: ${{ matrix.os }}
33+
- name: Build
34+
run: dotnet build --configuration Debug --no-restore
35+
36+
- name: Test
37+
run: dotnet test --configuration Debug --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
38+
39+
- name: Code Coverage Result MD
40+
uses: irongut/CodeCoverageSummary@v1.3.0
41+
with:
42+
filename: coverage/**/coverage.cobertura.xml
43+
badge: true
44+
fail_below_min: true
45+
format: markdown
46+
hide_branch_rate: false
47+
hide_complexity: true
48+
indicators: true
49+
output: both
50+
thresholds: '80 90'
51+
52+
- name: Code Coverage Result MD
53+
uses: marocchino/sticky-pull-request-comment@v2
54+
with:
55+
recreate: true
56+
path: code-coverage-results.md
57+
58+
- name: Write to Job Summary
59+
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
60+
61+
test-windows:
62+
63+
runs-on: windows-latest
1964

2065
env:
2166
Solution_Name: GofPatterns.sln
2267
Test_Project_Path: GofPatternsTests\GofPatternsTests.csproj
2368

2469
steps:
25-
- name: Checkout
26-
uses: actions/checkout@v3
27-
with:
28-
fetch-depth: 0
70+
- name: Checkout
71+
uses: actions/checkout@v3
72+
with:
73+
fetch-depth: 0
74+
75+
- name: Install .NET Core
76+
uses: actions/setup-dotnet@v3
77+
with:
78+
dotnet-version: 6.0.x
79+
80+
- name: Setup MSBuild.exe
81+
uses: microsoft/setup-msbuild@v1.0.2
2982

30-
- name: Install .NET Core
31-
uses: actions/setup-dotnet@v3
32-
with:
33-
dotnet-version: 6.0.x
83+
- name: Restore dependencies
84+
run: dotnet restore
3485

35-
- name: Restore dependencies
36-
run: dotnet restore
86+
- name: Build
87+
run: dotnet build
3788

38-
- name: Build
39-
run: dotnet build
89+
- name: Test
90+
run: dotnet test
4091

41-
- name: Test
42-
run: dotnet test
92+
- name: Restore the application
93+
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
94+
env:
95+
Configuration: Debug

.github/workflows/release.yml

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
branches:
77
- 'main'
88

9-
109
jobs:
1110

1211
release:
@@ -18,27 +17,49 @@ jobs:
1817
Test_Project_Path: GofPatternsTests\GofPatternsTests.csproj
1918

2019
steps:
21-
- uses: actions/checkout@v3
22-
with:
23-
fetch-depth: 0
24-
25-
- name: Install .NET Core
26-
uses: actions/setup-dotnet@v3
27-
with:
28-
dotnet-version: 6.0.x
29-
30-
- name: Restore dependencies
31-
run: dotnet restore
32-
33-
- name: Build
34-
run: dotnet build -c Release --no-restore
35-
36-
- name: Test
37-
run: dotnet test -c Release --no-restore --no-build --verbosity normal --filter "Category!=LongRunning"
38-
39-
- name: Pack
40-
run: dotnet pack GofPatterns/GofPatterns.csproj -c Release --no-restore --no-build --include-symbols -p:SymbolPackageFormat=snupkg -o .
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Install .NET Core
25+
uses: actions/setup-dotnet@v3
26+
with:
27+
dotnet-version: 6.0.x
28+
29+
- name: Restore dependencies
30+
run: dotnet restore
31+
32+
- name: Build
33+
run: dotnet build -c Release --no-restore
34+
35+
- name: Test
36+
run: dotnet test -c Release --no-restore --no-build --verbosity normal --filter "Category!=LongRunning" --collect:"XPlat Code Coverage" --results-directory ./coverage
37+
38+
- name: Code Coverage Report
39+
uses: irongut/CodeCoverageSummary@v1.3.0
40+
with:
41+
filename: coverage/**/coverage.cobertura.xml
42+
badge: true
43+
fail_below_min: true
44+
format: markdown
45+
hide_branch_rate: false
46+
hide_complexity: true
47+
indicators: true
48+
output: both
49+
thresholds: '80 90'
50+
51+
- name: Code Coverage Result MD
52+
uses: marocchino/sticky-pull-request-comment@v2
53+
with:
54+
recreate: true
55+
path: code-coverage-results.md
56+
57+
- name: Write to Job Summary
58+
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
59+
60+
- name: Pack
61+
run: dotnet pack GofPatterns/GofPatterns.csproj -c Release --no-restore --no-build --include-symbols -p:SymbolPackageFormat=snupkg -o .
4162

42-
# Push to NuGet
43-
- name: Deploy
44-
run: dotnet nuget push *.nupkg --skip-duplicate -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}
63+
# Push to NuGet
64+
- name: Deploy
65+
run: dotnet nuget push *.nupkg --skip-duplicate -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}

.github/workflows/test.yml

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
push:
66
branches:
77
- '**'
8-
- '!master'
8+
- '!main'
99
- '!dev'
1010

1111
jobs:
@@ -19,21 +19,43 @@ jobs:
1919
Test_Project_Path: GofPatternsTests\GofPatternsTests.csproj
2020

2121
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v3
24-
with:
25-
fetch-depth: 0
26-
27-
- name: Install .NET Core
28-
uses: actions/setup-dotnet@v3
29-
with:
30-
dotnet-version: 6.0.x
31-
32-
- name: Restore dependencies
33-
run: dotnet restore
34-
35-
- name: Build
36-
run: dotnet build
37-
38-
- name: Test
39-
run: dotnet test
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Install .NET Core
28+
uses: actions/setup-dotnet@v3
29+
with:
30+
dotnet-version: 6.0.x
31+
32+
- name: Restore dependencies
33+
run: dotnet restore
34+
35+
- name: Build
36+
run: dotnet build --configuration Debug --no-restore
37+
38+
- name: Test
39+
run: dotnet test --configuration Debug --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
40+
41+
- name: Code Coverage Result MD
42+
uses: irongut/CodeCoverageSummary@v1.3.0
43+
with:
44+
filename: coverage/**/coverage.cobertura.xml
45+
badge: true
46+
fail_below_min: true
47+
format: markdown
48+
hide_branch_rate: false
49+
hide_complexity: true
50+
indicators: true
51+
output: both
52+
thresholds: '80 90'
53+
54+
- name: Code Coverage Result MD
55+
uses: marocchino/sticky-pull-request-comment@v2
56+
with:
57+
recreate: true
58+
path: code-coverage-results.md
59+
60+
- name: Write to Job Summary
61+
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,14 @@ just click on the link of the design pattern to go to the respective page of the
5353

5454
- [Factory](README/Creational/Factory.md)
5555
- [Abstract Factory](README/Creational/AbstractFactory.md)
56-
- [Builder](README/Creational/Builder.md)
56+
- [Builder](README/Creational/Builder.md)
57+
58+
59+
## Code coverage
60+
61+
- The code coverage is exceptional for the library, and the examples provided for each pattern
62+
- The library is tested for all the patterns, and the examples are also tested for the patterns they are demonstrating.
63+
64+
### Result
65+
66+
To view the coverage result please see the Actions tab of the repository.

0 commit comments

Comments
 (0)