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

build: fixed sonar #33

Merged
merged 14 commits into from
Nov 29, 2023
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
distribution: adopt
cache: gradle
- name: build with Gradle
run: ./gradlew build
run: ./gradlew --no-daemon build

- name: Save build cache
uses: actions/cache/save@v3
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
path: ./build
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }}
- name: Gradle check
run: ./gradlew check
run: ./gradlew --no-daemon check
- name: Save tests cache
uses: actions/cache/save@v3
with:
Expand All @@ -65,6 +65,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
Expand All @@ -83,11 +85,12 @@ jobs:
path: ./.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- run: ./gradlew --no-daemon check
- name: Sonar analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew analyze
run: ./gradlew --no-daemon analyze
- name: Codecov update
uses: codecov/codecov-action@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
distribution: adopt
cache: gradle
- name: Build documentation
run: ./gradlew docs # --no-configuration-cache
run: ./gradlew --no-daemon docs # --no-configuration-cache
- name: Save built docs
uses: actions/cache/save@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
distribution: adopt
cache: gradle
- name: Run gradle publish
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-configuration-cache
run: ./gradlew --no-daemon publishAllPublicationsToMavenCentralRepository --no-configuration-cache
env:
ORG_GRADLE_PROJECT_projectVersion: ${{ needs.infer-version.outputs.version }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
include: "python/pyproject.toml"

- name: Build releasable python package
run: ./gradlew :python:distribute
run: ./gradlew --no-daemon :python:distribute

- uses: actions/setup-python@v4
with:
Expand Down
5 changes: 5 additions & 0 deletions build-logic/code-info/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
// regardless of the specific projects and languages
plugins {
`kotlin-dsl` // To compile the plugin code
id("org.sonarqube") version "4.4.1.3373"
}

dependencies {
implementation("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.0.0.2929")
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ plugins {
java
jacoco
`jacoco-report-aggregation`
id("org.sonarqube")
}

// Make JaCoCo report generation part of the 'check' lifecycle phase
tasks.check {
dependsOn(tasks.named<JacocoReport>("testCodeCoverageReport"))
}


2 changes: 0 additions & 2 deletions build-logic/java-library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
// - publishing maven packages
plugins {
`kotlin-dsl` // To compile the plugin code
id("org.sonarqube") version "4.0.0.2929"
id("com.vanniktech.maven.publish") version "0.25.3"
}

dependencies {
implementation("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.0.0.2929")
implementation("com.vanniktech:gradle-maven-publish-plugin:0.25.3")
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
`java-library`
java
jacoco
id("org.sonarqube")
}

group = "io.github.moonlightsuite.moonlight"
Expand Down Expand Up @@ -48,20 +47,3 @@ tasks.register<Copy>("copyDependencies") {
tasks.register<Copy>("copyJar") {
from(tasks.jar).into(layout.buildDirectory.dir("jmods"))
}

// == Sonarqube settings ==
sonar {
// TODO: change project key with `project.name` when sonarcloud is properly configured
properties {
property("sonar.projectKey", "MoonLightSuite_MoonLight")
property("sonar.projectName", "Moonlight")
property("sonar.organization", "moonlightsuite")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.sourceEncoding", "UTF-8")

property(
"sonar.coverage.jacoco.xmlReportPaths",
"./build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"
)
}
}
22 changes: 17 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ plugins {
}

// == Umbrella task to publishing all publishable packages ==
// TODO: ideally we should have separate packages:
// 1. api/console
// 2. engine/core
// 3. script
// 4. matlab
tasks.register<Copy>("release") {
dependsOn("console:release")
}
Expand Down Expand Up @@ -55,3 +50,20 @@ fun Copy.copyModulesUpwards() {
into(layout.buildDirectory.dir("jmods"))
}
}

// == Sonarqube settings ==
sonar {
// TODO: change project key with `project.name` when sonarcloud is properly configured
properties {
property("sonar.projectKey", "MoonLightSuite_MoonLight")
property("sonar.projectName", "Moonlight")
property("sonar.organization", "moonlightsuite")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.sourceEncoding", "UTF-8")

property(
"sonar.coverage.jacoco.xmlReportPaths",
"./build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"
)
}
}