@samitouri / QOS-React / commits / 5d0ccf23e4

[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]) <noreply@anthropic.com>

Sebastian "Sebbie" Silbermann committed Aug 25, 2026 at 09:40 UTC 5d0ccf23e49f40ac423d1951cc2744e96cc9390d
1 file changed +123 -80
.github/workflows/runtime_build_and_test.yml
+123 -80
@@ -377,6 +377,19 @@ jobs:
377 - uses: actions/checkout@v4
378 with:
379 ref: ${{ github.event.pull_request.head.sha || github.sha }}
380 + - name: Ensure clean build directory
381 + run: rm -rf build
382 + # The build download runs in the background while Node is set up and
383 + # node_modules is restored. The `wait` step below synchronizes on it.
384 + # It must start after checkout, whose git clean would wipe `build/`.
385 + - name: Restore archived build
386 + id: download_build
387 + uses: actions/download-artifact@v4
388 + background: true
389 + with:
390 + pattern: _build_*
391 + path: build
392 + merge-multiple: true
393 - uses: actions/setup-node@v4
394 with:
395 node-version-file: '.nvmrc'
@@ -388,18 +401,12 @@ jobs:
401 **/node_modules
402 key: runtime-and-compiler-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
403 # Don't use restore-keys here. Otherwise the cache grows indefinitely.
391 - - name: Ensure clean build directory
392 - run: rm -rf build
404 - run: yarn install --frozen-lockfile
405 if: steps.node_modules.outputs.cache-hit != 'true'
406 - run: yarn --cwd compiler install --frozen-lockfile
407 if: steps.node_modules.outputs.cache-hit != 'true'
397 - - name: Restore archived build
398 - uses: actions/download-artifact@v4
399 - with:
400 - pattern: _build_*
401 - path: build
402 - merge-multiple: true
408 + - name: Wait for archived build
409 + wait: download_build
410 - name: Display structure of build
411 run: ls -R build
412 - run: node --version
@@ -422,6 +429,16 @@ jobs:
429 - uses: actions/checkout@v4
430 with:
431 ref: ${{ github.event.pull_request.head.sha || github.sha }}
432 + - name: Ensure clean build directory
433 + run: rm -rf build
434 + - name: Restore archived build
435 + id: download_build
436 + uses: actions/download-artifact@v4
437 + background: true
438 + with:
439 + pattern: _build_*
440 + path: build
441 + merge-multiple: true
442 - uses: actions/setup-node@v4
443 with:
444 node-version-file: '.nvmrc'
@@ -433,16 +450,10 @@ jobs:
450 **/node_modules
451 key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
452 # Don't use restore-keys here. Otherwise the cache grows indefinitely.
436 - - name: Ensure clean build directory
437 - run: rm -rf build
453 - run: yarn install --frozen-lockfile
454 if: steps.node_modules.outputs.cache-hit != 'true'
440 - - name: Restore archived build
441 - uses: actions/download-artifact@v4
442 - with:
443 - pattern: _build_*
444 - path: build
445 - merge-multiple: true
455 + - name: Wait for archived build
456 + wait: download_build
457 - name: Display structure of build
458 run: ls -R build
459 - run: node --version
@@ -460,6 +471,16 @@ jobs:
471 - uses: actions/checkout@v4
472 with:
473 ref: ${{ github.event.pull_request.head.sha || github.sha }}
474 + - name: Ensure clean build directory
475 + run: rm -rf build
476 + - name: Restore archived build
477 + id: download_build
478 + uses: actions/download-artifact@v4
479 + background: true
480 + with:
481 + pattern: _build_*
482 + path: build
483 + merge-multiple: true
484 - uses: actions/setup-node@v4
485 with:
486 node-version-file: '.nvmrc'
@@ -471,16 +492,10 @@ jobs:
492 **/node_modules
493 key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
494 # Don't use restore-keys here. Otherwise the cache grows indefinitely.
474 - - name: Ensure clean build directory
475 - run: rm -rf build
495 - run: yarn install --frozen-lockfile
496 if: steps.node_modules.outputs.cache-hit != 'true'
478 - - name: Restore archived build
479 - uses: actions/download-artifact@v4
480 - with:
481 - pattern: _build_*
482 - path: build
483 - merge-multiple: true
497 + - name: Wait for archived build
498 + wait: download_build
499 # Only used to log weight variance; the new measurement is what gets
500 # saved, so removed bundles drop out instead of accumulating.
501 - name: Restore previous build shard weights
@@ -547,6 +562,16 @@ jobs:
562 - uses: actions/checkout@v4
563 with:
564 ref: ${{ github.event.pull_request.head.sha || github.sha }}
565 + - name: Ensure clean build directory
566 + run: rm -rf build
567 + - name: Restore archived build
568 + id: download_build
569 + uses: actions/download-artifact@v4
570 + background: true
571 + with:
572 + pattern: _build_*
573 + path: build
574 + merge-multiple: true
575 - uses: actions/setup-node@v4
576 with:
577 node-version-file: '.nvmrc'
@@ -558,16 +583,10 @@ jobs:
583 **/node_modules
584 key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
585 # Don't use restore-keys here. Otherwise the cache grows indefinitely.
561 - - name: Ensure clean build directory
562 - run: rm -rf build
586 - run: yarn install --frozen-lockfile
587 if: steps.node_modules.outputs.cache-hit != 'true'
565 - - name: Restore archived build
566 - uses: actions/download-artifact@v4
567 - with:
568 - pattern: _build_*
569 - path: build
570 - merge-multiple: true
588 + - name: Wait for archived build
589 + wait: download_build
590 - name: Display structure of build
591 run: ls -R build
592 - name: Search build artifacts for unminified errors
@@ -583,6 +602,16 @@ jobs:
602 - uses: actions/checkout@v4
603 with:
604 ref: ${{ github.event.pull_request.head.sha || github.sha }}
605 + - name: Ensure clean build directory
606 + run: rm -rf build
607 + - name: Restore archived build
608 + id: download_build
609 + uses: actions/download-artifact@v4
610 + background: true
611 + with:
612 + pattern: _build_*
613 + path: build
614 + merge-multiple: true
615 - uses: actions/setup-node@v4
616 with:
617 node-version-file: '.nvmrc'
@@ -594,16 +623,10 @@ jobs:
623 **/node_modules
624 key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
625 # Don't use restore-keys here. Otherwise the cache grows indefinitely.
597 - - name: Ensure clean build directory
598 - run: rm -rf build
626 - run: yarn install --frozen-lockfile
627 if: steps.node_modules.outputs.cache-hit != 'true'
601 - - name: Restore archived build
602 - uses: actions/download-artifact@v4
603 - with:
604 - pattern: _build_*
605 - path: build
606 - merge-multiple: true
628 + - name: Wait for archived build
629 + wait: download_build
630 - name: Display structure of build
631 run: ls -R build
632 - run: yarn check-release-dependencies
@@ -616,6 +639,16 @@ jobs:
639 - uses: actions/checkout@v4
640 with:
641 ref: ${{ github.event.pull_request.head.sha || github.sha }}
642 + - name: Ensure clean build directory
643 + run: rm -rf build
644 + - name: Restore archived build
645 + id: download_build
646 + uses: actions/download-artifact@v4
647 + background: true
648 + with:
649 + pattern: _build_*
650 + path: build
651 + merge-multiple: true
652 - uses: actions/setup-node@v4
653 with:
654 node-version-file: '.nvmrc'
@@ -626,16 +659,10 @@ jobs:
659 path: |
660 **/node_modules
661 key: fixtures_dom-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'fixtures/dom/yarn.lock') }}
629 - - name: Ensure clean build directory
630 - run: rm -rf build
662 - run: yarn --cwd fixtures/dom install --frozen-lockfile
663 if: steps.node_modules.outputs.cache-hit != 'true'
633 - - name: Restore archived build
634 - uses: actions/download-artifact@v4
635 - with:
636 - pattern: _build_*
637 - path: build
638 - merge-multiple: true
664 + - name: Wait for archived build
665 + wait: download_build
666 - name: Display structure of build
667 run: ls -R build
668 - name: Run DOM fixture tests
@@ -655,6 +682,16 @@ jobs:
682 - uses: actions/checkout@v4
683 with:
684 ref: ${{ github.event.pull_request.head.sha || github.sha }}
685 + - name: Ensure clean build directory
686 + run: rm -rf build
687 + - name: Restore archived build
688 + id: download_build
689 + uses: actions/download-artifact@v4
690 + background: true
691 + with:
692 + pattern: _build_*
693 + path: build
694 + merge-multiple: true
695 - uses: actions/setup-node@v4
696 with:
697 node-version-file: '.nvmrc'
@@ -668,8 +705,6 @@ jobs:
705 path: |
706 **/node_modules
707 key: fixtures_flight-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'fixtures/flight/yarn.lock') }}
671 - - name: Ensure clean build directory
672 - run: rm -rf build
708 - run: yarn install --frozen-lockfile
709 if: steps.node_modules.outputs.cache-hit != 'true'
710 - run: yarn --cwd fixtures/flight install --frozen-lockfile
@@ -687,12 +722,8 @@ jobs:
722 if: steps.cache_playwright_browsers.outputs.cache-hit != 'true'
723 working-directory: fixtures/flight
724 run: npx playwright install --with-deps chromium
690 - - name: Restore archived build
691 - uses: actions/download-artifact@v4
692 - with:
693 - pattern: _build_*
694 - path: build
695 - merge-multiple: true
725 + - name: Wait for archived build
726 + wait: download_build
727 - name: Display structure of build
728 run: ls -R build
729 - name: Run tests
@@ -727,6 +758,16 @@ jobs:
758 - uses: actions/checkout@v4
759 with:
760 ref: ${{ github.event.pull_request.head.sha || github.sha }}
761 + - name: Ensure clean build directory
762 + run: rm -rf build
763 + - name: Restore archived build
764 + id: download_build
765 + uses: actions/download-artifact@v4
766 + background: true
767 + with:
768 + pattern: _build_*
769 + path: build
770 + merge-multiple: true
771 - uses: actions/setup-node@v4
772 with:
773 node-version-file: '.nvmrc'
@@ -738,16 +779,10 @@ jobs:
779 **/node_modules
780 key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
781 # Don't use restore-keys here. Otherwise the cache grows indefinitely.
741 - - name: Ensure clean build directory
742 - run: rm -rf build
782 - run: yarn install --frozen-lockfile
783 if: steps.node_modules.outputs.cache-hit != 'true'
745 - - name: Restore archived build
746 - uses: actions/download-artifact@v4
747 - with:
748 - pattern: _build_*
749 - path: build
750 - merge-multiple: true
784 + - name: Wait for archived build
785 + wait: download_build
786 - run: ./scripts/ci/pack_and_store_devtools_artifacts.sh ${{ matrix.browser }}
787 env:
788 RELEASE_CHANNEL: experimental
@@ -821,6 +856,16 @@ jobs:
856 - uses: actions/checkout@v4
857 with:
858 ref: ${{ github.event.pull_request.head.sha || github.sha }}
859 + - name: Ensure clean build directory
860 + run: rm -rf build
861 + - name: Restore archived build
862 + id: download_build
863 + uses: actions/download-artifact@v4
864 + background: true
865 + with:
866 + pattern: _build_*
867 + path: build
868 + merge-multiple: true
869 - uses: actions/setup-node@v4
870 with:
871 node-version-file: '.nvmrc'
@@ -832,22 +877,16 @@ jobs:
877 **/node_modules
878 key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
879 # Don't use restore-keys here. Otherwise the cache grows indefinitely.
835 - - name: Ensure clean build directory
836 - run: rm -rf build
880 - run: yarn install --frozen-lockfile
881 if: steps.node_modules.outputs.cache-hit != 'true'
839 - - name: Restore archived build
840 - uses: actions/download-artifact@v4
841 - with:
842 - pattern: _build_*
843 - path: build
844 - merge-multiple: true
882 - name: Restore Playwright Chromium
883 uses: actions/cache/restore@v4
884 with:
885 path: ~/.cache/ms-playwright
886 key: playwright-browsers-v6-${{ runner.arch }}-${{ runner.os }}-${{ needs.runtime_playwright_chromium_cache.outputs.playwright_version }}
887 fail-on-cache-miss: true
888 + - name: Wait for archived build
889 + wait: download_build
890 - run: ./scripts/ci/run_devtools_e2e_tests.js
891 env:
892 RELEASE_CHANNEL: experimental
@@ -866,6 +905,16 @@ jobs:
905 - uses: actions/checkout@v4
906 with:
907 ref: ${{ github.event.pull_request.head.sha || github.sha }}
908 + - name: Ensure clean build directory
909 + run: rm -rf build
910 + - name: Restore archived build
911 + id: download_build
912 + uses: actions/download-artifact@v4
913 + background: true
914 + with:
915 + pattern: _build_*
916 + path: build
917 + merge-multiple: true
918 - uses: actions/setup-node@v4
919 with:
920 node-version-file: '.nvmrc'
@@ -877,16 +926,8 @@ jobs:
926 **/node_modules
927 key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
928 # Don't use restore-keys here. Otherwise the cache grows indefinitely.
880 - - name: Ensure clean build directory
881 - run: rm -rf build
929 - run: yarn install --frozen-lockfile
930 if: steps.node_modules.outputs.cache-hit != 'true'
884 - - name: Restore archived build
885 - uses: actions/download-artifact@v4
886 - with:
887 - pattern: _build_*
888 - path: build
889 - merge-multiple: true
931 - name: Restore Playwright Chromium
932 uses: actions/cache/restore@v4
933 with:
@@ -898,6 +939,8 @@ jobs:
939 run: |
940 echo "executable_path=$(node -e 'process.stdout.write(require("playwright").chromium.executablePath())')" >> "$GITHUB_OUTPUT"
941 "$(node -e 'process.stdout.write(require("playwright").chromium.executablePath())')" --version
942 + - name: Wait for archived build
943 + wait: download_build
944 - name: Run React DevTools CDT MCP e2e tests
945 run: yarn --cwd packages/react-devtools-cdt-mcp test:e2e:ci
946 env: