Static Code analysis via SonarQube (#2853)

* adds static code analysis and publishes results to Hyperledger account at sonarcloud.

Signed-off-by: Justin Florentine <justin.florentine@consensys.net>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
pull/2928/head
Justin Florentine 3 years ago committed by GitHub
parent 2b92cd8d0e
commit d3c1110a4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      .circleci/config.yml
  2. 13
      build.gradle

@ -50,6 +50,10 @@ commands:
capture_test_results:
description: "Capture test results"
steps:
- run:
name: Jacoco
command: |
./gradlew --no-daemon jacocoTestReport
- run:
name: Gather test results
when: always
@ -64,6 +68,8 @@ commands:
done
- store_test_results:
path: build/test-results
- store_artifacts:
path: besu/build/reports/jacoco
capture_test_logs:
description: "Capture test logs"
@ -134,6 +140,10 @@ jobs:
command: |
./gradlew --no-daemon build
- capture_test_results
- run:
name: SonarQube
no_output_timeout: 30m
command: ./gradlew --no-daemon jacocoRootReport sonarqube -Dsonar.login=$SONAR_TOKEN
integrationTests:
executor: besu_executor_med
@ -270,6 +280,7 @@ workflows:
jobs:
- assemble
- unitTests:
context: SonarCloud
requires:
- assemble
- testWindows:

@ -28,8 +28,20 @@ plugins {
id 'me.champeau.jmh' version '0.6.6' apply false
id 'net.ltgt.errorprone' version '2.0.2'
id 'maven-publish'
id 'org.sonarqube' version '3.3'
}
sonarqube {
properties {
property "sonar.projectKey", "hyperledger_besu"
property "sonar.organization", "hyperledger"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
}
}
project.tasks["sonarqube"].dependsOn "jacocoRootReport"
if (!JavaVersion.current().java11Compatible) {
throw new GradleException("Java 11 or later is required to build Besu.\n" +
" Detected version ${JavaVersion.current()}")
@ -785,6 +797,7 @@ task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
executionData.from fileTree(dir: '.', includes: ['**/jacoco/*.exec'])
reports {
xml.required = true
xml.enabled = true
csv.required = true
html.destination file("build/reports/jacocoHtml")
}

Loading…
Cancel
Save