Skip to content
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
27 changes: 23 additions & 4 deletions .github/actions/restore-cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: "Restore dependency & build cache"
description: "Restore the dependency & build cache."

inputs:
dependency_cache_key:
description: "The dependency cache key"
required: true
node_version:
description: "If set, temporarily set node version to default one before installing, then revert to this version after."
required: false

runs:
using: "composite"
steps:
Expand All @@ -9,15 +17,26 @@ runs:
uses: actions/cache/restore@v4
with:
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
key: ${{ env.DEPENDENCY_CACHE_KEY }}
key: ${{ inputs.dependency_cache_key }}

- name: Restore build artifacts
uses: actions/download-artifact@v4
with:
name: build-output

- name: Check if caches are restored
uses: actions/github-script@v6
- name: Use default node version for install
if: inputs.node_version && steps.dep-cache.outputs.cache-hit != 'true'
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'

- name: Install dependencies
if: steps.dep-cache.outputs.cache-hit != 'true'
run: yarn install --ignore-engines --frozen-lockfile
shell: bash

- name: Revert node version to ${{ inputs.node_version }}
if: inputs.node_version && steps.dep-cache.outputs.cache-hit != 'true'
uses: actions/setup-node@v4
with:
script: core.setFailed('Dependency cache could not be restored - please re-run ALL jobs.')
node-version: ${{ inputs.node_version }}
97 changes: 56 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ jobs:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check bundle sizes
uses: ./dev-packages/size-limit-gh-action
with:
Expand All @@ -260,8 +260,8 @@ jobs:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Lint source files
run: yarn lint:lerna
- name: Lint C++ files
Expand Down Expand Up @@ -306,8 +306,8 @@ jobs:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Run madge
run: yarn circularDepCheck

Expand All @@ -328,8 +328,8 @@ jobs:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Extract Profiling Node Prebuilt Binaries
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -375,8 +375,8 @@ jobs:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Run affected tests
run: yarn test:pr:browser --base=${{ github.event.pull_request.base.sha }}
Expand Down Expand Up @@ -412,8 +412,8 @@ jobs:
uses: oven-sh/setup-bun@v2
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Run tests
run: |
yarn test:ci:bun
Expand Down Expand Up @@ -441,8 +441,8 @@ jobs:
deno-version: v1.38.5
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Run tests
run: |
cd packages/deno
Expand Down Expand Up @@ -475,8 +475,9 @@ jobs:
node-version: ${{ matrix.node }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
node_version: ${{ matrix.node == 14 && '14' || '' }}

- name: Run affected tests
run: yarn test:pr:node --base=${{ github.event.pull_request.base.sha }}
Expand Down Expand Up @@ -514,8 +515,8 @@ jobs:
python-version: '3.11.7'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Build Configure node-gyp
run: yarn lerna run build:bindings:configure --scope @sentry/profiling-node
- name: Build Bindings for Current Environment
Expand Down Expand Up @@ -582,8 +583,8 @@ jobs:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Install Playwright
uses: ./.github/actions/install-playwright
Expand Down Expand Up @@ -632,8 +633,8 @@ jobs:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Install Playwright
uses: ./.github/actions/install-playwright
Expand Down Expand Up @@ -669,8 +670,8 @@ jobs:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check for dts files that reference stuff in the temporary build folder
run: |
if grep -r --include "*.d.ts" --exclude-dir ".nxcache" 'import("@sentry(-internal)?/[^/]*/build' .; then
Expand Down Expand Up @@ -707,8 +708,9 @@ jobs:
node-version: ${{ matrix.node }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
node_version: ${{ matrix.node == 14 && '14' || '' }}

- name: Overwrite typescript version
if: matrix.typescript
Expand Down Expand Up @@ -748,8 +750,8 @@ jobs:
node-version: ${{ matrix.node }}
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Install Playwright
uses: ./.github/actions/install-playwright
Expand Down Expand Up @@ -786,8 +788,8 @@ jobs:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: NX cache
uses: actions/cache/restore@v4
with:
Expand Down Expand Up @@ -948,15 +950,19 @@ jobs:
uses: oven-sh/setup-bun@v2
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Restore tarball cache
uses: actions/cache/restore@v4
id: restore-tarball-cache
with:
path: ${{ github.workspace }}/packages/*/*.tgz
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}
fail-on-cache-miss: true

- name: Build tarballs if not cached
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
run: yarn build:tarball

- name: Install Playwright
uses: ./.github/actions/install-playwright
Expand Down Expand Up @@ -1048,15 +1054,19 @@ jobs:
node-version-file: 'dev-packages/e2e-tests/package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Restore tarball cache
uses: actions/cache/restore@v4
id: restore-tarball-cache
with:
path: ${{ github.workspace }}/packages/*/*.tgz
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}
fail-on-cache-miss: true

- name: Build tarballs if not cached
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
run: yarn build:tarball

- name: Install Playwright
uses: ./.github/actions/install-playwright
Expand Down Expand Up @@ -1143,8 +1153,8 @@ jobs:
node-version-file: 'dev-packages/e2e-tests/package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Build Profiling Node
run: yarn lerna run build:lib --scope @sentry/profiling-node
- name: Extract Profiling Node Prebuilt Binaries
Expand All @@ -1153,12 +1163,17 @@ jobs:
pattern: profiling-node-binaries-${{ github.sha }}-*
path: ${{ github.workspace }}/packages/profiling-node/lib/
merge-multiple: true

- name: Restore tarball cache
uses: actions/cache/restore@v4
id: restore-tarball-cache
with:
path: ${{ github.workspace }}/packages/*/*.tgz
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}
fail-on-cache-miss : true

- name: Build tarballs if not cached
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
run: yarn build:tarball

- name: Install Playwright
uses: ./.github/actions/install-playwright
Expand Down Expand Up @@ -1239,8 +1254,8 @@ jobs:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

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