.github/workflows/runtime_build_and_test.yml YAML 858 lines View on github.com → Search inside
1name: (Runtime) Build and Test23on:4  push:5    branches:6      # release branches (keep in sync with branches that receive artifact attestations)7      - main8      - releases/**9  pull_request:10    paths-ignore:11      - compiler/**12  # Manual re-runs are allowed. The workflow always runs on the SHA it was13  # dispatched from (github.sha); no user-supplied ref is accepted, because14  # downstream workflows (e.g. runtime_release_from_ci) consume this15  # workflow's artifacts under a protected environment.16  workflow_dispatch:1718permissions: {}1920concurrency:21  group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.run_id }}22  cancel-in-progress: true2324env:25  TZ: /usr/share/zoneinfo/America/Los_Angeles26  # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout27  SEGMENT_DOWNLOAD_TIMEOUT_MINS: 12829jobs:30  # ----- NODE_MODULES CACHE -----31  # Centralize the node_modules cache so it is saved once and each subsequent job only needs to32  # restore the cache. Prevents race conditions where multiple workflows try to write to the cache.33  runtime_node_modules_cache:34    name: Cache Runtime node_modules35    runs-on: ubuntu-latest36    steps:37      - uses: actions/checkout@v438        with:39          ref: ${{ github.event.pull_request.head.sha || github.sha }}40      41      - name: Prepare cache42        id: node_modules43        uses: actions/cache@v444        with:45          path: |46            **/node_modules47          key: runtime-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}48          # Don't use restore-keys here. Otherwise the cache grows indefinitely.4950      - uses: actions/setup-node@v451        if: steps.node_modules.outputs.cache-hit != 'true'52        with:53          node-version-file: '.nvmrc'5455      - run: yarn install --frozen-lockfile56        if: steps.node_modules.outputs.cache-hit != 'true'5758  runtime_compiler_node_modules_cache:59    name: Cache Runtime, Compiler node_modules60    runs-on: ubuntu-latest61    steps:62      - uses: actions/checkout@v463        with:64          ref: ${{ github.event.pull_request.head.sha || github.sha }}65      - uses: actions/setup-node@v466        with:67          node-version-file: '.nvmrc'68      - name: Prepare cache69        id: node_modules70        uses: actions/cache@v471        with:72          path: |73            **/node_modules74          key: runtime-and-compiler-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}75          # Don't use restore-keys here. Otherwise the cache grows indefinitely.76      - run: yarn install --frozen-lockfile77        if: steps.node_modules.outputs.cache-hit != 'true'78      - run: yarn --cwd compiler install --frozen-lockfile79        if: steps.node_modules.outputs.cache-hit != 'true'8081  # ----- FLOW -----82  discover_flow_inline_configs:83    name: Discover flow inline configs84    runs-on: ubuntu-latest85    outputs:86      matrix: ${{ steps.set-matrix.outputs.result }}87    steps:88      - uses: actions/checkout@v489        with:90          ref: ${{ github.event.pull_request.head.sha || github.sha }}91      - uses: actions/github-script@v792        id: set-matrix93        with:94          script: |95            const inlinedHostConfigs = require('./scripts/shared/inlinedHostConfigs.js');96            return inlinedHostConfigs.map(config => config.shortName);9798  flow:99    name: Flow check ${{ matrix.flow_inline_config_shortname }}100    needs: [discover_flow_inline_configs, runtime_node_modules_cache]101    runs-on: ubuntu-latest102    strategy:103      fail-fast: false104      matrix:105        flow_inline_config_shortname: ${{ fromJSON(needs.discover_flow_inline_configs.outputs.matrix) }}106    steps:107      - uses: actions/checkout@v4108        with:109          ref: ${{ github.event.pull_request.head.sha || github.sha }}110      - uses: actions/setup-node@v4111        with:112          node-version-file: '.nvmrc'113      - name: Restore cached node_modules114        uses: actions/cache/restore@v4115        id: node_modules116        with:117          path: |118            **/node_modules119          key: runtime-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}120          # Don't use restore-keys here. Otherwise the cache grows indefinitely.121      - name: Ensure clean build directory122        run: rm -rf build123      - run: yarn install --frozen-lockfile124        if: steps.node_modules.outputs.cache-hit != 'true'125      - run: node ./scripts/tasks/flow-ci ${{ matrix.flow_inline_config_shortname }}126127  # ----- FIZZ -----128  check_generated_fizz_runtime:129    name: Confirm generated inline Fizz runtime is up to date130    needs: [runtime_node_modules_cache]131    runs-on: ubuntu-latest132    steps:133      - uses: actions/checkout@v4134        with:135          ref: ${{ github.event.pull_request.head.sha || github.sha }}136      - uses: actions/setup-node@v4137        with:138          node-version-file: '.nvmrc'139      - name: Restore cached node_modules140        uses: actions/cache/restore@v4141        id: node_modules142        with:143          path: |144            **/node_modules145          key: runtime-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}146          # Don't use restore-keys here. Otherwise the cache grows indefinitely.147      - name: Ensure clean build directory148        run: rm -rf build149      - run: yarn install --frozen-lockfile150        if: steps.node_modules.outputs.cache-hit != 'true'151      - run: |152          yarn generate-inline-fizz-runtime153          git diff --exit-code || (echo "There was a change to the Fizz runtime. Run \`yarn generate-inline-fizz-runtime\` and check in the result." && false)154155  # ----- FEATURE FLAGS -----156  flags:157    name: Check flags158    needs: [runtime_node_modules_cache]159    runs-on: ubuntu-latest160    steps:161      - uses: actions/checkout@v4162        with:163          ref: ${{ github.event.pull_request.head.sha || github.sha }}164      - uses: actions/setup-node@v4165        with:166          node-version-file: '.nvmrc'167      - name: Restore cached node_modules168        uses: actions/cache/restore@v4169        id: node_modules170        with:171          path: |172            **/node_modules173          key: runtime-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}174      - name: Ensure clean build directory175        run: rm -rf build176      - run: yarn install --frozen-lockfile177        if: steps.node_modules.outputs.cache-hit != 'true'178      - run: yarn flags179180  # ----- TESTS -----181  test:182    name: yarn test ${{ matrix.params }} (Shard ${{ matrix.shard }})183    needs: [runtime_compiler_node_modules_cache]184    runs-on: ubuntu-latest185    strategy:186      fail-fast: false187      matrix:188        params:189          - "-r=stable --env=development"190          - "-r=stable --env=production"191          - "-r=experimental --env=development"192          - "-r=experimental --env=production"193          - "-r=www-classic --env=development --variant=false"194          - "-r=www-classic --env=production --variant=false"195          - "-r=www-classic --env=development --variant=true"196          - "-r=www-classic --env=production --variant=true"197          - "-r=www-modern --env=development --variant=false"198          - "-r=www-modern --env=production --variant=false"199          - "-r=www-modern --env=development --variant=true"200          - "-r=www-modern --env=production --variant=true"201          - "-r=xplat --env=development --variant=false"202          - "-r=xplat --env=development --variant=true"203          - "-r=xplat --env=production --variant=false"204          - "-r=xplat --env=production --variant=true"205          # TODO: Test more persistent configurations?206          - "-r=stable --env=development --persistent"207          - "-r=experimental --env=development --persistent"208        shard:209          - 1/5210          - 2/5211          - 3/5212          - 4/5213          - 5/5214    steps:215      - uses: actions/checkout@v4216        with:217          ref: ${{ github.event.pull_request.head.sha || github.sha }}218      - uses: actions/setup-node@v4219        with:220          node-version-file: '.nvmrc'221      - name: Restore cached node_modules222        uses: actions/cache/restore@v4223        id: node_modules224        with:225          path: |226            **/node_modules227          key: runtime-and-compiler-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}228          # Don't use restore-keys here. Otherwise the cache grows indefinitely.229      - name: Ensure clean build directory230        run: rm -rf build231      - run: yarn install --frozen-lockfile232        if: steps.node_modules.outputs.cache-hit != 'true'233      - run: yarn --cwd compiler install --frozen-lockfile234        if: steps.node_modules.outputs.cache-hit != 'true'235      - run: node --version236      - run: yarn test ${{ matrix.params }} --ci --shard=${{ matrix.shard }}237238  # Hardcoded to improve parallelism239  test-linter:240    name: Test eslint-plugin-react-hooks241    needs: [runtime_compiler_node_modules_cache]242    runs-on: ubuntu-latest243    steps:244      - uses: actions/checkout@v4245      - uses: actions/setup-node@v4246        with:247          node-version-file: '.nvmrc'248      - name: Restore cached node_modules249        uses: actions/cache/restore@v4250        id: node_modules251        with:252          path: |253            **/node_modules254          key: runtime-and-compiler-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}255      - name: Install runtime dependencies256        run: yarn install --frozen-lockfile257        if: steps.node_modules.outputs.cache-hit != 'true'258      - name: Install compiler dependencies259        run: yarn install --frozen-lockfile260        working-directory: compiler261        if: steps.node_modules.outputs.cache-hit != 'true'262      - run: ./scripts/react-compiler/build-compiler.sh && ./scripts/react-compiler/link-compiler.sh263      - run: yarn workspace eslint-plugin-react-hooks test264265  # ----- BUILD -----266  build_and_lint:267    name: yarn build and lint268    needs: [runtime_compiler_node_modules_cache]269    runs-on: ubuntu-latest270    strategy:271      fail-fast: false272      matrix:273        # yml is dumb. update the --total arg to yarn build if you change the number of workers274        worker_id: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]275        release_channel: [stable, experimental]276    steps:277      - uses: actions/checkout@v4278        with:279          ref: ${{ github.event.pull_request.head.sha || github.sha }}280      - uses: actions/setup-node@v4281        with:282          node-version-file: '.nvmrc'283      - uses: actions/setup-java@v4284        with:285          distribution: temurin286          java-version: 11.0.22287      - name: Restore cached node_modules288        uses: actions/cache/restore@v4289        id: node_modules290        with:291          path: |292            **/node_modules293          key: runtime-and-compiler-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}294          # Don't use restore-keys here. Otherwise the cache grows indefinitely.295      - name: Ensure clean build directory296        run: rm -rf build297      - run: yarn install --frozen-lockfile298        if: steps.node_modules.outputs.cache-hit != 'true'299      - run: yarn --cwd compiler install --frozen-lockfile300        if: steps.node_modules.outputs.cache-hit != 'true'301      - run: yarn build --index=${{ matrix.worker_id }} --total=25 --r=${{ matrix.release_channel }} --ci302        env:303          CI: github304          RELEASE_CHANNEL: ${{ matrix.release_channel }}305          NODE_INDEX: ${{ matrix.worker_id }}306      - name: Lint build307        run: yarn lint-build308      - name: Display structure of build309        run: ls -R build310      - name: Archive build311        uses: actions/upload-artifact@v4312        with:313          name: _build_${{ matrix.worker_id }}_${{ matrix.release_channel }}314          path: build315          if-no-files-found: error316317  test_build:318    name: yarn test-build319    needs: [build_and_lint, runtime_compiler_node_modules_cache]320    strategy:321      fail-fast: false322      matrix:323        test_params: [324          # Intentionally passing these as strings instead of creating a325          # separate parameter per CLI argument, since it's easier to326          # control/see which combinations we want to run.327          -r=stable --env=development,328          -r=stable --env=production,329          -r=experimental --env=development,330          -r=experimental --env=production,331332          # TODO: Update test config to support www build tests333          # - "-r=www-classic --env=development --variant=false"334          # - "-r=www-classic --env=production --variant=false"335          # - "-r=www-classic --env=development --variant=true"336          # - "-r=www-classic --env=production --variant=true"337          # - "-r=www-modern --env=development --variant=false"338          # - "-r=www-modern --env=production --variant=false"339          # - "-r=www-modern --env=development --variant=true"340          # - "-r=www-modern --env=production --variant=true"341342          # TODO: Update test config to support xplat build tests343          # - "-r=xplat --env=development --variant=false"344          # - "-r=xplat --env=development --variant=true"345          # - "-r=xplat --env=production --variant=false"346          # - "-r=xplat --env=production --variant=true"347348          # TODO: Test more persistent configurations?349        ]350        shard:351          - 1/10352          - 2/10353          - 3/10354          - 4/10355          - 5/10356          - 6/10357          - 7/10358          - 8/10359          - 9/10360          - 10/10361    runs-on: ubuntu-latest362    steps:363      - uses: actions/checkout@v4364        with:365          ref: ${{ github.event.pull_request.head.sha || github.sha }}366      - uses: actions/setup-node@v4367        with:368          node-version-file: '.nvmrc'369      - name: Restore cached node_modules370        uses: actions/cache/restore@v4371        id: node_modules372        with:373          path: |374            **/node_modules375          key: runtime-and-compiler-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}376          # Don't use restore-keys here. Otherwise the cache grows indefinitely.377      - name: Ensure clean build directory378        run: rm -rf build379      - run: yarn install --frozen-lockfile380        if: steps.node_modules.outputs.cache-hit != 'true'381      - run: yarn --cwd compiler install --frozen-lockfile382        if: steps.node_modules.outputs.cache-hit != 'true'383      - name: Restore archived build384        uses: actions/download-artifact@v4385        with:386          pattern: _build_*387          path: build388          merge-multiple: true389      - name: Display structure of build390        run: ls -R build391      - run: node --version392      - run: yarn test --build ${{ matrix.test_params }} --shard=${{ matrix.shard }} --ci393394  test_build_devtools:395    name: yarn test-build (devtools)396    needs: [build_and_lint, runtime_node_modules_cache]397    strategy:398      fail-fast: false399      matrix:400        shard:401          - 1/5402          - 2/5403          - 3/5404          - 4/5405          - 5/5406    runs-on: ubuntu-latest407    steps:408      - uses: actions/checkout@v4409        with:410          ref: ${{ github.event.pull_request.head.sha || github.sha }}411      - uses: actions/setup-node@v4412        with:413          node-version-file: '.nvmrc'414      - name: Restore cached node_modules415        uses: actions/cache/restore@v4416        id: node_modules417        with:418          path: |419            **/node_modules420          key: runtime-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}421          # Don't use restore-keys here. Otherwise the cache grows indefinitely.422      - name: Ensure clean build directory423        run: rm -rf build424      - run: yarn install --frozen-lockfile425        if: steps.node_modules.outputs.cache-hit != 'true'426      - name: Restore archived build427        uses: actions/download-artifact@v4428        with:429          pattern: _build_*430          path: build431          merge-multiple: true432      - name: Display structure of build433        run: ls -R build434      - run: node --version435      - run: yarn test --build --project=devtools -r=experimental --shard=${{ matrix.shard }} --ci436437  process_artifacts_combined:438    name: Process artifacts combined439    needs: [build_and_lint, runtime_node_modules_cache]440    permissions:441      # https://github.com/actions/attest-build-provenance442      id-token: write443      attestations: write444    runs-on: ubuntu-latest445    steps:446      - uses: actions/checkout@v4447        with:448          ref: ${{ github.event.pull_request.head.sha || github.sha }}449      - uses: actions/setup-node@v4450        with:451          node-version-file: '.nvmrc'452      - name: Restore cached node_modules453        uses: actions/cache/restore@v4454        id: node_modules455        with:456          path: |457            **/node_modules458          key: runtime-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}459          # Don't use restore-keys here. Otherwise the cache grows indefinitely.460      - name: Ensure clean build directory461        run: rm -rf build462      - run: yarn install --frozen-lockfile463        if: steps.node_modules.outputs.cache-hit != 'true'464      - name: Restore archived build465        uses: actions/download-artifact@v4466        with:467          pattern: _build_*468          path: build469          merge-multiple: true470      - name: Display structure of build471        run: ls -R build472      - run: echo ${{ github.event.pull_request.head.sha || github.sha }} >> build/COMMIT_SHA473      - name: Scrape warning messages474        run: |475          mkdir -p ./build/__test_utils__476          node ./scripts/print-warnings/print-warnings.js > build/__test_utils__/ReactAllWarnings.js477        # Compress build directory into a single tarball for easy download478      - run: tar -zcvf ./build.tgz ./build479        # TODO: Migrate scripts to use `build` directory instead of `build2`480      - run: cp ./build.tgz ./build2.tgz481      - name: Archive build artifacts482        id: upload_artifacts_combined483        uses: actions/upload-artifact@v4484        with:485          name: artifacts_combined486          path: |487            ./build.tgz488            ./build2.tgz489          if-no-files-found: error490      - uses: actions/attest-build-provenance@v2491        # We don't verify builds generated from pull requests not originating from react/react.492        # However, if the PR lands, the run on release branches will generate the attestation which can then493        # be used to download a build via scripts/release/download-experimental-build.js.494        #495        # Note that this means that scripts/release/download-experimental-build.js must be run with496        # --no-verify when downloading a build from a fork.497        if: github.event_name == 'push' && (github.ref_name == 'main' || startsWith(github.ref_name, 'releases/')) || github.event.pull_request.head.repo.full_name == github.repository498        with:499          subject-name: artifacts_combined.zip500          subject-digest: sha256:${{ steps.upload_artifacts_combined.outputs.artifact-digest }}501502  check_error_codes:503    name: Search build artifacts for unminified errors504    needs: [build_and_lint, runtime_node_modules_cache]505    runs-on: ubuntu-latest506    steps:507      - uses: actions/checkout@v4508        with:509          ref: ${{ github.event.pull_request.head.sha || github.sha }}510      - uses: actions/setup-node@v4511        with:512          node-version-file: '.nvmrc'513      - name: Restore cached node_modules514        uses: actions/cache/restore@v4515        id: node_modules516        with:517          path: |518            **/node_modules519          key: runtime-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}520          # Don't use restore-keys here. Otherwise the cache grows indefinitely.521      - name: Ensure clean build directory522        run: rm -rf build523      - run: yarn install --frozen-lockfile524        if: steps.node_modules.outputs.cache-hit != 'true'525      - name: Restore archived build526        uses: actions/download-artifact@v4527        with:528          pattern: _build_*529          path: build530          merge-multiple: true531      - name: Display structure of build532        run: ls -R build533      - name: Search build artifacts for unminified errors534        run: |535          yarn extract-errors536          git diff --exit-code || (echo "Found unminified errors. Either update the error codes map or disable error minification for the affected build, if appropriate." && false)537538  check_release_dependencies:539    name: Check release dependencies540    needs: [build_and_lint, runtime_node_modules_cache]541    runs-on: ubuntu-latest542    steps:543      - uses: actions/checkout@v4544        with:545          ref: ${{ github.event.pull_request.head.sha || github.sha }}546      - uses: actions/setup-node@v4547        with:548          node-version-file: '.nvmrc'549      - name: Restore cached node_modules550        uses: actions/cache/restore@v4551        id: node_modules552        with:553          path: |554            **/node_modules555          key: runtime-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}556          # Don't use restore-keys here. Otherwise the cache grows indefinitely.557      - name: Ensure clean build directory558        run: rm -rf build559      - run: yarn install --frozen-lockfile560        if: steps.node_modules.outputs.cache-hit != 'true'561      - name: Restore archived build562        uses: actions/download-artifact@v4563        with:564          pattern: _build_*565          path: build566          merge-multiple: true567      - name: Display structure of build568        run: ls -R build569      - run: yarn check-release-dependencies570571  RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:572    name: Check fixtures DOM (stable)573    needs: build_and_lint574    runs-on: ubuntu-latest575    steps:576      - uses: actions/checkout@v4577        with:578          ref: ${{ github.event.pull_request.head.sha || github.sha }}579      - uses: actions/setup-node@v4580        with:581          node-version-file: '.nvmrc'582      - name: Restore cached node_modules583        uses: actions/cache@v4 # note: this does not reuse centralized cache since it has unique cache key584        id: node_modules585        with:586          path: |587            **/node_modules588          key: fixtures_dom-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'fixtures/dom/yarn.lock') }}589      - name: Ensure clean build directory590        run: rm -rf build591      - run: yarn --cwd fixtures/dom install --frozen-lockfile592        if: steps.node_modules.outputs.cache-hit != 'true'593      - name: Restore archived build594        uses: actions/download-artifact@v4595        with:596          pattern: _build_*597          path: build598          merge-multiple: true599      - name: Display structure of build600        run: ls -R build601      - name: Run DOM fixture tests602        run: |603          yarn predev604          yarn test605        working-directory: fixtures/dom606        env:607          RELEASE_CHANNEL: stable608609  # ----- FLIGHT -----610  run_fixtures_flight_tests:611    name: Run fixtures Flight tests612    needs: build_and_lint613    runs-on: ubuntu-latest614    steps:615      - uses: actions/checkout@v4616        with:617          ref: ${{ github.event.pull_request.head.sha || github.sha }}618      - uses: actions/setup-node@v4619        with:620          node-version-file: '.nvmrc'621      # Fixture copies some built packages from the workroot after install.622      # That means dependencies of the built packages are not installed.623      # We need to install dependencies of the workroot to fulfill all dependency constraints624      - name: Restore cached node_modules625        uses: actions/cache@v4 # note: this does not reuse centralized cache since it has unique cache key626        id: node_modules627        with:628          path: |629            **/node_modules630          key: fixtures_flight-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'fixtures/flight/yarn.lock') }}631      - name: Ensure clean build directory632        run: rm -rf build633      - run: yarn install --frozen-lockfile634        if: steps.node_modules.outputs.cache-hit != 'true'635      - run: yarn --cwd fixtures/flight install --frozen-lockfile636        if: steps.node_modules.outputs.cache-hit != 'true'637      - name: Check Playwright version638        id: playwright_version639        run: echo "playwright_version=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//' | head -1)" >> "$GITHUB_OUTPUT"640      - name: Cache Playwright Browsers for version ${{ steps.playwright_version.outputs.playwright_version }}641        id: cache_playwright_browsers642        uses: actions/cache@v4643        with:644          path: ~/.cache/ms-playwright645          key: playwright-browsers-v6-${{ runner.arch }}-${{ runner.os }}-${{ steps.playwright_version.outputs.playwright_version }}646      - name: Playwright install deps647        if: steps.cache_playwright_browsers.outputs.cache-hit != 'true'648        working-directory: fixtures/flight649        run: npx playwright install --with-deps chromium650      - name: Restore archived build651        uses: actions/download-artifact@v4652        with:653          pattern: _build_*654          path: build655          merge-multiple: true656      - name: Display structure of build657        run: ls -R build658      - name: Run tests659        working-directory: fixtures/flight660        run: yarn test661        env:662          # Otherwise the webserver is a blackbox663          DEBUG: pw:webserver664      - name: Archive Flight fixture artifacts665        uses: actions/upload-artifact@v4666        with:667          name: flight-playwright-report668          path: fixtures/flight/playwright-report669          if-no-files-found: warn670      - name: Archive Flight fixture artifacts671        uses: actions/upload-artifact@v4672        with:673          name: flight-test-results674          path: fixtures/flight/test-results675          if-no-files-found: ignore676677  # ----- DEVTOOLS -----678  build_devtools_and_process_artifacts:679    name: Build DevTools and process artifacts680    needs: [build_and_lint, runtime_node_modules_cache]681    runs-on: ubuntu-latest682    strategy:683      fail-fast: false684      matrix:685        browser: [chrome, firefox, edge]686    steps:687      - uses: actions/checkout@v4688        with:689          ref: ${{ github.event.pull_request.head.sha || github.sha }}690      - uses: actions/setup-node@v4691        with:692          node-version-file: '.nvmrc'693      - name: Restore cached node_modules694        uses: actions/cache/restore@v4695        id: node_modules696        with:697          path: |698            **/node_modules699          key: runtime-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}700          # Don't use restore-keys here. Otherwise the cache grows indefinitely.701      - name: Ensure clean build directory702        run: rm -rf build703      - run: yarn install --frozen-lockfile704        if: steps.node_modules.outputs.cache-hit != 'true'705      - name: Restore archived build706        uses: actions/download-artifact@v4707        with:708          pattern: _build_*709          path: build710          merge-multiple: true711      - run: ./scripts/ci/pack_and_store_devtools_artifacts.sh ${{ matrix.browser }}712        env:713          RELEASE_CHANNEL: experimental714      - name: Display structure of build715        run: ls -R build716      # Simplifies getting the extension for local testing717      - name: Archive ${{ matrix.browser }} extension718        uses: actions/upload-artifact@v4719        with:720          name: react-devtools-${{ matrix.browser }}-extension721          path: build/devtools/${{ matrix.browser }}-extension.zip722          if-no-files-found: error723      - name: Archive ${{ matrix.browser }} metadata724        uses: actions/upload-artifact@v4725        with:726          name: react-devtools-${{ matrix.browser }}-metadata727          path: build/devtools/webpack-stats.*.json728729  merge_devtools_artifacts:730    name: Merge DevTools artifacts731    needs: build_devtools_and_process_artifacts732    runs-on: ubuntu-latest733    steps:734      - name: Merge artifacts735        uses: actions/upload-artifact/merge@v4736        with:737          name: react-devtools738          pattern: react-devtools-*739740  run_devtools_e2e_tests:741    name: Run DevTools e2e tests742    needs: [build_and_lint, runtime_node_modules_cache]743    runs-on: ubuntu-latest744    steps:745      - uses: actions/checkout@v4746        with:747          ref: ${{ github.event.pull_request.head.sha || github.sha }}748      - uses: actions/setup-node@v4749        with:750          node-version-file: '.nvmrc'751      - name: Restore cached node_modules752        uses: actions/cache/restore@v4753        id: node_modules754        with:755          path: |756            **/node_modules757          key: runtime-node_modules-v9-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}758          # Don't use restore-keys here. Otherwise the cache grows indefinitely.759      - name: Ensure clean build directory760        run: rm -rf build761      - run: yarn install --frozen-lockfile762        if: steps.node_modules.outputs.cache-hit != 'true'763      - name: Restore archived build764        uses: actions/download-artifact@v4765        with:766          pattern: _build_*767          path: build768          merge-multiple: true769      - name: Check Playwright version770        id: playwright_version771        run: echo "playwright_version=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//' | head -1)" >> "$GITHUB_OUTPUT"772      - name: Cache Playwright Browsers for version ${{ steps.playwright_version.outputs.playwright_version }}773        id: cache_playwright_browsers774        uses: actions/cache@v4775        with:776          path: ~/.cache/ms-playwright777          key: playwright-browsers-v6-${{ runner.arch }}-${{ runner.os }}-${{ steps.playwright_version.outputs.playwright_version }}778      - name: Playwright install deps779        if: steps.cache_playwright_browsers.outputs.cache-hit != 'true'780        run: npx playwright install --with-deps chromium781      - run: ./scripts/ci/run_devtools_e2e_tests.js782        env:783          RELEASE_CHANNEL: experimental784      - name: Archive Playwright report785        uses: actions/upload-artifact@v4786        with:787          name: devtools-playwright-artifacts788          path: tmp/playwright-artifacts789          if-no-files-found: warn790791  # ----- SIZEBOT -----792  sizebot:793    if: ${{ github.event_name == 'pull_request' && github.ref_name != 'main' && github.event.pull_request.base.ref == 'main' }}794    name: Run sizebot795    needs: [build_and_lint]796    permissions:797      # We use github.token to download the build artifact from a previous runtime_build_and_test.yml run798      actions: read799    runs-on: ubuntu-latest800    steps:801      - uses: actions/checkout@v4802        with:803          ref: ${{ github.event.pull_request.head.sha || github.sha }}804      - uses: actions/setup-node@v4805        with:806          node-version-file: '.nvmrc'807      - name: Restore cached node_modules808        uses: actions/cache@v4 # note: this does not reuse centralized cache since it has unique cache key809        id: node_modules810        with:811          path: |812            **/node_modules813          key: runtime-release-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}814      - name: Ensure clean build directory815        run: rm -rf build816      - run: yarn install --frozen-lockfile817        if: steps.node_modules.outputs.cache-hit != 'true'818      - run: yarn --cwd scripts/release install --frozen-lockfile819        if: steps.node_modules.outputs.cache-hit != 'true'820      - name: Download artifacts for base revision821        # The build could have been generated from a fork, so we must download the build without822        # any verification. This is safe since we only use this for sizebot calculation and the823        # unverified artifact is not used. Additionally this workflow runs in the pull_request824        # trigger so only restricted permissions are available.825        run: |826          GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build.js --commit=$(git rev-parse ${{ github.event.pull_request.base.sha }}) ${{ (github.event.pull_request.head.repo.full_name != github.repository && '--noVerify') || ''}}827          mv ./build ./base-build828      - name: Delete extraneous files829        # TODO: The `download-experimental-build` script copies the npm830        # packages into the `node_modules` directory. This is a historical831        # quirk of how the release script works. Let's pretend they832        # don't exist.833        run: rm -rf ./base-build/node_modules834      - name: Display structure of base-build from origin/main835        run: ls -R base-build836      - name: Ensure clean build directory837        run: rm -rf build838      - name: Restore archived build for PR839        uses: actions/download-artifact@v4840        with:841          pattern: _build_*842          path: build843          merge-multiple: true844      - name: Scrape warning messages845        run: |846          mkdir -p ./build/__test_utils__847          node ./scripts/print-warnings/print-warnings.js > build/__test_utils__/ReactAllWarnings.js848      - name: Display structure of build for PR849        run: ls -R build850      - run: echo ${{ github.event.pull_request.head.sha || github.sha }} >> build/COMMIT_SHA851      - run: node ./scripts/tasks/danger852      - name: Archive sizebot results853        uses: actions/upload-artifact@v4854        with:855          name: sizebot-message856          path: sizebot-message.md857          if-no-files-found: ignore

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.