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 Scoverage plugin, coverage check into CI #53

Merged
merged 7 commits into from
Feb 6, 2021
Merged

Conversation

maldins46
Copy link
Contributor

@maldins46 maldins46 commented Feb 1, 2021

This PR is an attempt to solve part of the projects indicated in #52.

Following further researches, Jacoco is not an optimal solution for detecting the code coverage in Scala. Even though it gives you a coverage rate number, Jacoco knows nothing about Scala, and therefore it doesn’t tell you which piece of code you forgot to cover (as stated here).

An optimal solution could be using Scoverage, a tool thought explicitly for Scala code coverage analysis, a state-of-the-art technology for Scala projects. Anyway, we found that this tool presents a problem when used in multi-project parallel builds with Gradle 6.7+ (as our project is), therefore it could not be used at the moment.

Waiting for a better solution, we prepared a "patch" solution, including Jacoco support for the project, without embedding controls into the CI workflow. This way we can trigger a minimum of manual coverage control:

  • triggering jacocoTestReport task, to build and visualize human-readable text reports for the project;
  • triggering jacocoTestCoverageVerification task, to check that the coverage is higher than a given coverage threshold. We have chosen a low threshold, on class coverage only (60% coverage), as with the mentioned above limitations, is a passable one, even if not very truthy.

Here are the highlights of this release:
* Faster Kotlin DSL script compilation
* Vendor selection for Java toolchains
* Convenient execution of tasks in composite builds
* Consistent dependency resolution
@maldins46 maldins46 linked an issue Feb 1, 2021 that may be closed by this pull request
@maldins46
Copy link
Contributor Author

Also, in 7a91a29 we updated the most recent version. This brings some optimization, among which a faster Kotlin DSL script compilation, and do not "brokes" our code, so it's all good for us 📈

@maldins46 maldins46 removed a link to an issue Feb 1, 2021
@maldins46 maldins46 linked an issue Feb 3, 2021 that may be closed by this pull request
@maldins46 maldins46 changed the title Add Jacoco plugin, do not include it into CI Add Scoverage plugin, coverage check into CI Feb 5, 2021
@maldins46
Copy link
Contributor Author

After various attempts, we managed to set up Scoverage into the project, disabling the parallel build feature (as does not give too many advantages to the build time). Now the ci workflows also check the coverage threshold after tests. Provisionally, the threshold is set to 0, but after finishing the test on CLI we should reach 75% coverage into cli and core.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@maldins46 maldins46 merged commit 78ba246 into main Feb 6, 2021
@maldins46 maldins46 deleted the feature/jacoco branch February 6, 2021 09:51
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.

Further QA features
3 participants