Skip to content

build: adding jacoco for test coverage #260

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gradle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: chmod +x ./gradlew

- name: Build and run SonarQube analysis
run: ./gradlew build sonarqube --no-daemon
run: ./gradlew build jacocoTestReport sonarqube --no-daemon
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/gradle-pr-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- name: Build and analyze with Gradle and SonarCloud
run: |
./gradlew build sonarqube --no-daemon \
./gradlew build jacocoTestReport sonarqube --no-daemon \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.organization=iluwatar \
-Dsonar.projectKey=iluwatar_30-seconds-of-java \
Expand Down
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id "org.sonarqube" version "6.1.0.5360"
id 'org.cadixdev.licenser' version '0.6.1'
id 'jacoco'
}

// Apply the java plugin to add support for Java
Expand Down Expand Up @@ -59,10 +60,22 @@ dependencies {
}
}

jacoco {
toolVersion = '0.8.13'
}

test {
useJUnitPlatform()
}

jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
}
}

license {
skipExistingHeaders = true
include '**/*.java'
Expand Down