diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 0000000..3a84c41 --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,48 @@ +name: Sonar + +# SonarCloud analysis runs once per day (07:00 UTC) on main, plus on-demand +# via the workflow_dispatch button. Kept out of the per-push CI workflow to +# keep PRs fast and reduce SonarCloud quota usage. +on: + schedule: + - cron: '0 7 * * *' + workflow_dispatch: + +jobs: + sonar: + runs-on: ubuntu-latest + + steps: + - name: Checkout (with zstd submodule) + uses: actions/checkout@v4 + with: + submodules: recursive + # Full history needed for line-level blame / new-code computation. + fetch-depth: 0 + + - name: Set up JDK 25 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '25' + cache: maven + + - name: Set up Zig + uses: mlugg/setup-zig@v2 + with: + version: 0.16.0 + + - name: Cache SonarCloud packages + uses: actions/cache@v4 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: Build, test, and Sonar analysis + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + ./mvnw -B -ntp verify -P coverage \ + org.sonarsource.scanner.maven:sonar-maven-plugin:sonar diff --git a/README.md b/README.md index e7888bd..8f10689 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # zstd-java [![CI](https://github.com/dfa1/zstd-java/actions/workflows/ci.yml/badge.svg)](https://github.com/dfa1/zstd-java/actions/workflows/ci.yml) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dfa1_zstd-java&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=dfa1_zstd-java) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=dfa1_zstd-java&metric=coverage)](https://sonarcloud.io/summary/new_code?id=dfa1_zstd-java) [![Maven Central](https://img.shields.io/maven-central/v/io.github.dfa1.zstd/zstd.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/io.github.dfa1.zstd/zstd) ![zstd](https://img.shields.io/badge/zstd-1.5.7-green.svg) ![Java](https://img.shields.io/badge/Java-25%2B-orange.svg) diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 1fec416..9e31725 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -23,11 +23,13 @@ + io.github.dfa1.zstd zstd ${project.version} - test com.github.luben @@ -49,6 +51,34 @@ + + + coverage + + + + org.jacoco + jacoco-maven-plugin + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/jacoco-aggregate + + + + + + + native-osx-aarch64 diff --git a/pom.xml b/pom.xml index c10ed6c..e83f275 100644 --- a/pom.xml +++ b/pom.xml @@ -57,6 +57,33 @@ 3.12.0 3.3.1 3.4.2 + 0.8.15 + + + https://sonarcloud.io + dfa11 + dfa1_zstd-java + + + **/benchmark/** + + + + ${project.build.directory}/site/jacoco/jacoco.xml, + ${maven.multiModuleProjectDirectory}/integration-tests/target/site/jacoco-aggregate/jacoco.xml + + + + @@ -150,9 +177,16 @@ maven-surefire-plugin 3.5.6 - --enable-native-access=ALL-UNNAMED + + @{argLine} --enable-native-access=ALL-UNNAMED + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + org.codehaus.mojo exec-maven-plugin @@ -257,6 +291,35 @@ + + + coverage + + + + org.jacoco + jacoco-maven-plugin + + + prepare-agent + + prepare-agent + + + + report + verify + + report + + + + + + +