From 26a4245e32b04444ec1ac4193f562ed3eb7f2f4b Mon Sep 17 00:00:00 2001 From: OmarAlJarrah Date: Mon, 15 Jun 2026 22:09:28 +0300 Subject: [PATCH] ci: add GitHub Actions workflow to run the build on PRs and main The quality gates (tests, ktlint, detekt, apiCheck, explicit-API strict mode, allWarningsAsErrors, and the aggregate 80% Kover coverage floor) previously ran only on developer machines, so a PR could merge while breaking any of them. Add .github/workflows/ci.yml that runs `./gradlew build` on every pull request and on pushes to main. `./gradlew build` already chains the full gate, so the workflow stays minimal: - Checks out submodules recursively (the styleguide directory is a submodule). - Installs a single Temurin JDK 21. The foojay-resolver-convention plugin auto-provisions the JDK 8 and JDK 11 toolchains the modules need, and JDK 21 covers the virtual-threads module. JDK 21 (not the newest LTS) is deliberate: detekt 1.23.x crashes on JDK 25+, so the daemon stays on 21 to keep detekt green. - Uses gradle/actions/setup-gradle for dependency and build caching. Also add a CI status badge to the README. --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..922b892b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI + +# Run the full Gradle build on every pull request and on pushes to main. +# `./gradlew build` runs the complete quality gate: tests, ktlint, detekt, +# apiCheck (binary-compatibility), explicit-API strict mode, allWarningsAsErrors, +# and the aggregate 80% Kover line-coverage floor. +on: + pull_request: + push: + branches: [main] + +# Cancel superseded runs on the same ref so only the latest commit of a branch/PR builds. +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + # The styleguide directory is a git submodule; fetch it so the working tree matches local checkouts. + submodules: recursive + + # Install a single Temurin JDK 21. The build's Gradle daemon runs on this JVM, and the + # foojay-resolver-convention plugin (settings.gradle.kts) auto-provisions the JDK 8 and + # JDK 11 toolchains the Java-8 and JDK-11 modules require. JDK 21 also satisfies the + # virtual-threads module's toolchain. JDK 21 (rather than the newest LTS) is deliberate: + # detekt 1.23.x crashes on JDK 25+, so keeping the daemon on 21 keeps the detekt gate green. + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + + # Built-in Gradle dependency and build caching, plus wrapper validation. + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Build + run: ./gradlew build diff --git a/README.md b/README.md index 56a7de8e..2ffd22fe 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@

Java SDKs Platform

+[![CI](https://github.com/dexpace/java-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/dexpace/java-sdk/actions/workflows/ci.yml) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Kotlin](https://img.shields.io/badge/kotlin-2.3.21-7F52FF.svg?logo=kotlin&logoColor=white)](https://kotlinlang.org) ![JDK](https://img.shields.io/badge/JDK-8%2B-437291.svg?logo=openjdk&logoColor=white)