[ci] Run Java setup in the background during build job setup (#37351)
In `build_and_lint`, `actions/setup-java` ran sequentially between setup-node and the node_modules cache restore, but Java is only needed by `yarn build` for the Closure Compiler bundles. This change marks the setup-java step as a background step. Setting up Java is mostly network (download) and CPU (unpack). It overlaps with installing/restoring node_modules which is network and FS work. So we aren't competing for resources that would make concurrently running steps moot. Co-authored-by: Claude Code (kimi-k3[1m]) <noreply@anthropic.com>
Sebastian "Sebbie" Silbermann committed
Aug 25, 2026 at 09:41 UTC
f789f203e8b1e639330e51c828809f03619ac177
1 file changed
+12
-4
.github/workflows/runtime_build_and_test.yml
+12
-4
@@ -281,13 +281,18 @@ jobs:
281
- uses: actions/checkout@v4
282
with:
283
ref: ${{ github.event.pull_request.head.sha || github.sha }}
284
- - uses: actions/setup-node@v4
285
- with:
286
- node-version-file: '.nvmrc'
287
- - uses: actions/setup-java@v4
284
+ # Java is only needed by `yarn build` (Closure Compiler), so its setup
285
+ # runs in the background while Node and node_modules are set up.
286
+ - name: Set up Java
287
+ id: setup_java
288
+ uses: actions/setup-java@v4
289
+ background: true
290
with:
291
distribution: temurin
292
java-version: 11.0.22
293
+ - uses: actions/setup-node@v4
294
+ with:
295
+ node-version-file: '.nvmrc'
296
- name: Restore cached node_modules
297
uses: actions/cache/restore@v4
298
id: node_modules
@@ -311,6 +316,9 @@ jobs:
316
path: build-weights.json
317
key: build-weights-v1-${{ github.run_id }}
318
restore-keys: build-weights-v1-
319
+ # setup-java's exports (e.g. JAVA_HOME) only apply to steps after this wait.
320
+ - name: Wait for Java setup
321
+ wait: setup_java
322
- run: yarn build --index=${{ matrix.worker_id }} --total=25 --r=${{ matrix.release_channel }} --ci
323
env:
324
CI: github