From a1cbfcdbdfe373f99ff271ffddc044229d938f93 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 20 Mar 2025 12:11:29 -0400 Subject: [PATCH] [ci] Fail on cache miss 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. --- .github/workflows/runtime_build_and_test.yml | 21 ++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/runtime_build_and_test.yml b/.github/workflows/runtime_build_and_test.yml index dde120a08c..c965ff9df7 100644 --- a/.github/workflows/runtime_build_and_test.yml +++ b/.github/workflows/runtime_build_and_test.yml @@ -144,6 +144,7 @@ jobs: path: | **/node_modules key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + fail-on-cache-miss: true - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -171,6 +172,7 @@ jobs: path: | **/node_modules key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + fail-on-cache-miss: true - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -200,6 +202,7 @@ jobs: path: | **/node_modules key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + fail-on-cache-miss: true - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -258,6 +261,7 @@ jobs: path: | **/node_modules key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }} + fail-on-cache-miss: true - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -299,6 +303,7 @@ jobs: path: | **/node_modules key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }} + fail-on-cache-miss: true - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -380,6 +385,7 @@ jobs: path: | **/node_modules key: runtime-and-compiler-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'compiler/yarn.lock') }} + fail-on-cache-miss: true - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -416,6 +422,7 @@ jobs: path: | **/node_modules key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + fail-on-cache-miss: true - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -466,6 +473,7 @@ jobs: path: | **/node_modules key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + fail-on-cache-miss: true - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -503,6 +511,7 @@ jobs: path: | **/node_modules key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + fail-on-cache-miss: true - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -536,7 +545,7 @@ jobs: with: path: | **/node_modules - key: fixtures_dom-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: fixtures_dom-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'fixtures/dom/yarn.lock') }} - name: Ensure clean build directory run: rm -rf build - run: yarn --cwd fixtures/dom install --frozen-lockfile @@ -580,7 +589,7 @@ jobs: with: path: | **/node_modules - key: fixtures_flight-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + key: fixtures_flight-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'fixtures/flight/yarn.lock') }} - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -655,6 +664,7 @@ jobs: path: | **/node_modules key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + fail-on-cache-miss: true - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -709,6 +719,7 @@ jobs: path: | **/node_modules key: runtime-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + fail-on-cache-miss: true - name: Ensure clean build directory run: rm -rf build - run: yarn install --frozen-lockfile @@ -730,7 +741,7 @@ jobs: sizebot: if: ${{ github.event_name == 'pull_request' && github.ref_name != 'main' && github.event.pull_request.base.ref == 'main' }} name: Run sizebot - needs: [build_and_lint, runtime_node_modules_cache] + needs: [build_and_lint] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -742,7 +753,7 @@ jobs: cache: yarn cache-dependency-path: yarn.lock - name: Restore cached node_modules - uses: actions/cache/restore@v4 + uses: actions/cache@v4 # note: this does not reuse centralized cache since it has unique cache key id: node_modules with: path: | @@ -768,8 +779,6 @@ jobs: run: ls -R base-build - name: Ensure clean build directory run: rm -rf build - - run: yarn install --frozen-lockfile - if: steps.node_modules.outputs.cache-hit != 'true' - name: Restore archived build for PR uses: actions/download-artifact@v4 with: