Skip to content

Commit 87d7e4c

Browse files
authored
[ci] Fail on cache miss (facebook#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). * __->__ facebook#32686 * facebook#32685
1 parent 3bcf8c2 commit 87d7e4c

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

.github/workflows/runtime_build_and_test.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ jobs:
147147
path: |
148148
**/node_modules
149149
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
150+
fail-on-cache-miss: true
150151
- name: Ensure clean build directory
151152
run: rm -rf build
152153
- run: yarn install --frozen-lockfile
@@ -174,6 +175,7 @@ jobs:
174175
path: |
175176
**/node_modules
176177
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
178+
fail-on-cache-miss: true
177179
- name: Ensure clean build directory
178180
run: rm -rf build
179181
- run: yarn install --frozen-lockfile
@@ -203,6 +205,7 @@ jobs:
203205
path: |
204206
**/node_modules
205207
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
208+
fail-on-cache-miss: true
206209
- name: Ensure clean build directory
207210
run: rm -rf build
208211
- run: yarn install --frozen-lockfile
@@ -261,6 +264,7 @@ jobs:
261264
path: |
262265
**/node_modules
263266
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
267+
fail-on-cache-miss: true
264268
- name: Ensure clean build directory
265269
run: rm -rf build
266270
- run: yarn install --frozen-lockfile
@@ -302,6 +306,7 @@ jobs:
302306
path: |
303307
**/node_modules
304308
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
309+
fail-on-cache-miss: true
305310
- name: Ensure clean build directory
306311
run: rm -rf build
307312
- run: yarn install --frozen-lockfile
@@ -383,6 +388,7 @@ jobs:
383388
path: |
384389
**/node_modules
385390
key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }}
391+
fail-on-cache-miss: true
386392
- name: Ensure clean build directory
387393
run: rm -rf build
388394
- run: yarn install --frozen-lockfile
@@ -419,6 +425,7 @@ jobs:
419425
path: |
420426
**/node_modules
421427
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
428+
fail-on-cache-miss: true
422429
- name: Ensure clean build directory
423430
run: rm -rf build
424431
- run: yarn install --frozen-lockfile
@@ -469,6 +476,7 @@ jobs:
469476
path: |
470477
**/node_modules
471478
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
479+
fail-on-cache-miss: true
472480
- name: Ensure clean build directory
473481
run: rm -rf build
474482
- run: yarn install --frozen-lockfile
@@ -506,6 +514,7 @@ jobs:
506514
path: |
507515
**/node_modules
508516
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
517+
fail-on-cache-miss: true
509518
- name: Ensure clean build directory
510519
run: rm -rf build
511520
- run: yarn install --frozen-lockfile
@@ -539,7 +548,7 @@ jobs:
539548
with:
540549
path: |
541550
**/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') }}
543552
- name: Ensure clean build directory
544553
run: rm -rf build
545554
- run: yarn --cwd fixtures/dom install --frozen-lockfile
@@ -583,7 +592,7 @@ jobs:
583592
with:
584593
path: |
585594
**/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') }}
587596
- name: Ensure clean build directory
588597
run: rm -rf build
589598
- run: yarn install --frozen-lockfile
@@ -658,6 +667,7 @@ jobs:
658667
path: |
659668
**/node_modules
660669
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
670+
fail-on-cache-miss: true
661671
- name: Ensure clean build directory
662672
run: rm -rf build
663673
- run: yarn install --frozen-lockfile
@@ -712,6 +722,7 @@ jobs:
712722
path: |
713723
**/node_modules
714724
key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
725+
fail-on-cache-miss: true
715726
- name: Ensure clean build directory
716727
run: rm -rf build
717728
- run: yarn install --frozen-lockfile
@@ -733,7 +744,7 @@ jobs:
733744
sizebot:
734745
if: ${{ github.event_name == 'pull_request' && github.ref_name != 'main' && github.event.pull_request.base.ref == 'main' }}
735746
name: Run sizebot
736-
needs: [build_and_lint, runtime_node_modules_cache]
747+
needs: [build_and_lint]
737748
runs-on: ubuntu-latest
738749
steps:
739750
- uses: actions/checkout@v4
@@ -745,7 +756,7 @@ jobs:
745756
cache: yarn
746757
cache-dependency-path: yarn.lock
747758
- 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
749760
id: node_modules
750761
with:
751762
path: |
@@ -771,8 +782,6 @@ jobs:
771782
run: ls -R base-build
772783
- name: Ensure clean build directory
773784
run: rm -rf build
774-
- run: yarn install --frozen-lockfile
775-
if: steps.node_modules.outputs.cache-hit != 'true'
776785
- name: Restore archived build for PR
777786
uses: actions/download-artifact@v4
778787
with:

0 commit comments

Comments
 (0)