Skip to content

Commit 80458e1

Browse files
authored
ci: migrate test coverage report to SonarQube (#130)
1 parent ff138ea commit 80458e1

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ jobs:
3636

3737
- name: Test & Coverage Collection
3838
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.dotnet == '7.0.x' }}
39-
run: dotnet test APIMatic.Core.Test/APIMatic.Core.Test.csproj -p:CollectCoverage=true -p:CoverletOutputFormat=lcov
40-
41-
# - name: Upload coverage report
42-
# if: ${{ matrix.os == 'ubuntu-22.04' && matrix.dotnet == '7.0.x' && github.actor != 'dependabot[bot]' }}
43-
# uses: paambaati/[email protected]
44-
# env:
45-
# CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_KEY }}
46-
# with:
47-
# coverageLocations: |
48-
# ${{github.workspace}}/APIMatic.Core.Test/coverage.info:lcov
39+
run: dotnet test APIMatic.Core.Test/APIMatic.Core.Test.csproj -p:CollectCoverage=true -p:CoverletOutputFormat=opencover
40+
41+
- name: SonarQube Scan
42+
if: ${{ github.actor != 'dependabot[bot]' && matrix.os == 'ubuntu-22.04' && matrix.dotnet == '7.0.x' }}
43+
uses: SonarSource/[email protected]
44+
env:
45+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Version][nuget-version]][nuget-url]
44
[![Build & Tests][test-badge]][test-url]
55
[![Test Coverage][coverage-badge]][coverage-url]
6+
[![Vulnerabilities][vulnerabilities-badge]][vulnerabilities-url]
67
[![Maintainability][maintainability-badge]][maintainability-url]
78
[![Licence][license-badge]][license-url]
89

@@ -44,13 +45,17 @@ This project contains core logic and the utilities for the APIMatic's C# SDK
4445

4546
[test-url]: https://github.com/apimatic/core-lib-csharp/actions/workflows/test.yml
4647

47-
[coverage-badge]: https://api.codeclimate.com/v1/badges/d613a5f73f605369e745/test_coverage
48+
[coverage-badge]: https://sonarcloud.io/api/project_badges/measure?project=apimatic_core-lib-csharp&metric=coverage
4849

49-
[coverage-url]: https://codeclimate.com/github/apimatic/core-lib-csharp/test_coverage
50+
[coverage-url]: https://sonarcloud.io/summary/new_code?id=apimatic_core-lib-csharp
5051

51-
[maintainability-badge]: https://api.codeclimate.com/v1/badges/d613a5f73f605369e745/maintainability
52+
[vulnerabilities-badge]: https://sonarcloud.io/api/project_badges/measure?project=apimatic_core-lib-csharp&metric=vulnerabilities
5253

53-
[maintainability-url]: https://codeclimate.com/github/apimatic/core-lib-csharp/maintainability
54+
[vulnerabilities-url]: https://sonarcloud.io/summary/new_code?id=apimatic_core-lib-csharp
55+
56+
[maintainability-badge]: https://sonarcloud.io/api/project_badges/measure?project=apimatic_core-lib-csharp&metric=sqale_rating
57+
58+
[maintainability-url]: https://sonarcloud.io/summary/new_code?id=apimatic_core-lib-csharp
5459

5560
[license-badge]: https://img.shields.io/badge/licence-MIT-blue
5661

sonar-project.properties

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
sonar.projectKey=apimatic_core-lib-csharp
2+
sonar.organization=apimatic
3+
sonar.projectName=APIMatic Core Library C\#
4+
sonar.host.url=https://sonarcloud.io
5+
sonar.sourceEncoding=UTF-8
6+
7+
sonar.sources=APIMatic.Core
8+
9+
sonar.tests=APIMatic.Core.Test
10+
11+
sonar.cs.opencover.reportsPaths=APIMatic.Core.Test/coverage.opencover.xml

0 commit comments

Comments
 (0)