From 1b5803ff64a17cb6c70f817755db2fb436aa4d6c Mon Sep 17 00:00:00 2001 From: yauheni_patotski Date: Wed, 23 Oct 2024 16:17:53 +0300 Subject: [PATCH 1/4] 1. Code overage for java projects 2. Agregated coverage report --- build.gradle | 27 ++++++++ datahub-graphql-core/build.gradle | 21 +++++++ gradle/coverage/coverage.gradle | 61 +++++++++++++++++++ .../java/openlineage-converter/build.gradle | 4 +- metadata-models/build.gradle | 22 +++++++ .../restli-servlet-impl/build.gradle | 2 +- settings.gradle | 6 +- 7 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 gradle/coverage/coverage.gradle diff --git a/build.gradle b/build.gradle index 67968ce3ee2905..75daff11890e26 100644 --- a/build.gradle +++ b/build.gradle @@ -79,11 +79,13 @@ plugins { id 'com.palantir.docker' version '0.35.0' apply false id 'com.avast.gradle.docker-compose' version '0.17.6' id "com.diffplug.spotless" version "6.23.3" + id 'jacoco-report-aggregation' // https://blog.ltgt.net/javax-jakarta-mess-and-gradle-solution/ // TODO id "org.gradlex.java-ecosystem-capabilities" version "1.0" } apply from: "gradle/docker/docker.gradle" +apply from: "gradle/coverage/coverage.gradle" project.ext.spec = [ 'product' : [ @@ -281,6 +283,7 @@ project.ext.externalDependency = [ allprojects { apply plugin: 'idea' apply plugin: 'eclipse' + apply plugin: 'jacoco' // apply plugin: 'org.gradlex.java-ecosystem-capabilities' tasks.withType(Test).configureEach { task -> if (task.project.name != "metadata-io") { @@ -291,6 +294,7 @@ allprojects { .any { it.getName().contains("testng") }) { useTestNG() } + finalizedBy jacocoTestReport } } @@ -372,6 +376,7 @@ subprojects { apply plugin: 'maven-publish' apply plugin: 'com.gorylenko.gradle-git-properties' apply plugin: 'com.diffplug.spotless' + apply plugin: 'jacoco' gitProperties { keys = ['git.commit.id','git.commit.id.describe','git.commit.time'] @@ -402,6 +407,15 @@ subprojects { } } + jacocoTestReport { + reports { + xml.required = true + csv.required = true + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') + } + dependsOn test // tests are required to run before generating the report + } + spotless { java { googleJavaFormat() @@ -486,3 +500,16 @@ subprojects { } } } + +reporting { + reports { + testCodeCoverageReport(JacocoCoverageReport) { + testType = TestSuiteType.UNIT_TEST + + } + } +} + +tasks.named('check') { + dependsOn tasks.named('testCodeCoverageReport', JacocoReport) +} \ No newline at end of file diff --git a/datahub-graphql-core/build.gradle b/datahub-graphql-core/build.gradle index 49a7fa7fbfbc2f..271058bfc37d92 100644 --- a/datahub-graphql-core/build.gradle +++ b/datahub-graphql-core/build.gradle @@ -55,3 +55,24 @@ tasks.withType(Checkstyle) { compileJava.dependsOn 'graphqlCodegen' sourceSets.main.java.srcDir "$projectDir/src/mainGeneratedGraphQL/java" + +test{ + useTestNG() + finalizedBy jacocoTestReport +} + +def jacocoExclusions = [ + '**/graphql/generated/**' +]; + +jacocoTestReport { + + afterEvaluate { + classDirectories.setFrom(files(classDirectories.files.collect { + fileTree(dir: it, + exclude: jacocoExclusions + ) + })) + } + +} diff --git a/gradle/coverage/coverage.gradle b/gradle/coverage/coverage.gradle new file mode 100644 index 00000000000000..02cb4d3f92abdb --- /dev/null +++ b/gradle/coverage/coverage.gradle @@ -0,0 +1,61 @@ +dependencies { + jacocoAggregation project(':datahub-frontend') + jacocoAggregation project(':datahub-graphql-core') + jacocoAggregation project(':datahub-upgrade') + jacocoAggregation project(':entity-registry') + jacocoAggregation project(':ingestion-scheduler') + jacocoAggregation project(':li-utils') + jacocoAggregation project(':metadata-auth') + jacocoAggregation project(':metadata-dao-impl') + jacocoAggregation project(':metadata-events') + jacocoAggregation project(':metadata-integration') + jacocoAggregation project(':metadata-io') + jacocoAggregation project(':metadata-jobs') + jacocoAggregation project(':metadata-models') + jacocoAggregation project(':metadata-models-custom') + jacocoAggregation project(':metadata-models-validator') + jacocoAggregation project(':metadata-operation-context') + jacocoAggregation project(':metadata-service') + jacocoAggregation project(':metadata-utils') + jacocoAggregation project(':mock-entity-registry') + jacocoAggregation project(':metadata-auth:auth-api') + jacocoAggregation project(':metadata-dao-impl:kafka-producer') + jacocoAggregation project(':metadata-events:mxe-avro') + jacocoAggregation project(':metadata-events:mxe-registration') + jacocoAggregation project(':metadata-events:mxe-schemas') + jacocoAggregation project(':metadata-events:mxe-utils-avro') + jacocoAggregation project(':metadata-integration:java') + jacocoAggregation project(':metadata-io:metadata-io-api') + jacocoAggregation project(':metadata-jobs:common') + jacocoAggregation project(':metadata-jobs:mce-consumer') + jacocoAggregation project(':metadata-jobs:mce-consumer-job') + jacocoAggregation project(':metadata-jobs:pe-consumer') + jacocoAggregation project(':metadata-service:auth-config') + jacocoAggregation project(':metadata-service:auth-filter') + jacocoAggregation project(':metadata-service:auth-impl') + jacocoAggregation project(':metadata-service:auth-servlet-impl') + jacocoAggregation project(':metadata-service:configuration') + jacocoAggregation project(':metadata-service:factories') + jacocoAggregation project(':metadata-service:graphql-servlet-impl') + jacocoAggregation project(':metadata-service:openapi-analytics-servlet') + jacocoAggregation project(':metadata-service:openapi-entity-servlet') + jacocoAggregation project(':metadata-service:openapi-servlet') + jacocoAggregation project(':metadata-service:plugin') + jacocoAggregation project(':metadata-service:restli-api') + jacocoAggregation project(':metadata-service:restli-client') + jacocoAggregation project(':metadata-service:restli-client-api') + jacocoAggregation project(':metadata-service:restli-servlet-impl') + jacocoAggregation project(':metadata-service:schema-registry-api') + jacocoAggregation project(':metadata-service:schema-registry-servlet') + jacocoAggregation project(':metadata-service:services') + jacocoAggregation project(':metadata-service:servlet') + jacocoAggregation project(':metadata-integration:java:acryl-spark-lineage') + jacocoAggregation project(':metadata-integration:java:custom-plugin-lib') + jacocoAggregation project(':metadata-integration:java:datahub-client') + jacocoAggregation project(':metadata-integration:java:datahub-event') + jacocoAggregation project(':metadata-integration:java:datahub-protobuf') + jacocoAggregation project(':metadata-integration:java:examples') + jacocoAggregation project(':metadata-integration:java:openlineage-converter') + jacocoAggregation project(':metadata-service:openapi-entity-servlet:generators') + jacocoAggregation project(':metadata-service:openapi-servlet:models') +} \ No newline at end of file diff --git a/metadata-integration/java/openlineage-converter/build.gradle b/metadata-integration/java/openlineage-converter/build.gradle index 2e04881ab5ccda..6a2490aa536a20 100644 --- a/metadata-integration/java/openlineage-converter/build.gradle +++ b/metadata-integration/java/openlineage-converter/build.gradle @@ -33,12 +33,12 @@ jacocoTestReport { test { forkEvery = 1 - useJUnit() + useTestNG() finalizedBy jacocoTestReport } test { - useJUnit() + useTestNG() finalizedBy jacocoTestReport } shadowJar { diff --git a/metadata-models/build.gradle b/metadata-models/build.gradle index 179e1eac177ac8..04a06db4136b87 100644 --- a/metadata-models/build.gradle +++ b/metadata-models/build.gradle @@ -74,3 +74,25 @@ task cleanExtraDirs { delete "$projectDir/src/generatedJsonSchema" } clean.finalizedBy(cleanExtraDirs) + + +test{ + useTestNG() + finalizedBy jacocoTestReport +} + +def jacocoExclusions = [ + '**/openapi/generated/**' +]; + +jacocoTestReport { + + afterEvaluate { + classDirectories.setFrom(files(classDirectories.files.collect { + fileTree(dir: it, + exclude: jacocoExclusions + ) + })) + } + +} \ No newline at end of file diff --git a/metadata-service/restli-servlet-impl/build.gradle b/metadata-service/restli-servlet-impl/build.gradle index 6b68abfe7fb15c..4a47c571bfb1de 100644 --- a/metadata-service/restli-servlet-impl/build.gradle +++ b/metadata-service/restli-servlet-impl/build.gradle @@ -79,7 +79,7 @@ dependencies { task integrationTest(type: Test) { description = 'Runs integration tests.' group = 'verification' - useJUnitPlatform() + useTestNG() testClassesDirs = sourceSets.integTest.output.classesDirs classpath = sourceSets.integTest.runtimeClasspath diff --git a/settings.gradle b/settings.gradle index fa1fdb9f1a67ce..04d122c63d3a9e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -39,8 +39,8 @@ include ':docker:datahub-ingestion' include ':docker:datahub-ingestion-base' include 'metadata-models' include 'metadata-models-validator' -include 'metadata-testing:metadata-models-test-utils' -include 'metadata-testing:metadata-test-utils' +//include 'metadata-testing:metadata-models-test-utils' +//include 'metadata-testing:metadata-test-utils' include 'entity-registry' include 'metadata-io' include 'metadata-io:metadata-io-api' @@ -48,7 +48,7 @@ include 'datahub-upgrade' include 'metadata-utils' include 'li-utils' include 'test-models' -include 'metadata-perf' +//include 'metadata-perf' include 'docs-website' include 'metadata-models-custom' include 'entity-registry:custom-test-model' From fc798167ded48b1f6f0fc171e66a119044b69130 Mon Sep 17 00:00:00 2001 From: yauheni_patotski Date: Wed, 23 Oct 2024 16:22:44 +0300 Subject: [PATCH 2/4] Added delta code coverage --- build.gradle | 97 ++++++--- .../resources/MetadataChangeProposal.avsc | 188 ------------------ 2 files changed, 70 insertions(+), 215 deletions(-) delete mode 100644 metadata-integration/java/datahub-event/src/main/resources/MetadataChangeProposal.avsc diff --git a/build.gradle b/build.gradle index 75daff11890e26..da6c5923390636 100644 --- a/build.gradle +++ b/build.gradle @@ -74,14 +74,16 @@ buildscript { } plugins { - id 'com.gorylenko.gradle-git-properties' version '2.4.1' - id 'com.github.johnrengelman.shadow' version '8.1.1' apply false - id 'com.palantir.docker' version '0.35.0' apply false - id 'com.avast.gradle.docker-compose' version '0.17.6' - id "com.diffplug.spotless" version "6.23.3" - id 'jacoco-report-aggregation' - // https://blog.ltgt.net/javax-jakarta-mess-and-gradle-solution/ - // TODO id "org.gradlex.java-ecosystem-capabilities" version "1.0" + id 'com.gorylenko.gradle-git-properties' version '2.4.1' + id 'com.github.johnrengelman.shadow' version '8.1.1' apply false + id 'com.palantir.docker' version '0.35.0' apply false + id 'com.avast.gradle.docker-compose' version '0.17.6' + id "com.diffplug.spotless" version "6.23.3" + id 'jacoco-report-aggregation' + id 'io.github.surpsg.delta-coverage' version "2.5.0" +// id "io.github.gw-kit.delta-coverage" version "3.0.0-RC1" + + // TODO id "org.gradlex.java-ecosystem-capabilities" version "1.0" } apply from: "gradle/docker/docker.gradle" @@ -378,15 +380,31 @@ subprojects { apply plugin: 'com.diffplug.spotless' apply plugin: 'jacoco' - gitProperties { - keys = ['git.commit.id','git.commit.id.describe','git.commit.time'] - // using any tags (not limited to annotated tags) for "git.commit.id.describe" property - // see http://ajoberstar.org/grgit/grgit-describe.html for more info about the describe method and available parameters - // 'it' is an instance of org.ajoberstar.grgit.Grgit - customProperty 'git.commit.id.describe', { it.describe(tags: true) } - failOnNoGitDirectory = false + if (!project.name.contains('docker') + && !project.name.contains('web-react') + && !project.name.contains('metadata-ingestion') + && !project.name.contains('metadata-auth') + && !project.name.contains('metadata-dao-impl') + && !project.name.contains('metadata-events') + && !project.name.contains('metadata-integration') + && !project.name.contains('metadata-jobs') + && !project.name.contains('metadata-service') + && !project.name.contains('smoke-test') + && !project.name.contains('docs-website') + ){ + apply plugin: 'io.github.surpsg.delta-coverage' } + + gitProperties { + keys = ['git.commit.id', 'git.commit.id.describe', 'git.commit.time'] + // using any tags (not limited to annotated tags) for "git.commit.id.describe" property + // see http://ajoberstar.org/grgit/grgit-describe.html for more info about the describe method and available parameters + // 'it' is an instance of org.ajoberstar.grgit.Grgit + customProperty 'git.commit.id.describe', { it.describe(tags: true) } + failOnNoGitDirectory = false + } + plugins.withType(JavaPlugin).configureEach { if (project.name == 'datahub-web-react') { return @@ -416,21 +434,44 @@ subprojects { dependsOn test // tests are required to run before generating the report } - spotless { - java { - googleJavaFormat() - target project.fileTree(project.projectDir) { - include 'src/**/*.java' - exclude 'src/**/resources/' - exclude 'src/**/generated/' - exclude 'src/**/mainGeneratedDataTemplate/' - exclude 'src/**/mainGeneratedRest/' - exclude 'src/renamed/avro/' - exclude 'src/test/sample-test-plugins/' - } + deltaCoverageReport { + diffSource { + git.compareWith('refs/remotes/origin/master') + git.useNativeGit.set(true) + } + + coverageBinaryFiles = files(projectDir.path + "/build/jacoco/test.exec") + srcDirs = files(projectDir.path +"/src") + classesDirs = files(projectDir.path + "/build/classes") +// violationRules.failIfCoverageLessThan 0.9d + + reports { + html.set(true) + markdown.set(true) } } + task openDiffReport() { + doLast { + java.awt.Desktop.desktop.browse "file://".concat(buildDir.path).concat("/reports/coverage-reports/delta-coverage/html/index.html").toURI() + } + } + + spotless { + java { + googleJavaFormat() + target project.fileTree(project.projectDir) { + include 'src/**/*.java' + exclude 'src/**/resources/' + exclude 'src/**/generated/' + exclude 'src/**/mainGeneratedDataTemplate/' + exclude 'src/**/mainGeneratedRest/' + exclude 'src/renamed/avro/' + exclude 'src/test/sample-test-plugins/' + } + } + } + if (project.plugins.hasPlugin('pegasus')) { dependencies { dataTemplateCompile spec.product.pegasus.data @@ -448,6 +489,8 @@ subprojects { options.release = javaClassVersion(project) } + + tasks.withType(JavaCompile).configureEach { javaCompiler = javaToolchains.compilerFor { languageVersion = JavaLanguageVersion.of(jdkVersion(project)) diff --git a/metadata-integration/java/datahub-event/src/main/resources/MetadataChangeProposal.avsc b/metadata-integration/java/datahub-event/src/main/resources/MetadataChangeProposal.avsc deleted file mode 100644 index 126d5cf6bcee38..00000000000000 --- a/metadata-integration/java/datahub-event/src/main/resources/MetadataChangeProposal.avsc +++ /dev/null @@ -1,188 +0,0 @@ -{ - "type" : "record", - "name" : "MetadataChangeProposal", - "namespace" : "com.linkedin.pegasus2avro.mxe", - "doc" : "Kafka event for proposing a metadata change for an entity. A corresponding MetadataChangeLog is emitted when the change is accepted and committed, otherwise a FailedMetadataChangeProposal will be emitted instead.", - "fields" : [ { - "name" : "auditHeader", - "type" : [ "null", { - "type" : "record", - "name" : "KafkaAuditHeader", - "namespace" : "com.linkedin.events", - "doc" : "This header records information about the context of an event as it is emitted into kafka and is intended to be used by the kafka audit application. For more information see go/kafkaauditheader", - "fields" : [ { - "name" : "time", - "type" : "long", - "doc" : "The time at which the event was emitted into kafka.", - "compliance" : [ { - "policy" : "EVENT_TIME" - } ] - }, { - "name" : "server", - "type" : "string", - "doc" : "The fully qualified name of the host from which the event is being emitted.", - "compliance" : "NONE" - }, { - "name" : "instance", - "type" : [ "null", "string" ], - "doc" : "The instance on the server from which the event is being emitted. e.g. i001", - "default" : null, - "compliance" : "NONE" - }, { - "name" : "appName", - "type" : "string", - "doc" : "The name of the application from which the event is being emitted. see go/appname", - "compliance" : "NONE" - }, { - "name" : "messageId", - "type" : { - "type" : "fixed", - "name" : "UUID", - "size" : 16 - }, - "doc" : "A unique identifier for the message", - "compliance" : "NONE" - }, { - "name" : "auditVersion", - "type" : [ "null", "int" ], - "doc" : "The version that is being used for auditing. In version 0, the audit trail buckets events into 10 minute audit windows based on the EventHeader timestamp. In version 1, the audit trail buckets events as follows: if the schema has an outer KafkaAuditHeader, use the outer audit header timestamp for bucketing; else if the EventHeader has an inner KafkaAuditHeader use that inner audit header's timestamp for bucketing", - "default" : null, - "compliance" : "NONE" - }, { - "name" : "fabricUrn", - "type" : [ "null", "string" ], - "doc" : "The fabricUrn of the host from which the event is being emitted. Fabric Urn in the format of urn:li:fabric:{fabric_name}. See go/fabric.", - "default" : null, - "compliance" : "NONE" - }, { - "name" : "clusterConnectionString", - "type" : [ "null", "string" ], - "doc" : "This is a String that the client uses to establish some kind of connection with the Kafka cluster. The exact format of it depends on specific versions of clients and brokers. This information could potentially identify the fabric and cluster with which the client is producing to or consuming from.", - "default" : null, - "compliance" : "NONE" - } ] - } ], - "doc" : "Kafka audit header. Currently remains unused in the open source.", - "default" : null - }, { - "name" : "entityType", - "type" : "string", - "doc" : "Type of the entity being written to" - }, { - "name" : "entityUrn", - "type" : [ "null", "string" ], - "doc" : "Urn of the entity being written", - "default" : null, - "java" : { - "class" : "com.linkedin.pegasus2avro.common.urn.Urn" - } - }, { - "name" : "entityKeyAspect", - "type" : [ "null", { - "type" : "record", - "name" : "GenericAspect", - "doc" : "Generic record structure for serializing an Aspect", - "fields" : [ { - "name" : "value", - "type" : "bytes", - "doc" : "The value of the aspect, serialized as bytes." - }, { - "name" : "contentType", - "type" : "string", - "doc" : "The content type, which represents the fashion in which the aspect was serialized.\nThe only type currently supported is application/json." - } ] - } ], - "doc" : "Key aspect of the entity being written", - "default" : null - }, { - "name" : "changeType", - "type" : { - "type" : "enum", - "name" : "ChangeType", - "namespace" : "com.linkedin.pegasus2avro.events.metadata", - "doc" : "Descriptor for a change action", - "symbols" : [ "UPSERT", "CREATE", "UPDATE", "DELETE", "PATCH", "RESTATE", "CREATE_ENTITY" ], - "symbolDocs" : { - "CREATE" : "insert if not exists. otherwise fail", - "CREATE_ENTITY" : "insert if entity not exists. otherwise fail", - "DELETE" : "delete action", - "PATCH" : "patch the changes instead of full replace", - "RESTATE" : "Restate an aspect, eg. in a index refresh.", - "UPDATE" : "NOT SUPPORTED YET\nupdate if exists. otherwise fail", - "UPSERT" : "insert if not exists. otherwise update" - } - }, - "doc" : "Type of change being proposed" - }, { - "name" : "aspectName", - "type" : [ "null", "string" ], - "doc" : "Aspect of the entity being written to\nNot filling this out implies that the writer wants to affect the entire entity\nNote: This is only valid for CREATE, UPSERT, and DELETE operations.", - "default" : null - }, { - "name" : "aspect", - "type" : [ "null", "GenericAspect" ], - "doc" : "The value of the new aspect.", - "default" : null - }, { - "name" : "systemMetadata", - "type" : [ "null", { - "type" : "record", - "name" : "SystemMetadata", - "doc" : "Metadata associated with each metadata change that is processed by the system", - "fields" : [ { - "name" : "lastObserved", - "type" : [ "long", "null" ], - "doc" : "The timestamp the metadata was observed at", - "default" : 0 - }, { - "name" : "runId", - "type" : [ "string", "null" ], - "doc" : "The original run id that produced the metadata. Populated in case of batch-ingestion.", - "default" : "no-run-id-provided" - }, { - "name" : "lastRunId", - "type" : [ "string", "null" ], - "doc" : "The last run id that produced the metadata. Populated in case of batch-ingestion.", - "default" : "no-run-id-provided" - }, { - "name" : "pipelineName", - "type" : [ "null", "string" ], - "doc" : "The ingestion pipeline id that produced the metadata. Populated in case of batch ingestion.", - "default" : null - }, { - "name" : "registryName", - "type" : [ "null", "string" ], - "doc" : "The model registry name that was used to process this event", - "default" : null - }, { - "name" : "registryVersion", - "type" : [ "null", "string" ], - "doc" : "The model registry version that was used to process this event", - "default" : null - }, { - "name" : "properties", - "type" : [ "null", { - "type" : "map", - "values" : "string" - } ], - "doc" : "Additional properties", - "default" : null - }, { - "name" : "version", - "type" : [ "null", "string" ], - "doc" : "Aspect version\n Initial implementation will use the aspect version's number, however stored as\n a string in the case where a different aspect versioning scheme is later adopted.", - "default" : null - } ] - } ], - "doc" : "System properties that one might want to attach to an event", - "default" : null - }, { - "name" : "headers", - "type" : [ "null", { - "type" : "map", - "values" : "string" - } ], - "doc" : "Headers - intended to mimic http headers", - "default" : null - } ] -} \ No newline at end of file From 48f1d8093718f596b847303848ad79bf1743bfcf Mon Sep 17 00:00:00 2001 From: yauheni_patotski Date: Thu, 24 Oct 2024 15:39:17 +0300 Subject: [PATCH 3/4] added sonar integration --- .github/workflows/sonar-cloud.yml | 37 +++++++++++++++++++++++++++++++ build.gradle | 21 ++++++++++++++++++ sonar-project.properties | 4 ++++ 3 files changed, 62 insertions(+) create mode 100644 .github/workflows/sonar-cloud.yml create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonar-cloud.yml b/.github/workflows/sonar-cloud.yml new file mode 100644 index 00000000000000..a8f7e0697a8c4e --- /dev/null +++ b/.github/workflows/sonar-cloud.yml @@ -0,0 +1,37 @@ +name: SonarCloud +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'zulu' # Alternative distribution options are available + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Gradle packages + uses: actions/cache@v3 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ./gradlew test sonar --info diff --git a/build.gradle b/build.gradle index da6c5923390636..f57459be07d47a 100644 --- a/build.gradle +++ b/build.gradle @@ -81,6 +81,7 @@ plugins { id "com.diffplug.spotless" version "6.23.3" id 'jacoco-report-aggregation' id 'io.github.surpsg.delta-coverage' version "2.5.0" + id 'org.sonarqube' version "5.1.0.4882" // id "io.github.gw-kit.delta-coverage" version "3.0.0-RC1" // TODO id "org.gradlex.java-ecosystem-capabilities" version "1.0" @@ -282,6 +283,18 @@ project.ext.externalDependency = [ 'mustache': 'com.github.spullara.mustache.java:compiler:0.9.14' ] +sonarqube { + properties { + property "sonar.sourceEncoding", "UTF-8" + property "sonar.projectKey", "datahub-project_datahub" + property "sonar.organization", "datahub-project" + property "sonar.host.url", "https://sonarcloud.io" + property "sonar.coverage.jacoco.xmlReportPaths", "$projectDir.parentFile.path/build/reports/jacoco/test/jacocoTestReport.xml" + + property "sonar.python.coverage.reportPaths", "https://sonarcloud.io" + } +} + allprojects { apply plugin: 'idea' apply plugin: 'eclipse' @@ -379,6 +392,7 @@ subprojects { apply plugin: 'com.gorylenko.gradle-git-properties' apply plugin: 'com.diffplug.spotless' apply plugin: 'jacoco' + apply plugin: 'org.sonarqube' if (!project.name.contains('docker') && !project.name.contains('web-react') @@ -472,6 +486,13 @@ subprojects { } } + sonarqube { + properties { + property "sonar.coverage.jacoco.xmlReportPaths", "$projectDir.parentFile.path/build/reports/jacoco/test/jacocoTestReport.xml" + p + } + } + if (project.plugins.hasPlugin('pegasus')) { dependencies { dataTemplateCompile spec.product.pegasus.data diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000000000..07e11330106f43 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,4 @@ +sonar.projectKey=datahub-project_datahub +sonar.sources=. +sonar.organization=datahub-project +sonar.host.url=https://sonarcloud.io From 48471a455afb4df14333550eaff413ea0fdd4a4d Mon Sep 17 00:00:00 2001 From: yauheni_patotski Date: Thu, 24 Oct 2024 16:42:10 +0300 Subject: [PATCH 4/4] fix typo --- build.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.gradle b/build.gradle index f57459be07d47a..4d0560836d4327 100644 --- a/build.gradle +++ b/build.gradle @@ -290,7 +290,6 @@ sonarqube { property "sonar.organization", "datahub-project" property "sonar.host.url", "https://sonarcloud.io" property "sonar.coverage.jacoco.xmlReportPaths", "$projectDir.parentFile.path/build/reports/jacoco/test/jacocoTestReport.xml" - property "sonar.python.coverage.reportPaths", "https://sonarcloud.io" } } @@ -489,7 +488,6 @@ subprojects { sonarqube { properties { property "sonar.coverage.jacoco.xmlReportPaths", "$projectDir.parentFile.path/build/reports/jacoco/test/jacocoTestReport.xml" - p } }