Skip to content

Commit

Permalink
Merge pull request #33 from MoonLightSuite/sonar-fix
Browse files Browse the repository at this point in the history
build: fixed sonar
  • Loading branch information
ennioVisco authored Nov 29, 2023
2 parents 0ac457a + 063753d commit d0c39b2
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 31 deletions.
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"
)
}
}

0 comments on commit d0c39b2

Please sign in to comment.