From b9b6cca54de6cc78f0363b11ec1a657899922f4e Mon Sep 17 00:00:00 2001 From: Marcin Stachniuk Date: Thu, 12 Dec 2024 16:06:01 +0100 Subject: [PATCH 1/4] SONARGO-75 Onboard sonar-go to Develocity --- gradle.properties | 1 + settings.gradle | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/gradle.properties b/gradle.properties index 12da3459..032d96ed 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,3 +3,4 @@ version=1.19.0-SNAPSHOT description=Code Analyzer for Go projectTitle=Go org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx1024m +org.gradle.caching=true diff --git a/settings.gradle b/settings.gradle index 4965002a..31d7de70 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,6 +6,27 @@ pluginManagement { } } +plugins { + id 'com.gradle.develocity' version '3.18.2' +} + +develocity { + server = 'https://develocity.sonar.build' +} + +def isCI = System.getenv('CI') != null +buildCache { + local { + enabled = !isCI + } + remote(develocity.buildCache) { + enabled = true + push = isCI + } +} + + + dependencyResolutionManagement { def slangDependenciesVersion = '1.17.0.6351' def analyzerCommonsVersion = '2.16.0.3141' From 74bd4db2ae088a4bd1e668daae127214753bf8d5 Mon Sep 17 00:00:00 2001 From: Marcin Stachniuk Date: Thu, 12 Dec 2024 16:22:04 +0100 Subject: [PATCH 2/4] Add CI token --- .cirrus.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index 0ec3b01f..1680969b 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -16,6 +16,8 @@ env: ORG_GRADLE_PROJECT_signingKeyId: VAULT[development/kv/data/sign data.key_id] GRADLE_USER_HOME: ${CIRRUS_WORKING_DIR}/.gradle + DEVELOCITY_TOKEN: VAULT[development/kv/data/develocity data.token] + DEVELOCITY_ACCESS_KEY: develocity.sonar.build=${DEVELOCITY_TOKEN} linux_image_template: &LINUX_IMAGE image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-g7-latest From fe69e6a801e22694accf3005c64985fad69ef732 Mon Sep 17 00:00:00 2001 From: Marcin Stachniuk Date: Thu, 12 Dec 2024 17:10:33 +0100 Subject: [PATCH 3/4] Add On failure --- .cirrus.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 1680969b..bb8afd86 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -47,6 +47,18 @@ eks_container: &CONTAINER_DEFINITION ## Build tasks +on_failure_template: &ON_FAILURE + on_failure: + junit_artifacts: + path: '**/test-results/**/*.xml' + format: junit + reports_artifacts: + path: '**/build/reports/**/*' + error_log_artifacts: + path: "hs_err_pid*.log" + heap_dump_artifacts: + path: "*.hprof" + setup_gradle_cache_template: &SETUP_GRADLE_CACHE gradle_cache: folder: .gradle/caches @@ -74,11 +86,7 @@ build_task: - gradle --version - source set_gradle_build_version - regular_gradle_build_deploy_analyze - on_failure: - error_log_artifacts: - path: "hs_err_pid*.log" - heap_dump_artifacts: - path: "*.hprof" + <<: *ON_FAILURE <<: *CLEANUP_GRADLE_CACHE_SCRIPT ### QA tasks @@ -114,6 +122,8 @@ qa_plugin_task: - SQ_VERSION: "LATEST_RELEASE" <<: *LINUX_4_CPU_6G_JAVA_17 <<: *GRADLE_ITS_TEMPLATE + <<: *ON_FAILURE + qa_ruling_task: <<: *QA_TASK_FILTER @@ -123,6 +133,7 @@ qa_ruling_task: ITS_PROJECT: "ruling" <<: *LINUX_4_CPU_6G_JAVA_17 <<: *GRADLE_ITS_TEMPLATE + <<: *ON_FAILURE ### Mend tasks From 9801c2e088c6fbf1d0e771b8761999a74d6f5264 Mon Sep 17 00:00:00 2001 From: Marcin Stachniuk Date: Fri, 13 Dec 2024 09:08:34 +0100 Subject: [PATCH 4/4] Improve readme --- README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 45dfe769..23b0bd48 100644 --- a/README.md +++ b/README.md @@ -22,29 +22,40 @@ If you are on Windows, read the [sonar-go-to-slang/README.md](sonar-go-to-slang/ ### Build Build and run Unit Tests: - ./gradlew build - +```shell +./gradlew build +``` +` ## Integration Tests By default, Integration Tests (ITs) are skipped during builds. If you want to run them, you need first to retrieve the related projects which are used as input: - git submodule update --init its/sources +```shell +git submodule update --init +``` Then build and run the Integration Tests using the `its` property: +```shell ./gradlew build -Pits --info --no-daemon +``` You can also build and run only Ruling Tests using the `ruling` property: - ./gradlew build -Pruling --info --no-daemon +```shell +./gradlew build -Pruling --info --no-daemon +``` ## License headers License headers are automatically updated by the spotless plugin but only for Java files. Furthermore, there are files such as `package-info.java` and `module-info.java` that spotless ignores. Also the Go source files are not handled. For those files use a manual script like below to update the license: - `find . -type f -name "*.go" -exec sed -i '' 's/2018-2023/2018-2024/' "{}" \;` + +```shell +`find . -type f -name "*.go" -exec sed -i '' 's/2018-2023/2018-2024/' "{}" \;` +``` ## License