[ci] Fail on cache miss (#32686)
Since we use a centralized cache we should fail subsequent steps if the child jobs are unable to restore the cache from the first 2 jobs. Also fix some incorrect hashes used for the fixture tests. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32686). * __->__ #32686 * #32685
lauren committed
Mar 20, 2025 at 12:22 UTC
87d7e4c55be7fea5efd1e567d52e943ad5d3133d
1 file changed
+15
-6
.github/workflows/runtime_build_and_test.yml
+15
-6
@@ -147,6 +147,7 @@ jobs:
147
path: |
148
**/node_modules
149
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
150
+ fail-on-cache-miss: true
151
- name: Ensure clean build directory
152
run: rm -rf build
153
- run: yarn install --frozen-lockfile
@@ -174,6 +175,7 @@ jobs:
175
path: |
176
**/node_modules
177
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
178
+ fail-on-cache-miss: true
179
- name: Ensure clean build directory
180
run: rm -rf build
181
- run: yarn install --frozen-lockfile
@@ -203,6 +205,7 @@ jobs:
205
path: |
206
**/node_modules
207
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
208
+ fail-on-cache-miss: true
209
- name: Ensure clean build directory
210
run: rm -rf build
211
- run: yarn install --frozen-lockfile
@@ -261,6 +264,7 @@ jobs:
264
path: |
265
**/node_modules
266
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
267
+ fail-on-cache-miss: true
268
- name: Ensure clean build directory
269
run: rm -rf build
270
- run: yarn install --frozen-lockfile
@@ -302,6 +306,7 @@ jobs:
306
path: |
307
**/node_modules
308
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
309
+ fail-on-cache-miss: true
310
- name: Ensure clean build directory
311
run: rm -rf build
312
- run: yarn install --frozen-lockfile
@@ -383,6 +388,7 @@ jobs:
388
path: |
389
**/node_modules
390
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
391
+ fail-on-cache-miss: true
392
- name: Ensure clean build directory
393
run: rm -rf build
394
- run: yarn install --frozen-lockfile
@@ -419,6 +425,7 @@ jobs:
425
path: |
426
**/node_modules
427
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
428
+ fail-on-cache-miss: true
429
- name: Ensure clean build directory
430
run: rm -rf build
431
- run: yarn install --frozen-lockfile
@@ -469,6 +476,7 @@ jobs:
476
path: |
477
**/node_modules
478
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
479
+ fail-on-cache-miss: true
480
- name: Ensure clean build directory
481
run: rm -rf build
482
- run: yarn install --frozen-lockfile
@@ -506,6 +514,7 @@ jobs:
514
path: |
515
**/node_modules
516
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
517
+ fail-on-cache-miss: true
518
- name: Ensure clean build directory
519
run: rm -rf build
520
- run: yarn install --frozen-lockfile
@@ -539,7 +548,7 @@ jobs:
548
with:
549
path: |
550
**/node_modules
542
- key: fixtures_dom-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
551
+ key: fixtures_dom-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'fixtures/dom/yarn.lock') }}
552
- name: Ensure clean build directory
553
run: rm -rf build
554
- run: yarn --cwd fixtures/dom install --frozen-lockfile
@@ -583,7 +592,7 @@ jobs:
592
with:
593
path: |
594
**/node_modules
586
- key: fixtures_flight-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
595
+ key: fixtures_flight-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'fixtures/flight/yarn.lock') }}
596
- name: Ensure clean build directory
597
run: rm -rf build
598
- run: yarn install --frozen-lockfile
@@ -658,6 +667,7 @@ jobs:
667
path: |
668
**/node_modules
669
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
670
+ fail-on-cache-miss: true
671
- name: Ensure clean build directory
672
run: rm -rf build
673
- run: yarn install --frozen-lockfile
@@ -712,6 +722,7 @@ jobs:
722
path: |
723
**/node_modules
724
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
725
+ fail-on-cache-miss: true
726
- name: Ensure clean build directory
727
run: rm -rf build
728
- run: yarn install --frozen-lockfile
@@ -733,7 +744,7 @@ jobs:
744
sizebot:
745
if: ${{ github.event_name == 'pull_request' && github.ref_name != 'main' && github.event.pull_request.base.ref == 'main' }}
746
name: Run sizebot
736
- needs: [build_and_lint, runtime_node_modules_cache]
747
+ needs: [build_and_lint]
748
runs-on: ubuntu-latest
749
steps:
750
- uses: actions/checkout@v4
@@ -745,7 +756,7 @@ jobs:
756
cache: yarn
757
cache-dependency-path: yarn.lock
758
- name: Restore cached node_modules
748
- uses: actions/cache/restore@v4
759
+ uses: actions/cache@v4 # note: this does not reuse centralized cache since it has unique cache key
760
id: node_modules
761
with:
762
path: |
@@ -771,8 +782,6 @@ jobs:
782
run: ls -R base-build
783
- name: Ensure clean build directory
784
run: rm -rf build
774
- - run: yarn install --frozen-lockfile
775
- if: steps.node_modules.outputs.cache-hit != 'true'
785
- name: Restore archived build for PR
786
uses: actions/download-artifact@v4
787
with: