Skip to content
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
11 changes: 11 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
Expand All @@ -31,6 +33,15 @@ jobs:
- name: API Check
run: ./gradlew apiCheck

- name: Generate Kover reports
run: ./gradlew koverXmlReport

- name: Run SonarCloud Analysis
run: ./gradlew sonar
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GIT_BRANCH: ${{ github.ref_name }}

publish:
name: Publish
needs: unit-test
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
Expand All @@ -24,6 +26,17 @@ jobs:
- name: API Check
run: ./gradlew apiCheck

- name: Generate Kover reports
run: ./gradlew koverXmlReport

- name: Run SonarCloud Analysis
run: ./gradlew sonar
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GIT_BRANCH: ${{ github.ref_name}}
GIT_BRANCH_DEST: ${{ github.base_ref }}
PULL_REQUEST: ${{ github.event.pull_request.number }}

publish:
name: Publish
needs: unit-test
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Maven Central](https://img.shields.io/maven-central/v/org.hisp.dhis.lib.expression/expression-parser?label=maven%20central)](https://central.sonatype.com/artifact/org.hisp.dhis.lib.expression/expression-parser)
[![NPM Version](https://img.shields.io/npm/v/@dhis2/expression-parser)](https://www.npmjs.com/package/@dhis2/expression-parser)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=dhis2_expression-parser&metric=coverage&branch=main)](https://sonarcloud.io/summary/overall?id=dhis2_expression-parser&branch=main)
[![KDoc link](https://img.shields.io/badge/API_reference-KDoc-blue)](https://dhis2.github.io/expression-parser/api/)

# Expression Parser
Expand Down
28 changes: 28 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins {
id("maven-publish-conventions")
id("npm-publish-conventions")
alias(libs.plugins.api.compatibility)
alias(libs.plugins.kover)
alias(libs.plugins.sonarqube)
}

repositories {
Expand Down Expand Up @@ -80,3 +82,29 @@ kotlin {
val nativeTest by getting
}
}

sonarqube {
properties {
val branch = System.getenv("GIT_BRANCH")
val targetBranch = System.getenv("GIT_BRANCH_DEST")
val pullRequestId = System.getenv("PULL_REQUEST")

property("sonar.host.url", "https://sonarcloud.io")
property("sonar.organization", "dhis2")
property("sonar.projectKey", "dhis2_expression-parser")
property("sonar.projectName", "expression-parser")
property("sonar.coverage.jacoco.xmlReportPaths", "${layout.buildDirectory.get()}/reports/kover/report.xml")

if (pullRequestId.isNullOrEmpty()) {
property("sonar.branch.name", branch)
} else {
property("sonar.pullrequest.base", targetBranch)
property("sonar.pullrequest.branch", branch)
property("sonar.pullrequest.key", pullRequestId)
}
}
}

tasks.named("sonar").configure {
dependsOn(":koverXmlReport")
}
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ dokka = "2.0.0"
nexusPublish = "2.0.0"
npmPublish = "3.5.2"
apiCompatibility ="0.17.0"
kover = "0.9.8"
sonarqube = "7.2.3.7755"
kotlinxDatetime = "0.7.1"
bignum = "0.3.10"
kotlinJsWrappers = "1.0.0-pre.830"
Expand All @@ -20,5 +22,7 @@ kotlinWrappers-js = { group = "org.jetbrains.kotlin-wrappers", name = "kotlin-js

[plugins]
api-compatibility = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "apiCompatibility" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }

[bundles]