From 5d0ccf23e49f40ac423d1951cc2744e96cc9390d Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Tue, 25 Aug 2026 09:40:18 +0200 Subject: [PATCH 1/2] [ci] Download build artifacts in the background during job setup (#37350) Every downstream job in `runtime_build_and_test.yml` restored the 50 `_build_*` artifacts with `actions/download-artifact` only after setup-node, the node_modules cache restore, and any installs had completed, even though the download is independent of all of them. This change marks the download as a [background step](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsbackground) started immediately after checkout, and adds an explicit `wait: download_build` before the first step that reads `build/`. The download starts after checkout because `actions/checkout` runs `git clean`, which would wipe a previously downloaded `build/` directory. The `sizebot` job is unchanged because its base-build download also writes `./build` and would collide with a concurrent artifact restore. This only shaves of a few seconds from wall time. It's more about establishing precedent. Co-authored-by: Claude Code (kimi-k3[1m]) --- .github/workflows/runtime_build_and_test.yml | 203 +++++++++++-------- 1 file changed, 123 insertions(+), 80 deletions(-) diff --git a/.github/workflows/runtime_build_and_test.yml b/.github/workflows/runtime_build_and_test.yml index 307f4b62cbf1..8bfb4f4ad89e 100644 --- a/.github/workflows/runtime_build_and_test.yml +++ b/.github/workflows/runtime_build_and_test.yml @@ -377,6 +377,19 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Ensure clean build directory + run: rm -rf build + # The build download runs in the background while Node is set up and + # node_modules is restored. The `wait` step below synchronizes on it. + # It must start after checkout, whose git clean would wipe `build/`. + - name: Restore archived build + id: download_build + uses: actions/download-artifact@v4 + background: true + with: + pattern: _build_* + path: build + merge-multiple: true - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -388,18 +401,12 @@ jobs: **/node_modules key: runtime-and-compiler-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }} # Don't use restore-keys here. Otherwise the cache grows indefinitely. - - name: Ensure clean build directory - run: rm -rf build - run: yarn install --frozen-lockfile if: steps.node_modules.outputs.cache-hit != 'true' - run: yarn --cwd compiler install --frozen-lockfile if: steps.node_modules.outputs.cache-hit != 'true' - - name: Restore archived build - uses: actions/download-artifact@v4 - with: - pattern: _build_* - path: build - merge-multiple: true + - name: Wait for archived build + wait: download_build - name: Display structure of build run: ls -R build - run: node --version @@ -422,6 +429,16 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Ensure clean build directory + run: rm -rf build + - name: Restore archived build + id: download_build + uses: actions/download-artifact@v4 + background: true + with: + pattern: _build_* + path: build + merge-multiple: true - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -433,16 +450,10 @@ jobs: **/node_modules key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} # Don't use restore-keys here. Otherwise the cache grows indefinitely. - - name: Ensure clean build directory - run: rm -rf build - run: yarn install --frozen-lockfile if: steps.node_modules.outputs.cache-hit != 'true' - - name: Restore archived build - uses: actions/download-artifact@v4 - with: - pattern: _build_* - path: build - merge-multiple: true + - name: Wait for archived build + wait: download_build - name: Display structure of build run: ls -R build - run: node --version @@ -460,6 +471,16 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Ensure clean build directory + run: rm -rf build + - name: Restore archived build + id: download_build + uses: actions/download-artifact@v4 + background: true + with: + pattern: _build_* + path: build + merge-multiple: true - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -471,16 +492,10 @@ jobs: **/node_modules key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} # Don't use restore-keys here. Otherwise the cache grows indefinitely. - - name: Ensure clean build directory - run: rm -rf build - run: yarn install --frozen-lockfile if: steps.node_modules.outputs.cache-hit != 'true' - - name: Restore archived build - uses: actions/download-artifact@v4 - with: - pattern: _build_* - path: build - merge-multiple: true + - name: Wait for archived build + wait: download_build # Only used to log weight variance; the new measurement is what gets # saved, so removed bundles drop out instead of accumulating. - name: Restore previous build shard weights @@ -547,6 +562,16 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Ensure clean build directory + run: rm -rf build + - name: Restore archived build + id: download_build + uses: actions/download-artifact@v4 + background: true + with: + pattern: _build_* + path: build + merge-multiple: true - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -558,16 +583,10 @@ jobs: **/node_modules key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} # Don't use restore-keys here. Otherwise the cache grows indefinitely. - - name: Ensure clean build directory - run: rm -rf build - run: yarn install --frozen-lockfile if: steps.node_modules.outputs.cache-hit != 'true' - - name: Restore archived build - uses: actions/download-artifact@v4 - with: - pattern: _build_* - path: build - merge-multiple: true + - name: Wait for archived build + wait: download_build - name: Display structure of build run: ls -R build - name: Search build artifacts for unminified errors @@ -583,6 +602,16 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Ensure clean build directory + run: rm -rf build + - name: Restore archived build + id: download_build + uses: actions/download-artifact@v4 + background: true + with: + pattern: _build_* + path: build + merge-multiple: true - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -594,16 +623,10 @@ jobs: **/node_modules key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} # Don't use restore-keys here. Otherwise the cache grows indefinitely. - - name: Ensure clean build directory - run: rm -rf build - run: yarn install --frozen-lockfile if: steps.node_modules.outputs.cache-hit != 'true' - - name: Restore archived build - uses: actions/download-artifact@v4 - with: - pattern: _build_* - path: build - merge-multiple: true + - name: Wait for archived build + wait: download_build - name: Display structure of build run: ls -R build - run: yarn check-release-dependencies @@ -616,6 +639,16 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Ensure clean build directory + run: rm -rf build + - name: Restore archived build + id: download_build + uses: actions/download-artifact@v4 + background: true + with: + pattern: _build_* + path: build + merge-multiple: true - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -626,16 +659,10 @@ jobs: path: | **/node_modules key: fixtures_dom-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'fixtures/dom/yarn.lock') }} - - name: Ensure clean build directory - run: rm -rf build - run: yarn --cwd fixtures/dom install --frozen-lockfile if: steps.node_modules.outputs.cache-hit != 'true' - - name: Restore archived build - uses: actions/download-artifact@v4 - with: - pattern: _build_* - path: build - merge-multiple: true + - name: Wait for archived build + wait: download_build - name: Display structure of build run: ls -R build - name: Run DOM fixture tests @@ -655,6 +682,16 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Ensure clean build directory + run: rm -rf build + - name: Restore archived build + id: download_build + uses: actions/download-artifact@v4 + background: true + with: + pattern: _build_* + path: build + merge-multiple: true - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -668,8 +705,6 @@ jobs: path: | **/node_modules key: fixtures_flight-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'fixtures/flight/yarn.lock') }} - - name: Ensure clean build directory - run: rm -rf build - run: yarn install --frozen-lockfile if: steps.node_modules.outputs.cache-hit != 'true' - run: yarn --cwd fixtures/flight install --frozen-lockfile @@ -687,12 +722,8 @@ jobs: if: steps.cache_playwright_browsers.outputs.cache-hit != 'true' working-directory: fixtures/flight run: npx playwright install --with-deps chromium - - name: Restore archived build - uses: actions/download-artifact@v4 - with: - pattern: _build_* - path: build - merge-multiple: true + - name: Wait for archived build + wait: download_build - name: Display structure of build run: ls -R build - name: Run tests @@ -727,6 +758,16 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Ensure clean build directory + run: rm -rf build + - name: Restore archived build + id: download_build + uses: actions/download-artifact@v4 + background: true + with: + pattern: _build_* + path: build + merge-multiple: true - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -738,16 +779,10 @@ jobs: **/node_modules key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} # Don't use restore-keys here. Otherwise the cache grows indefinitely. - - name: Ensure clean build directory - run: rm -rf build - run: yarn install --frozen-lockfile if: steps.node_modules.outputs.cache-hit != 'true' - - name: Restore archived build - uses: actions/download-artifact@v4 - with: - pattern: _build_* - path: build - merge-multiple: true + - name: Wait for archived build + wait: download_build - run: ./scripts/ci/pack_and_store_devtools_artifacts.sh ${{ matrix.browser }} env: RELEASE_CHANNEL: experimental @@ -821,6 +856,16 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Ensure clean build directory + run: rm -rf build + - name: Restore archived build + id: download_build + uses: actions/download-artifact@v4 + background: true + with: + pattern: _build_* + path: build + merge-multiple: true - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -832,22 +877,16 @@ jobs: **/node_modules key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} # Don't use restore-keys here. Otherwise the cache grows indefinitely. - - name: Ensure clean build directory - run: rm -rf build - run: yarn install --frozen-lockfile if: steps.node_modules.outputs.cache-hit != 'true' - - name: Restore archived build - uses: actions/download-artifact@v4 - with: - pattern: _build_* - path: build - merge-multiple: true - name: Restore Playwright Chromium uses: actions/cache/restore@v4 with: path: ~/.cache/ms-playwright key: playwright-browsers-v6-${{ runner.arch }}-${{ runner.os }}-${{ needs.runtime_playwright_chromium_cache.outputs.playwright_version }} fail-on-cache-miss: true + - name: Wait for archived build + wait: download_build - run: ./scripts/ci/run_devtools_e2e_tests.js env: RELEASE_CHANNEL: experimental @@ -866,6 +905,16 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Ensure clean build directory + run: rm -rf build + - name: Restore archived build + id: download_build + uses: actions/download-artifact@v4 + background: true + with: + pattern: _build_* + path: build + merge-multiple: true - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' @@ -877,16 +926,8 @@ jobs: **/node_modules key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} # Don't use restore-keys here. Otherwise the cache grows indefinitely. - - name: Ensure clean build directory - run: rm -rf build - run: yarn install --frozen-lockfile if: steps.node_modules.outputs.cache-hit != 'true' - - name: Restore archived build - uses: actions/download-artifact@v4 - with: - pattern: _build_* - path: build - merge-multiple: true - name: Restore Playwright Chromium uses: actions/cache/restore@v4 with: @@ -898,6 +939,8 @@ jobs: run: | echo "executable_path=$(node -e 'process.stdout.write(require("playwright").chromium.executablePath())')" >> "$GITHUB_OUTPUT" "$(node -e 'process.stdout.write(require("playwright").chromium.executablePath())')" --version + - name: Wait for archived build + wait: download_build - name: Run React DevTools CDT MCP e2e tests run: yarn --cwd packages/react-devtools-cdt-mcp test:e2e:ci env: From f789f203e8b1e639330e51c828809f03619ac177 Mon Sep 17 00:00:00 2001 From: "Sebastian \"Sebbie\" Silbermann" Date: Tue, 25 Aug 2026 09:41:48 +0200 Subject: [PATCH 2/2] [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]) --- .github/workflows/runtime_build_and_test.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/runtime_build_and_test.yml b/.github/workflows/runtime_build_and_test.yml index 8bfb4f4ad89e..714a672c11ee 100644 --- a/.github/workflows/runtime_build_and_test.yml +++ b/.github/workflows/runtime_build_and_test.yml @@ -281,13 +281,18 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - - uses: actions/setup-java@v4 + # Java is only needed by `yarn build` (Closure Compiler), so its setup + # runs in the background while Node and node_modules are set up. + - name: Set up Java + id: setup_java + uses: actions/setup-java@v4 + background: true with: distribution: temurin java-version: 11.0.22 + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' - name: Restore cached node_modules uses: actions/cache/restore@v4 id: node_modules @@ -311,6 +316,9 @@ jobs: path: build-weights.json key: build-weights-v1-${{ github.run_id }} restore-keys: build-weights-v1- + # setup-java's exports (e.g. JAVA_HOME) only apply to steps after this wait. + - name: Wait for Java setup + wait: setup_java - run: yarn build --index=${{ matrix.worker_id }} --total=25 --r=${{ matrix.release_channel }} --ci env: CI: github