Skip to content

Commit 758debf

Browse files
feat(java): add Java bindings test
1 parent 05f6ce7 commit 758debf

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ test-zig:
5858
zig-version:
5959
description: Zig version
6060
default: "0.15.1"
61+
62+
test-java:
63+
description: Test the Java bindings
64+
default: "false"
65+
java-version:
66+
description: Java version
67+
default: "22"
6168
```
6269
6370
## Example configuration

action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ inputs:
5454
zig-version:
5555
description: Zig version
5656
default: "0.15.1"
57+
test-java:
58+
description: Test the Java bindings
59+
default: "false"
60+
java-version:
61+
description: Java version
62+
default: "22"
5763

5864
runs:
5965
using: composite
@@ -109,3 +115,8 @@ runs:
109115
if: inputs.test-zig == 'true'
110116
with:
111117
zig-version: ${{inputs.zig-version}}
118+
- name: Run Java tests
119+
uses: tree-sitter/parser-test-action/java@v3
120+
if: inputs.test-java == 'true'
121+
with:
122+
java-version: ${{inputs.java-version}}

java/action.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Tree-sitter parser test (Java)
2+
description: Test a tree-sitter parser in Java
3+
4+
inputs:
5+
java-version:
6+
description: Java version
7+
default: "22"
8+
distribution:
9+
description: Java distribution
10+
default: microsoft
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Set up Java
16+
uses: actions/setup-java@v4
17+
with:
18+
cache: maven
19+
distribution: ${{inputs.distribution}}
20+
java-version: ${{inputs.java-version}}
21+
cache-dependency-path: pom.xml
22+
- name: Set up tree-sitter library
23+
uses: tree-sitter/setup-action/lib@v2
24+
- name: Build parser library
25+
shell: sh
26+
run: |-
27+
cmake -B build \
28+
-DBUILD_SHARED_LIBS=ON \
29+
-DCMAKE_INSTALL_LIBDIR=lib \
30+
-DCMAKE_INSTALL_BINDIR=lib \
31+
-DCMAKE_INSTALL_PREFIX="$RUNNER_TOOL_CACHE/tree-sitter/lib"
32+
cmake --build build && cmake --install build --config Debug
33+
- name: Run tests
34+
shell: sh
35+
run: mvn -B --no-transfer-progress test

0 commit comments

Comments
 (0)