From a12a1e84e8021ecdbc443241574dee751288a77c Mon Sep 17 00:00:00 2001 From: Felipe Gutierrez Date: Wed, 21 Oct 2026 14:28:47 -0400 Subject: [PATCH 1/2] ci: run integration tests against CockroachDB; add README badges; fix sibling link --- .github/workflows/ci.yml | 21 ++++++++++++++++----- README.md | 6 +++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fef4e42..8cee45e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,9 +26,20 @@ jobs: java-version: '25' cache: gradle - - name: Build - # Live-DB integration tests (*IT) are gated on a reachable CockroachDB - # node via a JUnit assumption on CRDB_URL. No node is provisioned here, - # so those tests self-skip and the build stays green. To run them in CI, - # add a CockroachDB service and set CRDB_URL for this step. + - name: Start CockroachDB + run: | + docker run -d --name crdb -p 26257:26257 \ + cockroachdb/cockroach:latest-v25.1 start-single-node --insecure + for i in $(seq 1 60); do + if docker exec crdb ./cockroach sql --insecure -e 'SELECT 1' >/dev/null 2>&1; then + echo "CockroachDB ready"; break + fi + sleep 2 + done + + - name: Build & test + # Live-DB integration tests (*IT) run against the CockroachDB node above + # via CRDB_URL; unit tests run regardless. + env: + CRDB_URL: jdbc:postgresql://localhost:26257/defaultdb?user=root&sslmode=disable run: ./gradlew build --no-daemon --stacktrace diff --git a/README.md b/README.md index 9955ee7..e25f430 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ # CockroachDB Java Library +[![CI](https://github.com/cockroachlabs/cockroachdb-java-library/actions/workflows/ci.yml/badge.svg)](https://github.com/cockroachlabs/cockroachdb-java-library/actions/workflows/ci.yml) +[![Release](https://img.shields.io/github/v/release/cockroachlabs/cockroachdb-java-library?sort=semver)](https://github.com/cockroachlabs/cockroachdb-java-library/releases) +[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE) + A **pure-Java**, framework-free library for CockroachDB. Its headline feature: custom annotations plus runtime dynamic proxies that make CockroachDB anomaly-handling boilerplate — the `try/catch` retry loops around serialization errors (SQLSTATE `40001`) — **disappear**. It is the framework-free sibling of the -[`cockroachdb-spring-boot-starter`](../cockroachdb-spring-boot-starter), and part +[`cockroachdb-spring-boot-starter`](https://github.com/cockroachlabs/cockroachdb-spring-boot-starter), and part of a family of CockroachDB client libraries (Go, Python, .NET, Ktor). Its roadmap tracks **Cockroach Continuum** (Plenum, vCluster, Aegis, and an Agent/MCP surface) — see [`docs/CONTINUUM_PLAN.md`](docs/CONTINUUM_PLAN.md). From 14c8838bae8add97240bddc28482cc9dca642a36 Mon Sep 17 00:00:00 2001 From: Felipe Gutierrez Date: Wed, 21 Oct 2026 14:37:18 -0400 Subject: [PATCH 2/2] Add Maven publishing (GitHub Packages) + Javadoc Pages - Centralize maven-publish for all modules in root subprojects block, publishing com.cockroachlabs:cockroachdb-java-library- to GitHub Packages with Javadoc + sources jars. - Remove the duplicate per-module publish config from core (now central, URL corrected felipeg48 -> cockroachlabs). - publish.yml: on release -> ./gradlew publish to GitHub Packages. - javadoc.yml: on push main / release -> aggregate Javadoc -> gh-pages (https://cockroachlabs.github.io/cockroachdb-java-library/). --- .github/workflows/javadoc.yml | 63 +++++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 32 ++++++++++++++++++ build.gradle | 36 ++++++++++++++++++++ core/build.gradle | 36 ++------------------ 4 files changed, 133 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/javadoc.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml new file mode 100644 index 0000000..3d66d67 --- /dev/null +++ b/.github/workflows/javadoc.yml @@ -0,0 +1,63 @@ +name: Javadoc + +# Builds aggregated Javadoc for all modules and publishes it to GitHub Pages +# at https://cockroachlabs.github.io/cockroachdb-java-library/ on every push to +# main and on each published release. +on: + push: + branches: [main] + release: + types: [published] + workflow_dispatch: + +permissions: + contents: write + +concurrency: + group: javadoc-${{ github.ref }} + cancel-in-progress: true + +jobs: + javadoc: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 25 (Temurin) + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '25' + cache: gradle + + - name: Generate Javadoc for all modules + run: ./gradlew javadoc --no-daemon --stacktrace + + - name: Assemble Pages site + run: | + set -euo pipefail + rm -rf _site && mkdir -p _site + { + echo '' + echo '' + echo 'CockroachDB Java Library — API Docs' + echo '' + echo '

CockroachDB Java Library — API Docs

Javadoc by module:

    ' + } > _site/index.html + for dir in */build/docs/javadoc; do + module="${dir%%/*}" + if [ -d "$dir" ]; then + mkdir -p "_site/$module" + cp -r "$dir/." "_site/$module/" + echo "
  • $module
  • " >> _site/index.html + fi + done + echo '
' >> _site/index.html + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: _site + publish_branch: gh-pages diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f37a91b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: Publish + +# Publishes every module to GitHub Packages (Maven) when a GitHub Release is +# published. Artifacts land at com.cockroachlabs:cockroachdb-java-library-. +on: + release: + types: [published] + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 25 (Temurin) + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '25' + cache: gradle + + - name: Publish to GitHub Packages + env: + GITHUB_ACTOR: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew publish --no-daemon --stacktrace diff --git a/build.gradle b/build.gradle index 49aab0e..d5f0d0a 100644 --- a/build.gradle +++ b/build.gradle @@ -23,11 +23,14 @@ allprojects { subprojects { apply plugin: 'java-library' + apply plugin: 'maven-publish' java { toolchain { languageVersion = JavaLanguageVersion.of(25) } + withJavadocJar() + withSourcesJar() } dependencies { @@ -42,4 +45,37 @@ subprojects { exceptionFormat 'short' } } + + // Publish every module to GitHub Packages (Maven) as + // com.cockroachlabs:cockroachdb-java-library-:, each with a + // Javadoc + sources jar. Credentials come from the Actions environment. + publishing { + publications { + maven(MavenPublication) { + artifactId = "cockroachdb-java-library-${project.name}" + from components.java + pom { + name = "CockroachDB Java Library — ${project.name}" + description = (project.description ?: 'CockroachDB Java library module') + url = 'https://github.com/cockroachlabs/cockroachdb-java-library' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + } + } + } + repositories { + maven { + name = 'GitHubPackages' + url = 'https://maven.pkg.github.com/cockroachlabs/cockroachdb-java-library' + credentials { + username = System.getenv('GITHUB_ACTOR') + password = System.getenv('GITHUB_TOKEN') + } + } + } + } } diff --git a/core/build.gradle b/core/build.gradle index 1f140c7..d2909a2 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,6 +1,5 @@ plugins { id 'java-library' - id 'maven-publish' } description = 'CockroachDB pure-Java library — annotation-driven core (retry, circuit breaking, context, transactions, dynamic proxies).' @@ -12,36 +11,5 @@ dependencies { implementation "net.bytebuddy:byte-buddy:${rootProject.ext.byteBuddyVersion}" } -// Publishes this module to GitHub Packages as -// com.cockroachlabs:cockroachdb-java-library-core (version from allprojects). -// Mirrors the spring-boot-starter's publish config; credentials come from env. -publishing { - publications { - maven(MavenPublication) { - groupId = 'com.cockroachlabs' - artifactId = 'cockroachdb-java-library-core' - from components.java - pom { - name = 'CockroachDB Java Library — Core' - description = project.description - url = 'https://github.com/felipeg48/cockroachdb-java-library' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - } - } - } - repositories { - maven { - name = 'GitHubPackages' - url = 'https://maven.pkg.github.com/felipeg48/cockroachdb-java-library' - credentials { - username = System.getenv('GITHUB_ACTOR') ?: 'felipeg48' - password = System.getenv('GITHUB_TOKEN') - } - } - } -} +// Maven publishing (GitHub Packages) is configured centrally in the root +// build.gradle `subprojects` block for every module.