@samitouri / QOS-React / commits / 380f5d675d

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.

lauren committed Nov 13, 2024 at 15:13 UTC 380f5d675d2269f090d15c3f92e10de66e12516c
5 files changed +46
.github/workflows/devtools_regression_tests.yml
+4
@@ -31,6 +31,8 @@ jobs:
31 with:
32 path: "**/node_modules"
33 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
36 - run: yarn install --frozen-lockfile
37 - run: yarn install --frozen-lockfile
38 working-directory: scripts/release
@@ -63,6 +65,8 @@ jobs:
65 with:
66 path: "**/node_modules"
67 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
68 + - name: Ensure clean build directory
69 + run: rm -rf build
70 - run: yarn install --frozen-lockfile
71 - name: Restore archived build
72 uses: actions/download-artifact@v4
.github/workflows/runtime_build_and_test.yml
+30
@@ -53,6 +53,8 @@ jobs:
53 with:
54 path: "**/node_modules"
55 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
56 + - name: Ensure clean build directory
57 + run: rm -rf build
58 - run: yarn install --frozen-lockfile
59 - run: node ./scripts/tasks/flow-ci ${{ matrix.flow_inline_config_shortname }}
60
@@ -73,6 +75,8 @@ jobs:
75 with:
76 path: "**/node_modules"
77 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
78 + - name: Ensure clean build directory
79 + run: rm -rf build
80 - run: yarn install --frozen-lockfile
81 - run: |
82 yarn generate-inline-fizz-runtime
@@ -95,6 +99,8 @@ jobs:
99 with:
100 path: "**/node_modules"
101 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
102 + - name: Ensure clean build directory
103 + run: rm -rf build
104 - run: yarn install --frozen-lockfile
105 - run: yarn flags
106
@@ -144,6 +150,8 @@ jobs:
150 with:
151 path: "**/node_modules"
152 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
153 + - name: Ensure clean build directory
154 + run: rm -rf build
155 - run: yarn install --frozen-lockfile
156 - run: yarn test ${{ matrix.params }} --ci --shard=${{ matrix.shard }}
157
@@ -173,6 +181,8 @@ jobs:
181 with:
182 path: "**/node_modules"
183 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
184 + - name: Ensure clean build directory
185 + run: rm -rf build
186 - run: yarn install --frozen-lockfile
187 - run: yarn build --index=${{ matrix.worker_id }} --total=20 --r=${{ matrix.release_channel }} --ci
188 env:
@@ -243,6 +253,8 @@ jobs:
253 with:
254 path: "**/node_modules"
255 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
256 + - name: Ensure clean build directory
257 + run: rm -rf build
258 - run: yarn install --frozen-lockfile
259 - name: Restore archived build
260 uses: actions/download-artifact@v4
@@ -271,6 +283,8 @@ jobs:
283 with:
284 path: "**/node_modules"
285 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
286 + - name: Ensure clean build directory
287 + run: rm -rf build
288 - run: yarn install --frozen-lockfile
289 - name: Restore archived build
290 uses: actions/download-artifact@v4
@@ -314,6 +328,8 @@ jobs:
328 with:
329 path: "**/node_modules"
330 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
331 + - name: Ensure clean build directory
332 + run: rm -rf build
333 - run: yarn install --frozen-lockfile
334 - name: Restore archived build
335 uses: actions/download-artifact@v4
@@ -345,6 +361,8 @@ jobs:
361 with:
362 path: "**/node_modules"
363 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
364 + - name: Ensure clean build directory
365 + run: rm -rf build
366 - run: yarn install --frozen-lockfile
367 - name: Restore archived build
368 uses: actions/download-artifact@v4
@@ -373,6 +391,8 @@ jobs:
391 with:
392 path: "**/node_modules"
393 key: fixtures_dom-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
394 + - name: Ensure clean build directory
395 + run: rm -rf build
396 - run: yarn install --frozen-lockfile
397 - run: yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
398 working-directory: fixtures/dom
@@ -413,6 +433,8 @@ jobs:
433 with:
434 path: "**/node_modules"
435 key: fixtures_flight-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
436 + - name: Ensure clean build directory
437 + run: rm -rf build
438 - run: yarn install --frozen-lockfile
439 - name: Restore archived build
440 uses: actions/download-artifact@v4
@@ -469,6 +491,8 @@ jobs:
491 with:
492 path: "**/node_modules"
493 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
494 + - name: Ensure clean build directory
495 + run: rm -rf build
496 - run: yarn install --frozen-lockfile
497 - name: Restore archived build
498 uses: actions/download-artifact@v4
@@ -515,6 +539,8 @@ jobs:
539 with:
540 path: "**/node_modules"
541 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
542 + - name: Ensure clean build directory
543 + run: rm -rf build
544 - run: yarn install --frozen-lockfile
545 - name: Restore archived build
546 uses: actions/download-artifact@v4
@@ -547,6 +573,8 @@ jobs:
573 with:
574 path: "**/node_modules"
575 key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
576 + - name: Ensure clean build directory
577 + run: rm -rf build
578 - run: yarn install --frozen-lockfile
579 - run: yarn install --frozen-lockfile
580 working-directory: scripts/release
@@ -586,6 +614,8 @@ jobs:
614 with:
615 path: "**/node_modules"
616 key: runtime-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
617 + - name: Ensure clean build directory
618 + run: rm -rf build
619 - run: yarn install --frozen-lockfile
620 - name: Restore archived build for PR
621 uses: actions/download-artifact@v4
.github/workflows/runtime_commit_artifacts.yml
+2
@@ -75,6 +75,8 @@ jobs:
75 with:
76 path: "**/node_modules"
77 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
80 - run: yarn install --frozen-lockfile
81 name: yarn install (react)
82 - run: yarn install --frozen-lockfile
.github/workflows/runtime_prereleases.yml
+2
@@ -41,6 +41,8 @@ jobs:
41 with:
42 path: "**/node_modules"
43 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
46 - run: yarn install --frozen-lockfile
47 - run: yarn install --frozen-lockfile
48 working-directory: scripts/release
.github/workflows/shared_lint.yml
+8
@@ -30,6 +30,8 @@ jobs:
30 with:
31 path: "**/node_modules"
32 key: shared-lint-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
33 + - name: Ensure clean build directory
34 + run: rm -rf build
35 - run: yarn install --frozen-lockfile
36 - run: yarn prettier-check
37
@@ -48,6 +50,8 @@ jobs:
50 with:
51 path: "**/node_modules"
52 key: shared-lint-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
53 + - name: Ensure clean build directory
54 + run: rm -rf build
55 - run: yarn install --frozen-lockfile
56 - run: node ./scripts/tasks/eslint
57
@@ -66,6 +70,8 @@ jobs:
70 with:
71 path: "**/node_modules"
72 key: shared-lint-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
73 + - name: Ensure clean build directory
74 + run: rm -rf build
75 - run: yarn install --frozen-lockfile
76 - run: ./scripts/ci/check_license.sh
77
@@ -84,5 +90,7 @@ jobs:
90 with:
91 path: "**/node_modules"
92 key: shared-lint-node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
93 + - name: Ensure clean build directory
94 + run: rm -rf build
95 - run: yarn install --frozen-lockfile
96 - run: ./scripts/ci/test_print_warnings.sh