Skip to content

Commit 380f5d6

Browse files
authored
Fix sizebot (#31535)
Our CI workflows generally cache `**/node_modules` (note the glob, it caches all transitive node_module directories) to speed up startup for new jobs that don't change any dependencies. However it seems like one of our caches got into a weird state (not sure how it happened) where the `build` directory (used in various other scripts as the directory for compiled React packages) would contain a `node_modules` directory as well. This made sizebot size change messages very big since it would try to compare every single file in `build/node_modules`. The fix is to ensure we always clean the `build` directory before doing anything with it. We can also delete that one problematic cache but this PR is a little more resilient to other weird behavior with that directory.
1 parent 7ac8e61 commit 380f5d6

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

.github/workflows/devtools_regression_tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ jobs:
3131
with:
3232
path: "**/node_modules"
3333
key: runtime-release-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
34+
- name: Ensure clean build directory
35+
run: rm -rf build
3436
- run: yarn install --frozen-lockfile
3537
- run: yarn install --frozen-lockfile
3638
working-directory: scripts/release
@@ -63,6 +65,8 @@ jobs:
6365
with:
6466
path: "**/node_modules"
6567
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
68+
- name: Ensure clean build directory
69+
run: rm -rf build
6670
- run: yarn install --frozen-lockfile
6771
- name: Restore archived build
6872
uses: actions/download-artifact@v4

.github/workflows/runtime_build_and_test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ jobs:
5353
with:
5454
path: "**/node_modules"
5555
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
56+
- name: Ensure clean build directory
57+
run: rm -rf build
5658
- run: yarn install --frozen-lockfile
5759
- run: node ./scripts/tasks/flow-ci ${{ matrix.flow_inline_config_shortname }}
5860

@@ -73,6 +75,8 @@ jobs:
7375
with:
7476
path: "**/node_modules"
7577
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
78+
- name: Ensure clean build directory
79+
run: rm -rf build
7680
- run: yarn install --frozen-lockfile
7781
- run: |
7882
yarn generate-inline-fizz-runtime
@@ -95,6 +99,8 @@ jobs:
9599
with:
96100
path: "**/node_modules"
97101
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
102+
- name: Ensure clean build directory
103+
run: rm -rf build
98104
- run: yarn install --frozen-lockfile
99105
- run: yarn flags
100106

@@ -144,6 +150,8 @@ jobs:
144150
with:
145151
path: "**/node_modules"
146152
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
153+
- name: Ensure clean build directory
154+
run: rm -rf build
147155
- run: yarn install --frozen-lockfile
148156
- run: yarn test ${{ matrix.params }} --ci --shard=${{ matrix.shard }}
149157

@@ -173,6 +181,8 @@ jobs:
173181
with:
174182
path: "**/node_modules"
175183
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
184+
- name: Ensure clean build directory
185+
run: rm -rf build
176186
- run: yarn install --frozen-lockfile
177187
- run: yarn build --index=${{ matrix.worker_id }} --total=20 --r=${{ matrix.release_channel }} --ci
178188
env:
@@ -243,6 +253,8 @@ jobs:
243253
with:
244254
path: "**/node_modules"
245255
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
256+
- name: Ensure clean build directory
257+
run: rm -rf build
246258
- run: yarn install --frozen-lockfile
247259
- name: Restore archived build
248260
uses: actions/download-artifact@v4
@@ -271,6 +283,8 @@ jobs:
271283
with:
272284
path: "**/node_modules"
273285
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
286+
- name: Ensure clean build directory
287+
run: rm -rf build
274288
- run: yarn install --frozen-lockfile
275289
- name: Restore archived build
276290
uses: actions/download-artifact@v4
@@ -314,6 +328,8 @@ jobs:
314328
with:
315329
path: "**/node_modules"
316330
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
331+
- name: Ensure clean build directory
332+
run: rm -rf build
317333
- run: yarn install --frozen-lockfile
318334
- name: Restore archived build
319335
uses: actions/download-artifact@v4
@@ -345,6 +361,8 @@ jobs:
345361
with:
346362
path: "**/node_modules"
347363
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
364+
- name: Ensure clean build directory
365+
run: rm -rf build
348366
- run: yarn install --frozen-lockfile
349367
- name: Restore archived build
350368
uses: actions/download-artifact@v4
@@ -373,6 +391,8 @@ jobs:
373391
with:
374392
path: "**/node_modules"
375393
key: fixtures_dom-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
394+
- name: Ensure clean build directory
395+
run: rm -rf build
376396
- run: yarn install --frozen-lockfile
377397
- run: yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
378398
working-directory: fixtures/dom
@@ -413,6 +433,8 @@ jobs:
413433
with:
414434
path: "**/node_modules"
415435
key: fixtures_flight-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
436+
- name: Ensure clean build directory
437+
run: rm -rf build
416438
- run: yarn install --frozen-lockfile
417439
- name: Restore archived build
418440
uses: actions/download-artifact@v4
@@ -469,6 +491,8 @@ jobs:
469491
with:
470492
path: "**/node_modules"
471493
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
494+
- name: Ensure clean build directory
495+
run: rm -rf build
472496
- run: yarn install --frozen-lockfile
473497
- name: Restore archived build
474498
uses: actions/download-artifact@v4
@@ -515,6 +539,8 @@ jobs:
515539
with:
516540
path: "**/node_modules"
517541
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
542+
- name: Ensure clean build directory
543+
run: rm -rf build
518544
- run: yarn install --frozen-lockfile
519545
- name: Restore archived build
520546
uses: actions/download-artifact@v4
@@ -547,6 +573,8 @@ jobs:
547573
with:
548574
path: "**/node_modules"
549575
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
576+
- name: Ensure clean build directory
577+
run: rm -rf build
550578
- run: yarn install --frozen-lockfile
551579
- run: yarn install --frozen-lockfile
552580
working-directory: scripts/release
@@ -586,6 +614,8 @@ jobs:
586614
with:
587615
path: "**/node_modules"
588616
key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
617+
- name: Ensure clean build directory
618+
run: rm -rf build
589619
- run: yarn install --frozen-lockfile
590620
- name: Restore archived build for PR
591621
uses: actions/download-artifact@v4

.github/workflows/runtime_commit_artifacts.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ jobs:
7575
with:
7676
path: "**/node_modules"
7777
key: runtime-release-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
78+
- name: Ensure clean build directory
79+
run: rm -rf build
7880
- run: yarn install --frozen-lockfile
7981
name: yarn install (react)
8082
- run: yarn install --frozen-lockfile

.github/workflows/runtime_prereleases.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
with:
4242
path: "**/node_modules"
4343
key: runtime-release-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
44+
- name: Ensure clean build directory
45+
run: rm -rf build
4446
- run: yarn install --frozen-lockfile
4547
- run: yarn install --frozen-lockfile
4648
working-directory: scripts/release

.github/workflows/shared_lint.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
with:
3131
path: "**/node_modules"
3232
key: shared-lint-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
33+
- name: Ensure clean build directory
34+
run: rm -rf build
3335
- run: yarn install --frozen-lockfile
3436
- run: yarn prettier-check
3537

@@ -48,6 +50,8 @@ jobs:
4850
with:
4951
path: "**/node_modules"
5052
key: shared-lint-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
53+
- name: Ensure clean build directory
54+
run: rm -rf build
5155
- run: yarn install --frozen-lockfile
5256
- run: node ./scripts/tasks/eslint
5357

@@ -66,6 +70,8 @@ jobs:
6670
with:
6771
path: "**/node_modules"
6872
key: shared-lint-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
73+
- name: Ensure clean build directory
74+
run: rm -rf build
6975
- run: yarn install --frozen-lockfile
7076
- run: ./scripts/ci/check_license.sh
7177

@@ -84,5 +90,7 @@ jobs:
8490
with:
8591
path: "**/node_modules"
8692
key: shared-lint-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
93+
- name: Ensure clean build directory
94+
run: rm -rf build
8795
- run: yarn install --frozen-lockfile
8896
- run: ./scripts/ci/test_print_warnings.sh

0 commit comments

Comments
 (0)