Skip to content

ci: Better error handling when caches can't be restored #7306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/actions/restore-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Restore dependency & build cache"
description: "Restore the dependency & build cache."

runs:
using: "composite"
steps:
- name: Check dependency cache
id: dep-cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ env.DEPENDENCY_CACHE_KEY }}

- name: Check build cache
uses: actions/cache/restore@v3
id: build-cache
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}

- name: Check if caches are restored
uses: actions/github-script@v6
if: steps.dep-cache.outputs.cache-hit != 'true' || steps.build-cache.outputs.cache-hit != 'true'
with:
script: core.setFailed('Dependency or build cache could not be restored - please re-run ALL jobs.')
215 changes: 64 additions & 151 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,13 @@ jobs:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: volta-cli/action@v4

- name: Check dependency cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
fail-on-cache-miss: true

- name: Check build cache
uses: actions/cache@v3
Expand Down Expand Up @@ -245,16 +247,11 @@ jobs:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Get SDK version
# `jq` reads JSON files, and `tee` pipes its input to the given location and to stdout. (Adding `-a` is the
# equivalent of using >> rather than >.)
Expand Down Expand Up @@ -289,16 +286,10 @@ jobs:
# The size limit action runs `yarn` and `yarn build` when this job is executed on
# use Node 14 for now.
node-version: '14'
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check bundle sizes
uses: getsentry/size-limit-action@runForBranch
with:
Expand All @@ -323,16 +314,10 @@ jobs:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Run linter
run: yarn lint

Expand All @@ -348,16 +333,10 @@ jobs:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Run madge
run: yarn circularDepCheck

Expand All @@ -374,16 +353,10 @@ jobs:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Pack
run: yarn build:tarball
- name: Archive artifacts
Expand Down Expand Up @@ -411,16 +384,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Run tests
env:
NODE_VERSION: 16
Expand All @@ -446,16 +413,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Run tests
env:
NODE_VERSION: ${{ matrix.node }}
Expand Down Expand Up @@ -484,16 +445,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Get npm cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -558,16 +513,10 @@ jobs:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Get npm cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -616,16 +565,10 @@ jobs:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Run integration tests
env:
KARMA_BROWSER: ${{ matrix.browser }}
Expand All @@ -646,16 +589,10 @@ jobs:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Run browser build tests
run: |
cd packages/browser
Expand Down Expand Up @@ -684,16 +621,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Run integration tests
env:
NODE_VERSION: ${{ matrix.node }}
Expand All @@ -720,16 +651,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Run integration tests
env:
NODE_VERSION: ${{ matrix.node }}
Expand All @@ -754,16 +679,10 @@ jobs:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Get node version
id: versions
run: |
Expand Down Expand Up @@ -817,16 +736,10 @@ jobs:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: volta-cli/action@v4
- name: Check dependency cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check build cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHED_BUILD_PATHS }}
key: ${{ env.BUILD_CACHE_KEY }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Collect
run: yarn ci:collect
Expand Down