[ci] Add sizebot to gh actions
Wires up sizebot in gh actions. I also fixed sizebot incorrectly reporting that ReactAllWarnings was deleted. ghstack-source-id: d3b1bb2088651409e8656c66f1eb28ab534a0604 Pull Request resolved: https://github.com/facebook/react/pull/30380
Lauren Tan committed
Jul 18, 2024 at 16:19 UTC
4fb11acd795310a97c5052733e3240a9517eae76
1 file changed
+84
.github/workflows/runtime_build_and_test.yml
+84
@@ -522,3 +522,87 @@ jobs:
522
- run: ./scripts/circleci/run_devtools_e2e_tests.js
523
env:
524
RELEASE_CHANNEL: experimental
525
+
526
+ # ----- SIZEBOT -----
527
+ download_base_build_for_sizebot:
528
+ name: Download base build for sizebot
529
+ runs-on: ubuntu-latest
530
+ steps:
531
+ - uses: actions/checkout@v4
532
+ - uses: actions/setup-node@v4
533
+ with:
534
+ node-version: 18.20.1
535
+ cache: yarn
536
+ cache-dependency-path: yarn.lock
537
+ - name: Restore cached node_modules
538
+ uses: actions/cache@v4
539
+ id: node_modules
540
+ with:
541
+ path: scripts/release/node_modules
542
+ key: ${{ runner.arch }}-${{ runner.os }}-scripts-modules-${{ hashFiles('scripts/release/yarn.lock') }}
543
+ - run: yarn install --frozen-lockfile
544
+ - run: yarn install --frozen-lockfile
545
+ working-directory: scripts/release
546
+ - name: Download artifacts for base revision
547
+ run: |
548
+ git fetch origin main
549
+ GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build-ghaction.js --commit=$(git rev-parse origin/main)
550
+ mv ./build ./base-build
551
+ # TODO: The `download-experimental-build` script copies the npm
552
+ # packages into the `node_modules` directory. This is a historical
553
+ # quirk of how the release script works. Let's pretend they
554
+ # don't exist.
555
+ - name: Delete extraneous files
556
+ run: rm -rf ./base-build/node_modules
557
+ - name: Display structure of base-build
558
+ run: ls -R base-build
559
+ - name: Archive base-build
560
+ uses: actions/upload-artifact@v4
561
+ with:
562
+ name: base-build
563
+ path: base-build
564
+
565
+ sizebot:
566
+ name: Run sizebot
567
+ needs: download_base_build_for_sizebot
568
+ runs-on: ubuntu-latest
569
+ steps:
570
+ - uses: actions/checkout@v4
571
+ - uses: actions/setup-node@v4
572
+ with:
573
+ node-version: 18.20.1
574
+ cache: yarn
575
+ cache-dependency-path: yarn.lock
576
+ - name: Restore cached node_modules
577
+ uses: actions/cache@v4
578
+ id: node_modules
579
+ with:
580
+ path: "**/node_modules"
581
+ key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
582
+ - run: yarn install --frozen-lockfile
583
+ - name: Restore archived build for PR
584
+ uses: actions/download-artifact@v4
585
+ with:
586
+ pattern: _build_*
587
+ path: build
588
+ merge-multiple: true
589
+ - name: Scrape warning messages
590
+ run: |
591
+ mkdir -p ./build/__test_utils__
592
+ node ./scripts/print-warnings/print-warnings.js > build/__test_utils__/ReactAllWarnings.js
593
+ - name: Display structure of build for PR
594
+ run: ls -R build
595
+ - name: Restore archived base-build from origin/main
596
+ uses: actions/download-artifact@v4
597
+ with:
598
+ name: base-build
599
+ path: base-build
600
+ - name: Display structure of base-build from origin/main
601
+ run: ls -R base-build
602
+ - run: echo ${{ github.sha }} >> build/COMMIT_SHA
603
+ - run: node ./scripts/tasks/danger
604
+ - name: Archive sizebot results
605
+ uses: actions/upload-artifact@v4
606
+ with:
607
+ name: sizebot-message
608
+ path: sizebot-message.md