Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
9a553de
feat(java): add JDK 25 default executor
brunoborges May 27, 2026
8079fdf
Potential fix for pull request finding
brunoborges May 27, 2026
2082fe8
test(java): cover owned default executor shutdown
brunoborges May 27, 2026
9315593
refactor(java): make default executor provider internal
brunoborges May 27, 2026
4dac3f4
refactor(java): update InternalExecutorProvider to manage executor ow…
brunoborges May 28, 2026
ace3cc3
feat(java): add integration tests for multi-release JAR behavior and …
brunoborges May 28, 2026
131bb3f
feat(java): add JDK 25 multi-release overlay class verification and u…
brunoborges May 28, 2026
0e72241
test(java): split InternalExecutorProvider unit test into single-asse…
brunoborges May 28, 2026
9a069bc
fix(java): dispatch owned-executor shutdown off the executor in force…
brunoborges May 28, 2026
048e593
fix(java): short-circuit shutdownOwnedExecutor() when already shut down
brunoborges May 28, 2026
6544eeb
spotless:apply
brunoborges May 28, 2026
2ddcbbc
ci(java): build/publish on JDK 25 to include MR-JAR overlay; matrix S…
brunoborges May 28, 2026
ec3c96d
On branch edburns/review-brunoborges-pr-1478 Test invocation changes.
edburns May 28, 2026
8a9466e
On branch edburns/review-brunoborges-pr-1478
edburns May 28, 2026
26eb7f6
On branch edburns/review-brunoborges-pr-1478
edburns May 28, 2026
293bece
On branch edburns/review-brunoborges-pr-1478
edburns May 28, 2026
159e8c9
On branch edburns/review-brunoborges-pr-1478 Address copilot review c…
edburns May 28, 2026
0f2a97f
Ensure the Jar is produced
edburns May 28, 2026
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
8 changes: 6 additions & 2 deletions .github/actions/java-test-report/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ inputs:
report-path:
description: "Path to the test report XML files (glob pattern)"
required: false
default: "java/target/surefire-reports*/TEST-*.xml"
default: "java/target/{surefire-reports*,failsafe-reports}/TEST-*.xml"
jacoco-path:
description: "Path to the JaCoCo XML report"
required: false
Expand All @@ -17,13 +17,17 @@ inputs:
description: "Name for the check run"
required: false
default: "Java SDK Test Results"
title:
description: "Title for the test report summary"
required: false
default: "Copilot Java SDK :: Test Results"
runs:
using: "composite"
steps:
- name: Generate Test Summary
shell: bash
run: |
echo "## 🧪 Copilot Java SDK :: Test Results" >> $GITHUB_STEP_SUMMARY
echo "## 🧪 ${{ inputs.title }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if ls ${{ inputs.report-path }} 1>/dev/null 2>&1; then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '17'
java-version: '25'
cache: 'maven'

- name: Install SDK to local repo
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/java-publish-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ jobs:

- uses: ./.github/actions/setup-copilot

- name: Set up JDK 17
- name: Set up JDK 25
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "17"
java-version: "25"
distribution: "microsoft"
cache: "maven"
server-id: central
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/java-publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:

- uses: ./.github/actions/setup-copilot

- name: Set up JDK 17
- name: Set up JDK 25
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "17"
java-version: "25"
distribution: "microsoft"
cache: "maven"
server-id: central
Expand Down
56 changes: 39 additions & 17 deletions .github/workflows/java-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ permissions:

jobs:
java-sdk:
name: "Java SDK Tests"
name: "Java SDK Tests (JDK ${{ matrix.test-jdk }})"
if: github.event.repository.fork == false

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-jdk: ["25", "17"]
defaults:
run:
shell: bash
Expand All @@ -52,22 +56,26 @@ jobs:

- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "17"
java-version: "25"
distribution: "microsoft"
cache: "maven"

- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 22

- uses: ./.github/actions/setup-copilot
id: setup-copilot
- name: Build SDK and set up test harness
run: mvn test-compile jar:jar

- name: Verify Javadoc generation
if: matrix.test-jdk == '25'
run: mvn javadoc:javadoc -q

- name: Install test harness dependencies
working-directory: ./test/harness
run: npm ci --ignore-scripts
- name: Verify CLI works
run: node target/copilot-sdk/nodejs/node_modules/@github/copilot/index.js --version

- name: Run spotless check
if: matrix.test-jdk == '25'
run: |
mvn spotless:check
if [ $? -ne 0 ]; then
Expand All @@ -76,18 +84,30 @@ jobs:
fi
echo "✅ spotless:check passed"

- name: Verify Javadoc generation
run: mvn compile javadoc:javadoc -q
- name: Run Java SDK tests (JDK 25)
if: matrix.test-jdk == '25'
env:
CI: "true"
run: mvn verify -Dskip.test.harness=true

- name: Run Java SDK tests
- name: Switch to JDK 17
if: matrix.test-jdk == '17'
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: "17"
distribution: "microsoft"

- name: Run Java SDK tests (JDK 17, no recompilation)
if: matrix.test-jdk == '17'
env:
CI: "true"
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.cli-path }}
run: mvn verify
run: |
echo "Running tests against JDK 25-built classes using JDK 17 runtime..."
java -version
mvn jacoco:prepare-agent@wire-up-coverage-instrumentation antrun:run@print-test-jdk-banner surefire:test failsafe:integration-test failsafe:verify jacoco:report@build-coverage-report-from-tests -Denforcer.skip=true

- name: Upload test results for site generation
if: success() && github.ref == 'refs/heads/main'
if: success() && github.ref == 'refs/heads/main' && matrix.test-jdk == '25'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: test-results-for-site
Expand All @@ -98,12 +118,12 @@ jobs:
retention-days: 1

- name: Generate JaCoCo badge
if: success() && github.ref == 'refs/heads/main'
if: success() && github.ref == 'refs/heads/main' && matrix.test-jdk == '25'
working-directory: .
run: .github/scripts/generate-java-coverage-badge.sh java/target/site/jacoco-coverage/jacoco.csv .github/badges

- name: Create PR for JaCoCo badge update
if: success() && github.ref == 'refs/heads/main'
if: success() && github.ref == 'refs/heads/main' && matrix.test-jdk == '25'
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v7
with:
commit-message: "Update Java JaCoCo coverage badge"
Expand All @@ -116,12 +136,14 @@ jobs:
- name: Generate Test Report Summary
if: always()
uses: ./.github/actions/java-test-report
with:
title: "Copilot Java SDK :: Test Results JDK ${{ matrix.test-jdk }}"

- name: Upload test results on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: java-test-results
name: java-test-results-jdk-${{ matrix.test-jdk }}
path: |
java/target/surefire-reports/
java/target/surefire-reports-isolated/
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
"[go]": {
"editor.defaultFormatter": "golang.go"
},
"java.configuration.updateBuildConfiguration": "automatic"
"java.configuration.updateBuildConfiguration": "automatic",
"java.compile.nullAnalysis.mode": "automatic"
}
38 changes: 20 additions & 18 deletions java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,27 @@ Java SDK for programmatic control of GitHub Copilot CLI, enabling you to build A

## Installation

### Requirements
### Runtime requirements

- Java 17 or later. **JDK 25 recommended**. Selecting JDK 25 enables the use of virtual threads, as shown in the [Quick Start](#quick-start).
- GitHub Copilot CLI 1.0.17 or later installed and in `PATH` (or provide custom `cliPath`)
- Java 17 or later. **JDK 25 recommended**. The distributed jar is a multi-release jar (MR-JAR) and is compiled on JDK 25 with `maven.compiler.release` set to 17. This means, when run on JDK 25 and later, the SDK automatically uses virtual threads for its default internal executor.
- GitHub Copilot CLI 1.0.55-5. or later installed and in `PATH` (or provide custom `cliPath`)

### Maven

```xml
<dependency>
<groupId>com.github</groupId>
<artifactId>copilot-sdk-java</artifactId>
<version>1.0.0-beta-java.4</version>
<version>1.0.0-beta-10-java.0</version>
</dependency>
```

### Gradle

```groovy
implementation 'com.github:copilot-sdk-java:1.0.0-beta-10-java.0'


#### Snapshot Builds

Snapshot builds of the next development version are published to Maven Central Snapshots. To use them, add the repository and update the dependency version in your `pom.xml`:
Expand All @@ -50,14 +56,14 @@ Snapshot builds of the next development version are published to Maven Central S
<dependency>
<groupId>com.github</groupId>
<artifactId>copilot-sdk-java</artifactId>
<version>1.0.0-beta-java.5-SNAPSHOT</version>
<version>1.0.0-beta-10-java.0-SNAPSHOT</version>
</dependency>
```

### Gradle

```groovy
implementation 'com.github:copilot-sdk-java:1.0.0-beta-java.4'
implementation 'com.github:copilot-sdk-java:1.0.0-beta-10-java.0-SNAPSHOT'
Comment thread
edburns marked this conversation as resolved.
```

## Quick Start
Expand All @@ -66,23 +72,16 @@ implementation 'com.github:copilot-sdk-java:1.0.0-beta-java.4'
import com.github.copilot.CopilotClient;
import com.github.copilot.generated.AssistantMessageEvent;
import com.github.copilot.generated.SessionUsageInfoEvent;
import com.github.copilot.rpc.CopilotClientOptions;
import com.github.copilot.rpc.MessageOptions;
import com.github.copilot.rpc.PermissionHandler;
import com.github.copilot.rpc.SessionConfig;

import java.util.concurrent.Executors;

public class CopilotSDK {
public static void main(String[] args) throws Exception {
var lastMessage = new String[]{null};

// Create and start client
try (var client = new CopilotClient()) { // JDK 25+: comment out this line
// JDK 25+: uncomment the following 3 lines for virtual thread support
// var options = new CopilotClientOptions()
// .setExecutor(Executors.newVirtualThreadPerTaskExecutor());
// try (var client = new CopilotClient(options)) {
try (var client = new CopilotClient()) {
client.start().get();

// Create a session
Expand Down Expand Up @@ -160,6 +159,8 @@ This SDK tracks the official [Copilot SDK](https://github.com/github/copilot-sdk

### Development Setup

Requires JDK 25 or later for development.

```bash
# Clone the repository
git clone https://github.com/github/copilot-sdk.git
Expand All @@ -168,8 +169,12 @@ cd copilot-sdk/java
# Enable git hooks for code formatting
git config core.hooksPath .githooks

# Build and test
# Build and test with JDK 25
mvn clean verify

# Set your paths for JDK 17
# Run the JDK 25 built jar with JDK 17 JVM for tests. Do not re-compile the jar.
mvn jacoco:prepare-agent@wire-up-coverage-instrumentation antrun:run@print-test-jdk-banner surefire:test failsafe:integration-test failsafe:verify jacoco:report@build-coverage-report-from-tests -Denforcer.skip=true
```

The tests require the official [copilot-sdk](https://github.com/github/copilot-sdk) test harness, which is automatically cloned during build.
Expand All @@ -190,6 +195,3 @@ See [SECURITY.md](SECURITY.md) for reporting security vulnerabilities.

MIT — see [LICENSE](LICENSE) for details.

## Acknowledgement

- Initially developed with Copilot and [Bruno Borges](https://www.linkedin.com/in/brunocborges/).
Loading
Loading