Skip to content

Commit

Permalink
Merge pull request #1950 from web3j/code_cov_2
Browse files Browse the repository at this point in the history
Codecov
  • Loading branch information
gtebrean authored Aug 21, 2023
2 parents 5cda8b0 + 038dfea commit fd9be0b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build
run: ./gradlew check jacocoRootTestReport
run: ./gradlew test
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
# queries: security-extended,security-and-quality

- name: Build
run: ./gradlew check jacocoRootTestReport
run: ./gradlew test

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Expand Down
15 changes: 0 additions & 15 deletions abi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,3 @@ dependencies {

tasks.named("spotlessJava").configure { dependsOn("spotlessGroovyGradle","compileJava","compileTestJava","javadoc","test") }
tasks.named("spotlessKotlin").configure { dependsOn("compileJava","spotlessJava", "spotlessGroovyGradle","compileTestJava","processTestResources","javadoc","test") }
tasks.named("jacocoRootTestReport").configure { dependsOn("compileJava","compileTestJava","javadoc","test", "spotlessGroovyGradle", "spotlessKotlin","spotlessJava") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":besu:compileJava",":besu:compileTestJava",":besu:javadoc",":besu:test", ":besu:spotlessGroovyGradle", ":besu:spotlessJava",":besu:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":test",":spotlessGroovyGradle",":spotlessJava",":spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":codegen:compileJava",":codegen:compileTestJava",":codegen:javadoc",":codegen:test",":codegen:processTestResources",":codegen:spotlessGroovyGradle", ":codegen:spotlessJava",":codegen:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":contracts:compileJava",":contracts:javadoc",":contracts:test",":contracts:processResources",":contracts:spotlessGroovyGradle", ":contracts:spotlessJava",":contracts:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":core:javadoc",":core:test",":core:spotlessGroovyGradle", ":core:spotlessJava",":core:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":crypto:javadoc",":crypto:test",":crypto:spotlessGroovyGradle", ":crypto:spotlessJava",":crypto:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":eea:compileTestJava",":eea:javadoc",":eea:test",":eea:spotlessGroovyGradle", ":eea:spotlessJava",":eea:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":geth:compileJava",":geth:compileTestJava",":geth:javadoc",":geth:test",":geth:spotlessGroovyGradle", ":geth:spotlessJava",":geth:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":hosted-providers:compileJava",":hosted-providers:compileTestJava",":hosted-providers:javadoc",":hosted-providers:test",":hosted-providers:spotlessGroovyGradle", ":hosted-providers:spotlessJava",":hosted-providers:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":integration-tests:compileTestJava",":integration-tests:processTestResources",":integration-tests:spotlessGroovyGradle", ":integration-tests:spotlessJava",":integration-tests:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":parity:compileJava",":parity:compileTestJava",":parity:javadoc",":parity:test",":parity:spotlessGroovyGradle", ":parity:spotlessJava",":parity:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":rlp:compileTestJava",":rlp:javadoc",":rlp:test",":rlp:spotlessGroovyGradle", ":rlp:spotlessJava",":rlp:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":tuples:javadoc",":tuples:test",":tuples:spotlessGroovyGradle", ":tuples:spotlessJava",":tuples:spotlessKotlin") }
tasks.named("jacocoRootTestReport").configure { dependsOn(":utils:javadoc",":utils:test",":utils:spotlessGroovyGradle", ":utils:spotlessJava",":utils:spotlessKotlin") }
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'java'
id 'idea'
id 'org.sonarqube' version '3.4.0.2513'
id 'jacoco'
id 'com.diffplug.gradle.spotless' version '4.5.1'
id 'io.codearte.nexus-staging' version '0.22.0'
Expand Down Expand Up @@ -98,5 +99,6 @@ configure(subprojects.findAll { it.name != 'integration-tests' }) {
apply from: "$rootDir/gradle/jacoco/build.gradle"
}


tasks.named("spotlessJava").configure { dependsOn("spotlessGroovyGradle") }
tasks.named("spotlessKotlin").configure { dependsOn("spotlessJava", "spotlessGroovyGradle") }
45 changes: 21 additions & 24 deletions gradle/jacoco/build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
apply plugin: 'jacoco'
apply(plugin: 'jacoco')

task jacocoRootTestReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}

doFirst {
executionData.fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
getExecutionData().from(executionData.findAll { it.exists() })
jacocoTestReport {
classDirectories.from files(subprojects.sourceSets.main.output).asFileTree.matching {
exclude 'org/web3j/abi/datatypes/generated/**',
'org/web3j/tuples/generated/**',
'org/web3j/ens/contracts/generated/**',
'org/gradle/**'
}

dependsOn(subprojects.test)

getSourceDirectories().from(subprojects.sourceSets.main.allSource.srcDirs)
getAdditionalSourceDirs().from(subprojects.sourceSets.main.allSource.srcDirs)
getClassDirectories().from(subprojects.sourceSets.main.output)
executionData.from(subprojects.jacocoTestReport.executionData)

dependsOn test
reports {
xml.enabled true
html.enabled false
csv.enabled false
xml.destination file("${buildDir}/reports/jacoco.xml")
}
}

afterEvaluate {
getClassDirectories().from(files(classDirectories.files.collect {
fileTree(dir: it,
exclude: [
'org/web3j/abi/datatypes/generated/**',
'org/web3j/tuples/generated/**',
'org/web3j/ens/contracts/generated/**',
'org/gradle/**'
])
}))
sonarqube {
properties {
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco.xml"
}
}

jacoco {
toolVersion = "0.8.10"
toolVersion = "0.8.8"
}

3 changes: 3 additions & 0 deletions gradle/repositories/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
repositories {
mavenCentral()
maven {
url = uri("https://plugins.gradle.org/m2/")
}
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/releases/' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
Expand Down

0 comments on commit fd9be0b

Please sign in to comment.