diff --git a/.github/workflows/runtime_build_and_test.yml b/.github/workflows/runtime_build_and_test.yml index 307f4b62cbf1..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 @@ -377,6 +385,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 +409,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 +437,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 +458,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 +479,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 +500,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 +570,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 +591,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 +610,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 +631,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 +647,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 +667,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 +690,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 +713,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 +730,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 +766,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 +787,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 +864,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 +885,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 +913,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 +934,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 +947,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: