Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sonar coverage reporting to master build #184

Merged
merged 4 commits into from
Oct 17, 2020
Merged

Add sonar coverage reporting to master build #184

merged 4 commits into from
Oct 17, 2020

Conversation

jimschubert
Copy link
Member

Submits analysis to sonar on master branch build.

New sonar project is at https://sonarcloud.io/dashboard?id=OpenAPITools_openapi-diff

This submits sonar for the Java 11 build. Sonar will complain for any code submitted and built against Java 8, as support for Java 8 will be removed soon. This also adds and configures Jacoco for coverage instrumentation in the root pom. The sonar.branch.name configuration is dynamic as this would allow extending this workflow for other branches without submitting these all to master.

As a side note, there's no clean way to run a sonar PR check because Sonar requires a secret token and these are not available in the pull_request event. We might be able to work something out with the pull_request_target event (which runs in the scope of the master branch), but that would require a bit of work and poses a potential security risk. Sonar also doesn't support automated checks for compiled languages.

I haven't included a sonar badge in the readme here. Some options are below.

"official" badge

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=OpenAPITools_openapi-diff&metric=alert_status)](https://sonarcloud.io/dashboard?id=OpenAPITools_openapi-diff)

Renders as:

Quality Gate Status

Coverage Shield

![Sonar Coverage](https://img.shields.io/sonar/coverage/OpenAPITools_openapi-diff?color=blue&label=Code%20Coverage&server=https%3A%2F%2Fsonarcloud.io&style=flat-square)

Renders as:

Sonar Coverage

Quality Gate Shield

![Sonar Quality Gate](https://img.shields.io/sonar/quality_gate/OpenAPITools_openapi-diff?label=Quality%20Gate&server=https%3A%2F%2Fsonarcloud.io&style=flat-square)

Renders as:

Sonar Quality Gate

Total Tests Shield

![Sonar Test Count](https://img.shields.io/sonar/total_tests/OpenAPITools_openapi-diff?label=Total%20Tests&server=https%3A%2F%2Fsonarcloud.io&style=flat-square)

Renders as:

Sonar Test Count

@jimschubert jimschubert requested a review from joschi October 15, 2020 03:04
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 9 Code Smells

0.0% 0.0% Coverage
1.5% 1.5% Duplication

@joschi joschi added this to the Release 2.0.0 milestone Oct 17, 2020
@joschi joschi merged commit e0dc03f into master Oct 17, 2020
@joschi joschi deleted the sonar branch October 19, 2020 06:51
joschi added a commit that referenced this pull request Nov 3, 2020
Forked repositories don't have access to the `SONAR_TOKEN` secret and thus cannot run the SonarCloud analysis as part of the build.

Refs #184
joschi added a commit that referenced this pull request Dec 6, 2020
Forked repositories don't have access to the `SONAR_TOKEN` secret and thus cannot run the SonarCloud analysis as part of the build.

Refs #184
joschi added a commit that referenced this pull request Dec 6, 2020
Forked repositories don't have access to the `SONAR_TOKEN` secret and thus cannot run the SonarCloud analysis as part of the build.

Refs #184
joschi added a commit that referenced this pull request Dec 6, 2020
Forked repositories don't have access to the `SONAR_TOKEN` secret and thus cannot run the SonarCloud analysis as part of the build.

Refs #184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants