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
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
verify:
name: Verify build and generated bundle
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.18.0
cache: npm
cache-dependency-path: highlightjs-jvm/package-lock.json

- name: Verify generated Highlight.js bundle
working-directory: highlightjs-jvm
run: ./buildBundle.sh --verify

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

- name: Install Maven artifacts locally
run: mvn --batch-mode install -DskipGradleDriver=true

- name: Build Gradle plugin and run tests
working-directory: gmd-gradle-plugin
run: ./gradlew --no-daemon build
7 changes: 4 additions & 3 deletions highlightjs-jvm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ chaining, so **no polyfills are injected and nothing is hand-edited**. Rhino can
which is the entire reason the transpile exists.

The toolchain is pinned by `package.json` and `package-lock.json` and installed with
`npm ci`, so the output is byte-reproducible. `./buildBundle.sh --verify` regenerates to a
temp file and diffs against the committed bundle, exiting non-zero if it is stale. Maven
never runs any of this, so a normal build needs no Node.
`npm ci`, so the output is byte-reproducible. Bundle generation requires Node.js 22.18.0 or
newer. `./buildBundle.sh --verify` regenerates to a temp file and diffs against the committed
bundle, exiting non-zero if it is stale. Maven never runs any of this, so a normal build needs
no Node.

To upgrade Highlight.js, replace `source/highlightJs` with a newer `@highlightjs/cdn-assets`
release, run `./buildBundle.sh`, and commit the result.
Expand Down
17 changes: 12 additions & 5 deletions highlightjs-jvm/buildBundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Regenerates src/main/resources/highlightJs/highlight.js for Rhino.
#
# Requires Node 18+. NOT part of the Maven build - run it by hand when the
# Requires Node 22.18.0+. NOT part of the Maven build - run it by hand when the
# Highlight.js distribution changes, then commit the regenerated bundle.
#
# ./buildBundle.sh regenerate the bundle
Expand All @@ -23,13 +23,20 @@ if [ ! -d "$SRC/languages" ]; then
echo "Missing $SRC - the Highlight.js cdn-assets tree must be present" >&2
exit 1
fi
MIN_NODE_MAJOR=22
MIN_NODE_MINOR=18

if ! command -v node >/dev/null 2>&1; then
echo "Node 18+ is required to regenerate the bundle; none found on PATH" >&2
echo "Node 22.18.0+ is required to regenerate the bundle; none found on PATH" >&2
exit 1
fi
NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]')"
if [ "$NODE_MAJOR" -lt 18 ]; then
echo "Node 18+ is required to regenerate the bundle; found $(node --version)" >&2
NODE_VERSION="$(node -p 'process.versions.node')"
NODE_MAJOR="${NODE_VERSION%%.*}"
NODE_MINOR="${NODE_VERSION#*.}"
NODE_MINOR="${NODE_MINOR%%.*}"
if [ "$NODE_MAJOR" -lt "$MIN_NODE_MAJOR" ] || \
{ [ "$NODE_MAJOR" -eq "$MIN_NODE_MAJOR" ] && [ "$NODE_MINOR" -lt "$MIN_NODE_MINOR" ]; }; then
echo "Node 22.18.0+ is required to regenerate the bundle; found v$NODE_VERSION" >&2
exit 1
fi

Expand Down
3 changes: 3 additions & 0 deletions highlightjs-jvm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions highlightjs-jvm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "highlightjs-jvm-bundle",
"private": true,
"description": "Build-time only. Transpiles the Highlight.js distribution for Rhino.",
"engines": {
"node": ">=22.18.0"
},
"devDependencies": {
"@babel/cli": "8.0.4",
"@babel/core": "8.0.1",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading