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
21 changes: 16 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
63 changes: 63 additions & 0 deletions .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
@@ -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 '<!doctype html><html lang="en"><head><meta charset="utf-8">'
echo '<meta name="viewport" content="width=device-width,initial-scale=1">'
echo '<title>CockroachDB Java Library — API Docs</title>'
echo '<style>body{font-family:system-ui,sans-serif;max-width:48rem;margin:4rem auto;padding:0 1.5rem;line-height:1.6;color:#101913}a{color:#9059FF}h1{font-size:1.6rem}li{margin:.4rem 0}</style>'
echo '</head><body><h1>CockroachDB Java Library — API Docs</h1><p>Javadoc by module:</p><ul>'
} > _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 "<li><a href=\"./$module/\">$module</a></li>" >> _site/index.html
fi
done
echo '</ul></body></html>' >> _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
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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-<module>.
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
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
36 changes: 36 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ allprojects {

subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
withJavadocJar()
withSourcesJar()
}

dependencies {
Expand All @@ -42,4 +45,37 @@ subprojects {
exceptionFormat 'short'
}
}

// Publish every module to GitHub Packages (Maven) as
// com.cockroachlabs:cockroachdb-java-library-<module>:<version>, 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')
}
}
}
}
}
36 changes: 2 additions & 34 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -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).'
Expand All @@ -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.
Loading