Skip to content

Commit

Permalink
SONARGO-75 Onboard sonar-go to Develocity (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
mstachniuk authored Dec 13, 2024
1 parent 1236107 commit 0c59c2d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 10 deletions.
23 changes: 18 additions & 5 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -45,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
Expand Down Expand Up @@ -72,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
Expand Down Expand Up @@ -112,6 +122,8 @@ qa_plugin_task:
- SQ_VERSION: "LATEST_RELEASE"
<<: *LINUX_4_CPU_6G_JAVA_17
<<: *GRADLE_ITS_TEMPLATE
<<: *ON_FAILURE


qa_ruling_task:

Check warning on line 128 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L128

task "qa_ruling" depends on task "build", but their only_if conditions are different
<<: *QA_TASK_FILTER
Expand All @@ -121,6 +133,7 @@ qa_ruling_task:
ITS_PROJECT: "ruling"
<<: *LINUX_4_CPU_6G_JAVA_17
<<: *GRADLE_ITS_TEMPLATE
<<: *ON_FAILURE

### Mend tasks

Expand Down
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 21 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 0c59c2d

Please sign in to comment.