Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
File renamed without changes.
44 changes: 44 additions & 0 deletions .github/workflows/publish-instrumentation-openai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish judgeval-instrumentation-openai

on:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Java and Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: "temurin"
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Import GPG key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --import --batch --yes
echo "use-agent" >> ~/.gnupg/gpg.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
gpg-connect-agent reloadagent /bye
gpg --list-secret-keys --keyid-format LONG

- name: Deploy judgeval-instrumentation-openai
run: |
mvn -B -pl instrumentation/judgeval-instrumentation-openai -am -e deploy \
-Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" \
-Dgpg.pinentry-mode=loopback \
--update-snapshots
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PORTAL_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Done
run: echo "Published judgeval-instrumentation-openai"


42 changes: 42 additions & 0 deletions .github/workflows/publish-judgeval-java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish judgeval-java

on:
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Java and Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: "temurin"
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Import GPG key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --import --batch --yes
echo "use-agent" >> ~/.gnupg/gpg.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
gpg-connect-agent reloadagent /bye
gpg --list-secret-keys --keyid-format LONG

- name: Deploy judgeval-java
run: |
mvn -B -pl judgeval-java -am -e deploy \
-Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" \
-Dgpg.pinentry-mode=loopback \
--update-snapshots
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PORTAL_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Done
run: echo "Published judgeval-java"
87 changes: 0 additions & 87 deletions .github/workflows/publish.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/test-instrumentation-openai.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test judgeval-instrumentation-openai

on:
pull_request:
branches: [main]
paths:
- "instrumentation/judgeval-instrumentation-openai/**"
- "pom.xml"
- ".github/workflows/test-instrumentation-openai.yml"

jobs:
test-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: "temurin"

- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Test Install
run: |
mvn -B -Dgpg.skip=true -pl instrumentation/judgeval-instrumentation-openai -am clean install

- name: Verify Build Artifacts
run: |
echo "Checking build artifacts..."
ls -la instrumentation/judgeval-instrumentation-openai/target/ || true
echo "JAR files:"
find instrumentation/judgeval-instrumentation-openai/target -name "*.jar" -type f
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Test Install
name: Test judgeval-java

on:
pull_request:
branches: [main]
paths:
- "judgeval-java/**"
- "pom.xml"
- ".github/workflows/test-judgeval-java.yml"

jobs:
test-install:
Expand All @@ -25,11 +29,11 @@ jobs:

- name: Test Install
run: |
mvn clean install -Dgpg.skip=true
mvn -B -Dgpg.skip=true -pl judgeval-java -am clean install

- name: Verify Build Artifacts
run: |
echo "Checking build artifacts..."
ls -la target/
ls -la judgeval-java/target/ || true
echo "JAR files:"
find target/ -name "*.jar" -type f
find judgeval-java/target -name "*.jar" -type f
102 changes: 75 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,91 @@
.PHONY: help format check test clean build generate-client
.PHONY: format format-core format-openai install install-core install-openai status status-core status-openai check test clean build generate-client run

help: ## Show this help message
@echo "Available commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
format:
@echo "[format] judgeval-java"
mvn -B -pl judgeval-java -am spotless:apply
@echo "[format] instrumentation/judgeval-instrumentation-openai"
mvn -B -pl instrumentation/judgeval-instrumentation-openai -am spotless:apply

format: ## Format code using Spotless
mvn spotless:apply
format-core:
mvn -B -pl judgeval-java -am spotless:apply

check: ## Run all code quality checks
mvn compile checkstyle:check spotless:check
format-openai:
mvn -B -pl instrumentation/judgeval-instrumentation-openai -am spotless:apply

test: ## Run tests
check:
mvn -B compile checkstyle:check spotless:check

test:
mvn test

clean: ## Clean build artifacts
clean:
mvn clean

build: ## Build the project
mvn clean compile
build:
mvn -B clean compile

install:
@echo "[install] judgeval-java"
mvn -B -Dgpg.skip=true -pl judgeval-java -am clean install
@echo "[install] instrumentation/judgeval-instrumentation-openai"
mvn -B -Dgpg.skip=true -pl instrumentation/judgeval-instrumentation-openai -am clean install

install-core:
mvn -B -Dgpg.skip=true -pl judgeval-java -am clean install

install: ## Install the project
mvn clean install -Dgpg.skip=true
install-openai:
mvn -B -Dgpg.skip=true -pl instrumentation/judgeval-instrumentation-openai -am clean install

generate-client: ## Generate API client from OpenAPI spec
generate-client:
./scripts/generate-client.sh
make format

lint: ## Run linting only
mvn checkstyle:check
lint:
mvn -B checkstyle:check

format-check:
mvn -B spotless:check

ci:
mvn -B clean compile test checkstyle:check spotless:check

status:
$(MAKE) status-core
$(MAKE) status-openai

status-core:
@echo "[status] judgeval-java"
@G=$$(mvn -q -pl judgeval-java -DforceStdout help:evaluate -Dexpression=project.groupId); \
A=$$(mvn -q -pl judgeval-java -DforceStdout help:evaluate -Dexpression=project.artifactId); \
V=$$(mvn -q -pl judgeval-java -DforceStdout help:evaluate -Dexpression=project.version); \
echo "GAV: $$G:$$A:$$V"; \
ls -1 judgeval-java/target/*.jar 2>/dev/null || echo "No jar built"

status-openai:
@echo "[status] instrumentation/judgeval-instrumentation-openai"
@G=$$(mvn -q -pl instrumentation/judgeval-instrumentation-openai -DforceStdout help:evaluate -Dexpression=project.groupId); \
A=$$(mvn -q -pl instrumentation/judgeval-instrumentation-openai -DforceStdout help:evaluate -Dexpression=project.artifactId); \
V=$$(mvn -q -pl instrumentation/judgeval-instrumentation-openai -DforceStdout help:evaluate -Dexpression=project.version); \
echo "GAV: $$G:$$A:$$V"; \
ls -1 instrumentation/judgeval-instrumentation-openai/target/*.jar 2>/dev/null || echo "No jar built"

MAIN ?=

ifneq (,$(filter run,$(MAKECMDGOALS)))
EXAMPLE := $(word 2,$(MAKECMDGOALS))
ifeq ($(EXAMPLE),)
$(error Usage: make run <example_folder> [MAIN=ClassName])
endif
$(eval $(EXAMPLE):;@:)
endif

format-check: ## Check formatting without applying
mvn spotless:check

ci: ## Run CI checks (compile, test, checkstyle, spotless)
mvn clean compile test checkstyle:check spotless:check

run: ## Run a specific Java class with environment variables (usage: make run CLASS=com.example.MyClass)
@if [ -f .env ]; then \
export $$(grep -v '^#' .env | grep -v '^$$' | xargs) && mvn exec:java -Dexec.mainClass="$(CLASS)"; \
else \
mvn exec:java -Dexec.mainClass="$(CLASS)"; \
fi
run:
@echo "[run] examples.$(EXAMPLE)"
if [ -f .env ]; then export $$(grep -v '^#' .env | grep -v '^$$' | xargs); fi; \
MAIN_CLASS=$(MAIN); \
if [ -z "$$MAIN_CLASS" ]; then \
MAIN_CLASS=$$(ls examples/src/main/java/examples/$(EXAMPLE)/*.java | head -n1 | xargs -n1 basename | sed 's/\.java$$//'); \
fi; \
mvn -q -f examples/pom.xml -DskipTests -Dexec.cleanupDaemonThreads=false -Dexec.mainClass=examples.$(EXAMPLE).$$MAIN_CLASS clean compile exec:java
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Judgeval Java SDK

[![Maven Central](https://img.shields.io/maven-central/v/com.judgmentlabs/judgeval-java)](https://central.sonatype.com/artifact/com.judgmentlabs/judgeval-java)
[![javadoc](https://javadoc.io/badge2/com.judgmentlabs/judgeval-java/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java)
Loading