Skip to content
Open
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
58 changes: 56 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,59 @@ permissions:
security-events: write

jobs:
jextract-linux:
name: Generate jextract code on Linux
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: true
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
# NOTE: keep this in sync with deploy
java-version: 25
cache: maven
- name: Set up jextract
shell: bash
run: |-
curl -LSs '${{env.JEXTRACT_URL}}_linux-x64_bin.tar.gz' | tar xzf - -C "$RUNNER_TOOL_CACHE"
printf '%s/jextract-25/bin\n' "$RUNNER_TOOL_CACHE" >> "$GITHUB_PATH"
env:
# NOTE: keep this in sync with deploy, docs
JEXTRACT_URL: https://download.java.net/java/early_access/jextract/25/1/openjdk-25-jextract+1-1
- name: Generate code
run: mvn --no-transfer-progress generate-sources
- name: Upload jextract generated code
uses: actions/upload-artifact@v6
with:
name: jextract-linux-code
path: target/generated-sources/jextract
if-no-files-found: error
test:
name: Test package
needs: jextract-linux
strategy:
fail-fast: false
matrix:
target: [ubuntu-latest, windows-latest, macos-latest]
java-version: [23, 24, 25]
# To match the release build workflow, use the jextract generated code for Linux and
# verify that it is portable
use-jextract-linux-code: [true]
Copy link
Contributor Author

@Marcono1234 Marcono1234 Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: GitHub currently implicitly includes the matrix arguments in the job name, e.g. "Test package (windows-latest, 25, true)". Is that ok or would you prefer if name was more descriptive?

# Additionally check for non-Linux platforms that the complete build setup, including running
# jextract on that platform, works as well
# This is mainly relevant for users building the project locally, since the release workflow
# uses only the jextract code from Linux
include:
- target: windows-latest
java-version: 25
use-jextract-linux-code: false
- target: macos-latest
java-version: 25
use-jextract-linux-code: false
runs-on: ${{matrix.target}}
steps:
- name: Checkout repository
Expand Down Expand Up @@ -72,11 +118,19 @@ jobs:
-DCMAKE_INSTALL_BINDIR=lib \
-DCMAKE_INSTALL_PREFIX="$RUNNER_TOOL_CACHE/tree-sitter/lib"
cmake --build build && cmake --install build --config Debug
- name: Download jextract generated code for Linux
if: ${{ matrix.use-jextract-linux-code }}
uses: actions/download-artifact@v7
with:
name: jextract-linux-code
path: target/generated-sources/jextract
- name: Set up jextract
if: ${{ !matrix.use-jextract-linux-code }}
shell: bash
run: |-
if [[ $RUNNER_OS == Linux ]]; then
JEXTRACT_URL+=_linux-x64_bin.tar.gz
echo "Linux jextract code should have been used from dedicated job"
exit 1
elif [[ $RUNNER_OS == macOS ]]; then
JEXTRACT_URL+=_macos-aarch64_bin.tar.gz
else
Expand All @@ -88,7 +142,7 @@ jobs:
# NOTE: keep this in sync with deploy, docs
JEXTRACT_URL: https://download.java.net/java/early_access/jextract/25/1/openjdk-25-jextract+1-1
- name: Run tests
run: mvn --no-transfer-progress test
run: mvn --no-transfer-progress test "-Djextract.skip=${{ matrix.use-jextract-linux-code }}"
- name: Patch SpotBugs SARIF report
if: "!cancelled() && github.event_name == 'push'"
run: mvn antrun:run@patch-sarif
Expand Down
Loading