Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SonarCloud support #1782

Merged
merged 3 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,31 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
fetch-depth: 0 # SonarCloud: Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Ensure required packages
run: sudo apt-get install -y curl software-properties-common build-essential unzip debhelper devscripts
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
gradle-home-cache-cleanup: true
- name: Build and test source
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
working-directory: ./src
run: ./gradlew -Dorg.gradle.jvmargs=-Xmx6g -PxroadBuildType=RELEASE --stacktrace build test intTest runProxyTest runMetaserviceTest runProxymonitorMetaserviceTest jacocoTestReport dependencyCheckAggregate -Pfrontend-npm-audit
run: ./gradlew -Dorg.gradle.jvmargs=-Xmx6g -PsonarqubeHost=https://sonarcloud.io -PsonarqubeProjectKey=nordic-institute_X-Road -PsonarqubeOrganization=nordic-institute -PxroadBuildType=RELEASE --stacktrace build sonar test intTest runProxyTest runMetaserviceTest runProxymonitorMetaserviceTest jacocoTestReport dependencyCheckAggregate -Pfrontend-npm-audit
- name: Test report
env:
NODE_OPTIONS: '--max-old-space-size=6144'
Expand All @@ -63,8 +72,6 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -102,8 +109,6 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
Expand Down
7 changes: 4 additions & 3 deletions src/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}

plugins {
id 'org.sonarqube' version '3.3'
id 'org.sonarqube' version '4.2.1.3168'
id 'org.owasp.dependencycheck' version '8.0.2'
id 'jacoco'
id 'java'
Expand All @@ -26,8 +26,9 @@ repositories {

sonarqube {
properties {
property "sonar.host.url", "https://sonarqube.niis.org"
property "sonar.projectKey", "xroad"
property "sonar.host.url", "${sonarqubeHost}"
property "sonar.projectKey", "${sonarqubeProjectKey}"
property "sonar.organization", "${sonarqubeOrganization}"
property "sonar.projectName", "X-Road"
property "sonar.projectDescription", "Data Exchange Layer"
property "sonar.projectVersion", xroadVersion
Expand Down
5 changes: 5 additions & 0 deletions src/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ org.gradle.jvmargs=-Xmx1024m
xroadVersion=7.4.0
xroadBuildType=SNAPSHOT

# SonarQube defaults
sonarqubeHost=https://sonarqube.niis.org
sonarqubeProjectKey=xroad
sonarqubeOrganization=

# common dependency versions
akkaVersion=2.13:2.6.20
scalaLibraryVersion=2.13.10
Expand Down
Loading