From acc801255334d49774f31145ca552e94ecfad7d1 Mon Sep 17 00:00:00 2001 From: JPeer264 Date: Tue, 20 Oct 2026 10:21:44 +0200 Subject: [PATCH] ci: Run GitHub Actions jobs on Namespace runners Move all jobs to the Namespace profiles namespace-profile-sentry-javascript-small, namespace-profile-sentry-javascript and namespace-profile-sentry-javascript-large, by the CPU and memory that each job needs. The build.yml jobs share one cache volume through the cache tag sentry-javascript. Pull request jobs use sentry-javascript-pr, so a pull request cannot change the node_modules that develop and release builds install from. Keep node_modules, the pnpm store, the Playwright browsers and their apt packages on Namespace cache volumes instead of the GitHub cache. Every job runs pnpm install, which is a no-op when the volume matches pnpm-lock.yaml, so the dependency cache key is no longer needed. Co-Authored-By: Claude Opus 5.5 --- .../actions/install-dependencies/action.yml | 31 ++-- .github/actions/install-playwright/action.yml | 44 ++--- .github/actions/restore-cache/action.yml | 21 +-- .github/workflows/auto-fix-issue.yml | 2 +- .github/workflows/auto-release.yml | 2 +- .github/workflows/build.yml | 165 ++++++++++-------- .github/workflows/bump-size-limits.yml | 9 +- .github/workflows/canary.yml | 4 +- .github/workflows/ci-metadata.yml | 2 +- .github/workflows/cleanup-e2e-workers.yml | 2 +- .github/workflows/cleanup-pr-caches.yml | 2 +- .github/workflows/clear-cache.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependabot-auto-triage.yml | 11 +- .../workflows/enforce-license-compliance.yml | 2 +- .github/workflows/external-contributors.yml | 2 +- .github/workflows/flaky-test-detector.yml | 2 +- .github/workflows/gitflow-merge-conflict.yml | 2 +- .github/workflows/gitflow-sync-develop.yml | 2 +- .github/workflows/issue-package-label.yml | 2 +- .github/workflows/label-external-prs.yml | 2 +- .github/workflows/lighthouse.yml | 2 +- .github/workflows/pr-review-reminder.yml | 2 +- .github/workflows/pr-stale-notifier.yml | 2 +- .github/workflows/release-comment-issues.yml | 2 +- .github/workflows/release-size-info.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/track-framework-updates.yml | 2 +- .github/workflows/validate-pr.yml | 2 +- .github/workflows/weekly-flaky-tests.yml | 2 +- scripts/dependency-hash-key.js | 75 -------- 31 files changed, 148 insertions(+), 258 deletions(-) delete mode 100644 scripts/dependency-hash-key.js diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml index 5f51f918c34b..76ca231532f9 100644 --- a/.github/actions/install-dependencies/action.yml +++ b/.github/actions/install-dependencies/action.yml @@ -1,10 +1,5 @@ name: 'Install pnpm dependencies' -description: 'Installs pnpm dependencies and caches them.' - -outputs: - cache_key: - description: 'The dependency cache key' - value: ${{ steps.compute_lockfile_hash.outputs.hash }} +description: 'Installs pnpm dependencies into node_modules folders on the Namespace cache volume.' runs: using: 'composite' @@ -12,19 +7,25 @@ runs: - name: Install pnpm uses: ./.github/actions/install-pnpm - - name: Compute dependency cache key - id: compute_lockfile_hash - run: node ./scripts/dependency-hash-key.js >> "$GITHUB_OUTPUT" + - name: List dependency paths + id: paths + run: | + { + echo 'paths<> "$GITHUB_OUTPUT" shell: bash - - name: Check dependency cache - uses: actions/cache@v6.1.0 - id: cache_dependencies + - name: Mount dependency cache + uses: namespacelabs/nscloud-cache-action@1124a6f3ce44e5cf84cc22111530961f4d2a15f9 # v1.7.0 with: - path: ${{ env.CACHED_DEPENDENCY_PATHS }} - key: ${{ steps.compute_lockfile_hash.outputs.hash }} + cache: pnpm + path: ${{ steps.paths.outputs.paths }} + # The cache volume can hold node_modules of another commit or branch. This is a no-op when they match + # pnpm-lock.yaml. - name: Install dependencies - if: steps.cache_dependencies.outputs.cache-hit != 'true' run: pnpm install --frozen-lockfile shell: bash diff --git a/.github/actions/install-playwright/action.yml b/.github/actions/install-playwright/action.yml index ca6c8a2d9583..bd84a13e9107 100644 --- a/.github/actions/install-playwright/action.yml +++ b/.github/actions/install-playwright/action.yml @@ -1,5 +1,5 @@ name: 'Install Playwright dependencies' -description: 'Installs Playwright dependencies and caches them.' +description: 'Installs Playwright browsers and system dependencies, keeping both on the Namespace cache volume.' inputs: browsers: description: 'What browsers to install.' @@ -26,43 +26,21 @@ runs: shell: bash working-directory: ${{ inputs.cwd }} - - name: Restore cached playwright binaries - uses: actions/cache/restore@v6.1.0 - id: playwright-cache + - name: Mount Playwright cache + uses: namespacelabs/nscloud-cache-action@1124a6f3ce44e5cf84cc22111530961f4d2a15f9 # v1.7.0 if: steps.playwright-version.outputs.version != '' with: - path: | - ~/.cache/ms-playwright - # Bump the iteration when bumping runner images to use a new cache - key: playwright-${{ runner.os }}-iteration-1-${{ steps.playwright-version.outputs.version }} + cache: | + playwright + apt - # We always install all browsers, if uncached - # `npx` runs outside the repo, so it can't pick up a `playwright` that a parallel `pnpm install` is still linking. - - name: Install Playwright dependencies (uncached) - env: - PLAYWRIGHT_VERSION: ${{ steps.playwright-version.outputs.version }} - run: npx -y "playwright@$PLAYWRIGHT_VERSION" install chromium webkit firefox --with-deps - if: steps.playwright-version.outputs.version != '' && steps.playwright-cache.outputs.cache-hit != 'true' - shell: bash - working-directory: ${{ runner.temp }} - - - name: Install Playwright system dependencies only (cached) + # Downloads only the browsers and apt packages that are not on the cache volume yet. `npx` runs outside the repo, + # so it can't pick up a `playwright` that a parallel `pnpm install` is still linking. + - name: Install Playwright + if: steps.playwright-version.outputs.version != '' env: PLAYWRIGHT_BROWSERS: ${{ inputs.browsers || 'chromium webkit firefox' }} PLAYWRIGHT_VERSION: ${{ steps.playwright-version.outputs.version }} - run: npx -y "playwright@$PLAYWRIGHT_VERSION" install-deps $PLAYWRIGHT_BROWSERS - if: steps.playwright-version.outputs.version != '' && steps.playwright-cache.outputs.cache-hit == 'true' + run: npx -y "playwright@$PLAYWRIGHT_VERSION" install --with-deps $PLAYWRIGHT_BROWSERS shell: bash working-directory: ${{ runner.temp }} - - # Only store cache on develop branch - - name: Store cached playwright binaries - uses: actions/cache/save@v6.1.0 - if: - steps.playwright-version.outputs.version != '' && github.event_name == 'push' && github.ref == - 'refs/heads/develop' - with: - path: | - ~/.cache/ms-playwright - # Bump the iteration when bumping runner images to use a new cache - key: playwright-${{ runner.os }}-iteration-1-${{ steps.playwright-version.outputs.version }} diff --git a/.github/actions/restore-cache/action.yml b/.github/actions/restore-cache/action.yml index daa5943f9877..c647c74405b9 100644 --- a/.github/actions/restore-cache/action.yml +++ b/.github/actions/restore-cache/action.yml @@ -1,30 +1,13 @@ name: 'Restore dependency & build cache' -description: 'Restore the dependency & build cache.' - -inputs: - dependency_cache_key: - description: 'The dependency cache key' - required: true +description: 'Installs dependencies from the Namespace cache volume and restores the build output.' runs: using: 'composite' steps: - - name: Install pnpm - uses: ./.github/actions/install-pnpm - - - name: Check dependency cache - id: dep-cache - uses: actions/cache/restore@v6.1.0 - with: - path: ${{ env.CACHED_DEPENDENCY_PATHS }} - key: ${{ inputs.dependency_cache_key }} - - name: Restore build artifacts uses: actions/download-artifact@v7 with: name: build-output - name: Install dependencies - if: steps.dep-cache.outputs.cache-hit != 'true' - run: pnpm install --frozen-lockfile - shell: bash + uses: ./.github/actions/install-dependencies diff --git a/.github/workflows/auto-fix-issue.yml b/.github/workflows/auto-fix-issue.yml index 559f255e3e98..8feb478c6edb 100644 --- a/.github/workflows/auto-fix-issue.yml +++ b/.github/workflows/auto-fix-issue.yml @@ -23,7 +23,7 @@ concurrency: jobs: auto-fix-issue: - runs-on: ubuntu-latest + runs-on: namespace-profile-sentry-javascript environment: ci-triage permissions: # Required to create a new branch and commit the fix diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 1e79b8667dce..38802d1c0ad6 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -13,7 +13,7 @@ permissions: jobs: release: - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-small name: 'Prepare a new version' steps: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7502ea53b9ac..59962d0d401f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,14 +29,6 @@ concurrency: env: HEAD_COMMIT: ${{ github.event.inputs.commit || github.sha }} - CACHED_DEPENDENCY_PATHS: | - ${{ github.workspace }}/node_modules - ${{ github.workspace }}/packages/*/node_modules - ${{ github.workspace }}/dev-packages/*/node_modules - ~/.cache/mongodb-binaries/ - - # DEPENDENCY_CACHE_KEY: can't be set here because we don't have access to pnpm-lock.yaml - # build-output artifact paths are computed in job_build (step output from # pnpm run ci:print-build-artifact-paths — Nx merged outputs for build:transpile, and build:types). @@ -60,6 +52,8 @@ env: # This option both controls the `v8-compile-cache-lib` and `v8-compile-cache` packages. DISABLE_V8_COMPILE_CACHE: '1' +# All jobs share one Namespace cache volume through `overrides.cache-tag`. Pull request jobs get their own volume +# (`-pr`), so they cannot change the node_modules that develop and release builds install from. jobs: job_get_metadata: uses: ./.github/workflows/ci-metadata.yml @@ -72,7 +66,9 @@ jobs: job_build: name: Build needs: job_get_metadata - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} timeout-minutes: 15 if: | needs.job_get_metadata.outputs.changed_any_code == 'true' || @@ -98,7 +94,6 @@ jobs: - name: Install Dependencies uses: ./.github/actions/install-dependencies - id: install_dependencies - name: Check for Affected Nx Projects uses: ./.github/actions/nx-affected-list @@ -156,7 +151,6 @@ jobs: working-directory: dev-packages/e2e-tests outputs: - dependency_cache_key: ${{ steps.install_dependencies.outputs.cache_key }} changed_node_integration: ${{ needs.job_get_metadata.outputs.changed_ci == 'true' || contains(steps.checkForAffected.outputs.affected, '@sentry-internal/node-integration-tests') }} @@ -197,7 +191,9 @@ jobs: needs.job_build.outputs.changed_aws_serverless == 'true' || contains(needs.job_build.outputs.e2e-matrix, 'aws-serverless') || github.event_name != 'pull_request' timeout-minutes: 10 - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -217,8 +213,6 @@ jobs: - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Build Lambda layer run: pnpm run build:layer @@ -236,7 +230,9 @@ jobs: name: Build bundles needs: [job_get_metadata, job_build] timeout-minutes: 10 - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -256,8 +252,6 @@ jobs: - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Build bundles run: pnpm run build:bundle @@ -274,7 +268,9 @@ jobs: job_check_branches: name: Check PR branches needs: job_get_metadata - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript-small;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} if: github.event_name == 'pull_request' permissions: pull-requests: write @@ -290,7 +286,9 @@ jobs: name: Size Check needs: [job_get_metadata, job_build, job_build_bundles] timeout-minutes: 15 - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} if: github.event_name == 'pull_request' || needs.job_get_metadata.outputs.is_base_branch == 'true' || needs.job_get_metadata.outputs.is_release == 'true' @@ -305,8 +303,6 @@ jobs: node-version-file: 'package.json' - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Restore build bundle artifacts uses: actions/download-artifact@v8 with: @@ -325,7 +321,9 @@ jobs: # inter-package dependencies resolve cleanly. needs: [job_get_metadata, job_build] timeout-minutes: 10 - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -337,8 +335,6 @@ jobs: node-version-file: 'package.json' - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - parallel: - name: Lint source files run: pnpm run lint @@ -358,7 +354,9 @@ jobs: name: Check lockfile needs: [job_get_metadata] timeout-minutes: 10 - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} if: | needs.job_get_metadata.outputs.changed_deps == 'true' || needs.job_get_metadata.outputs.is_base_branch == 'true' || @@ -389,7 +387,9 @@ jobs: name: Check file formatting needs: [job_get_metadata] timeout-minutes: 10 - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -403,7 +403,6 @@ jobs: - name: Install Dependencies uses: ./.github/actions/install-dependencies - id: install_dependencies - name: Check file formatting run: pnpm run format:check @@ -412,7 +411,9 @@ jobs: name: Circular Dependency Check needs: [job_get_metadata, job_build] timeout-minutes: 10 - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -424,15 +425,15 @@ jobs: node-version-file: 'package.json' - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Run madge run: pnpm run circularDepCheck job_artifacts: name: Upload Artifacts needs: [job_get_metadata, job_build, job_build_layer, job_build_bundles, job_build_tarballs] - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} # Build artifacts are only needed for releasing workflow. if: needs.job_get_metadata.outputs.is_release == 'true' steps: @@ -446,8 +447,6 @@ jobs: node-version-file: 'package.json' - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Restore tarball artifacts uses: actions/download-artifact@v8 @@ -484,7 +483,9 @@ jobs: name: Browser Unit Tests needs: [job_get_metadata, job_build] timeout-minutes: 10 - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} steps: - name: Check out base commit (${{ github.event.pull_request.base.sha }}) uses: actions/checkout@v7 @@ -502,8 +503,6 @@ jobs: node-version-file: 'package.json' - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Run affected tests run: pnpm run test:pr:browser --base=${{ github.event.pull_request.base.sha }} @@ -518,7 +517,9 @@ jobs: needs: [job_get_metadata, job_build] if: needs.job_build.outputs.changed_bun == 'true' || github.event_name != 'pull_request' timeout-minutes: 10 - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} strategy: fail-fast: false matrix: @@ -539,8 +540,6 @@ jobs: bun-version: ${{ matrix.bun }} - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Run tests run: | pnpm run test:ci:bun @@ -550,7 +549,9 @@ jobs: needs: [job_get_metadata, job_build] if: needs.job_build.outputs.changed_deno == 'true' || github.event_name != 'pull_request' timeout-minutes: 10 - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -566,8 +567,6 @@ jobs: deno-version: ${{ matrix.deno-version || 'v2.8.3' }} - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Run tests run: | cd packages/deno @@ -578,7 +577,9 @@ jobs: name: Node (${{ matrix.node }}) Unit Tests needs: [job_get_metadata, job_build] timeout-minutes: 10 - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} strategy: fail-fast: false matrix: @@ -599,8 +600,6 @@ jobs: node-version: ${{ matrix.node }} - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Run affected tests run: pnpm run test:pr:node --base=${{ github.event.pull_request.base.sha }} @@ -620,7 +619,9 @@ jobs: matrix.project) || ''}}${{ matrix.shard && format(' ({0}/{1})', matrix.shard, matrix.shards) || ''}} Tests needs: [job_get_metadata, job_build, job_build_bundles] if: needs.job_build.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request' - runs-on: ubuntu-24.04-large-js + runs-on: + namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} timeout-minutes: 25 strategy: fail-fast: false @@ -680,8 +681,6 @@ jobs: node-version-file: 'package.json' - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Restore build bundle artifacts uses: actions/download-artifact@v8 @@ -718,7 +717,9 @@ jobs: name: PW ${{ matrix.bundle }} Tests needs: [job_get_metadata, job_build, job_build_bundles] if: needs.job_build.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request' - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} timeout-minutes: 15 strategy: fail-fast: false @@ -743,8 +744,6 @@ jobs: node-version-file: 'package.json' - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Restore build bundle artifacts uses: actions/download-artifact@v8 @@ -777,7 +776,9 @@ jobs: job_check_for_faulty_dts: name: Check for faulty .d.ts files needs: [job_get_metadata, job_build] - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} timeout-minutes: 5 steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) @@ -790,8 +791,6 @@ jobs: node-version-file: 'package.json' - name: Restore caches uses: ./.github/actions/restore-cache - 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 ".nx" 'import("@sentry(-internal)?/[^/]*/build' .; then @@ -805,7 +804,9 @@ jobs: Tests (${{ matrix.shard }}/3) needs: [job_get_metadata, job_build] if: needs.job_build.outputs.changed_node_integration == 'true' || github.event_name != 'pull_request' - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} timeout-minutes: 20 strategy: fail-fast: false @@ -849,8 +850,6 @@ jobs: node-version: ${{ matrix.node }} - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Overwrite typescript version if: matrix.typescript == '5.0' @@ -865,7 +864,9 @@ jobs: name: Cloudflare Integration Tests (${{ matrix.shard }}/2) needs: [job_get_metadata, job_build] if: needs.job_build.outputs.changed_cloudflare_integration == 'true' || github.event_name != 'pull_request' - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} timeout-minutes: 15 strategy: fail-fast: false @@ -882,8 +883,6 @@ jobs: node-version-file: 'package.json' - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Run integration tests working-directory: dev-packages/cloudflare-integration-tests @@ -893,7 +892,9 @@ jobs: name: Bundler Plugin Integration Tests (Node ${{ matrix.node }}) needs: [job_get_metadata, job_build] if: needs.job_build.outputs.changed_bundler_plugin_integration == 'true' || github.event_name != 'pull_request' - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} timeout-minutes: 15 strategy: fail-fast: false @@ -910,8 +911,6 @@ jobs: node-version: ${{ matrix.node }} - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Run integration tests working-directory: dev-packages/bundler-plugin-integration-tests @@ -921,7 +920,9 @@ jobs: name: Bun (${{ matrix.bun }}) Integration Tests (${{ matrix.shard }}/2) needs: [job_get_metadata, job_build] if: needs.job_build.outputs.changed_bun_integration == 'true' || github.event_name != 'pull_request' - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} timeout-minutes: 15 strategy: fail-fast: false @@ -944,8 +945,6 @@ jobs: bun-version: ${{ matrix.bun }} - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Run integration tests working-directory: dev-packages/bun-integration-tests @@ -955,7 +954,9 @@ jobs: name: Deno Integration Tests (${{ matrix.shard }}/2) needs: [job_get_metadata, job_build] if: needs.job_build.outputs.changed_deno_integration == 'true' || github.event_name != 'pull_request' - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} timeout-minutes: 15 strategy: fail-fast: false @@ -976,8 +977,6 @@ jobs: deno-version: 'v2.8.3' - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Build @sentry/deno working-directory: packages/deno run: pnpm run build @@ -1000,7 +999,9 @@ jobs: always() && needs.job_build.result == 'success' needs: [job_get_metadata, job_build] - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} timeout-minutes: 15 steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) @@ -1021,8 +1022,6 @@ jobs: - name: Restore caches uses: ./.github/actions/restore-cache - with: - dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }} - name: Build tarballs run: pnpm run build:tarball @@ -1054,7 +1053,9 @@ jobs: if: always() && needs.job_build_tarballs.result == 'success' && needs.job_build.outputs.e2e-matrix !='{"include":[]}' needs: [job_get_metadata, job_build, job_build_layer, job_build_tarballs] - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} timeout-minutes: 15 env: # We just use a dummy DSN here, only send to the tunnel anyhow @@ -1101,6 +1102,11 @@ jobs: deno-version: ${{ matrix.deno-version || 'v2.8.3' }} - name: Install pnpm uses: ./.github/actions/install-pnpm + # Keeps the pnpm store on the cache volume for the `pnpm install` of the test application + - name: Mount pnpm store + uses: namespacelabs/nscloud-cache-action@1124a6f3ce44e5cf84cc22111530961f4d2a15f9 # v1.7.0 + with: + cache: pnpm - name: Restore tarball artifacts uses: actions/download-artifact@v8 @@ -1195,7 +1201,9 @@ jobs: needs.job_build.outputs.e2e-matrix-optional != '{"include":[]}' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' needs: [job_get_metadata, job_build, job_build_tarballs] - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' + && '-pr' || '' }} timeout-minutes: 15 env: E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }} @@ -1245,6 +1253,11 @@ jobs: deno-version: ${{ matrix.deno-version || 'v2.8.3' }} - name: Install pnpm uses: ./.github/actions/install-pnpm + # Keeps the pnpm store on the cache volume for the `pnpm install` of the test application + - name: Mount pnpm store + uses: namespacelabs/nscloud-cache-action@1124a6f3ce44e5cf84cc22111530961f4d2a15f9 # v1.7.0 + with: + cache: pnpm - name: Restore tarball artifacts uses: actions/download-artifact@v8 @@ -1330,7 +1343,9 @@ jobs: ] # Always run this, even if a dependent job failed if: always() - runs-on: ubuntu-24.04 + runs-on: + namespace-profile-sentry-javascript-small;overrides.cache-tag=sentry-javascript${{ github.event_name == + 'pull_request' && '-pr' || '' }} permissions: {} steps: - name: Check for failures diff --git a/.github/workflows/bump-size-limits.yml b/.github/workflows/bump-size-limits.yml index e6ee2195ab4b..0e4c3d80d7b7 100644 --- a/.github/workflows/bump-size-limits.yml +++ b/.github/workflows/bump-size-limits.yml @@ -10,13 +10,6 @@ permissions: pull-requests: write issues: write -env: - CACHED_DEPENDENCY_PATHS: | - ${{ github.workspace }}/node_modules - ${{ github.workspace }}/packages/*/node_modules - ${{ github.workspace }}/dev-packages/*/node_modules - ~/.cache/mongodb-binaries/ - concurrency: group: bump-size-limits cancel-in-progress: false @@ -24,7 +17,7 @@ concurrency: jobs: bump: name: Bump size-limit thresholds - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-large timeout-minutes: 25 steps: - name: Generate GitHub App token diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index 3db23de94844..45d9191abae5 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -28,7 +28,7 @@ permissions: jobs: job_e2e_prepare: name: Prepare E2E Canary tests - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-large timeout-minutes: 30 steps: - name: Check out current commit @@ -57,7 +57,7 @@ jobs: job_e2e_tests: name: E2E ${{ matrix.label }} Test needs: [job_e2e_prepare] - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript timeout-minutes: 20 env: # We just use a dummy DSN here, only send to the tunnel anyhow diff --git a/.github/workflows/ci-metadata.yml b/.github/workflows/ci-metadata.yml index fde346820f10..ed114f394a19 100644 --- a/.github/workflows/ci-metadata.yml +++ b/.github/workflows/ci-metadata.yml @@ -38,7 +38,7 @@ on: jobs: get_metadata: name: Get Metadata - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-small permissions: pull-requests: read steps: diff --git a/.github/workflows/cleanup-e2e-workers.yml b/.github/workflows/cleanup-e2e-workers.yml index 69aae225e408..917de52e997d 100644 --- a/.github/workflows/cleanup-e2e-workers.yml +++ b/.github/workflows/cleanup-e2e-workers.yml @@ -8,7 +8,7 @@ jobs: cleanup: # The optional E2E job deploys only for PRs from this repository, so forks never have a worker to delete. if: github.event.pull_request.head.repo.full_name == github.repository - runs-on: ubuntu-latest + runs-on: namespace-profile-sentry-javascript-small permissions: {} timeout-minutes: 5 env: diff --git a/.github/workflows/cleanup-pr-caches.yml b/.github/workflows/cleanup-pr-caches.yml index e4543e524c91..4b7dbb4ee476 100644 --- a/.github/workflows/cleanup-pr-caches.yml +++ b/.github/workflows/cleanup-pr-caches.yml @@ -6,7 +6,7 @@ on: jobs: cleanup: - runs-on: ubuntu-latest + runs-on: namespace-profile-sentry-javascript-small permissions: # `actions:write` permission is required to delete caches # See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id diff --git a/.github/workflows/clear-cache.yml b/.github/workflows/clear-cache.yml index 750b39305d1f..28dba37b8d7c 100644 --- a/.github/workflows/clear-cache.yml +++ b/.github/workflows/clear-cache.yml @@ -21,7 +21,7 @@ on: jobs: clear-caches: name: Delete all caches - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4e41c7f5d145..79b9bb42a677 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ concurrency: jobs: analyze: name: Analyze - runs-on: ubuntu-latest + runs-on: namespace-profile-sentry-javascript-large # Skip for pushes from dependabot, which is not supported if: github.event_name == 'pull_request' || github.actor != 'dependabot[bot]' diff --git a/.github/workflows/dependabot-auto-triage.yml b/.github/workflows/dependabot-auto-triage.yml index c0298ccee87d..56ebdfe42f2f 100644 --- a/.github/workflows/dependabot-auto-triage.yml +++ b/.github/workflows/dependabot-auto-triage.yml @@ -35,11 +35,6 @@ env: FIX_CAP_DEV: '3' # ⬇️ debatable but let's start off with this PR_REVIEWERS: 'getsentry/team-javascript-sdks-framework' - CACHED_DEPENDENCY_PATHS: | - ${{ github.workspace }}/node_modules - ${{ github.workspace }}/packages/*/node_modules - ${{ github.workspace }}/dev-packages/*/node_modules - ~/.cache/mongodb-binaries/ concurrency: group: dependabot-auto-triage @@ -48,7 +43,7 @@ concurrency: jobs: classify: name: Classify alerts & auto-dismiss noise - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript timeout-minutes: 20 outputs: runtime_alerts: ${{ steps.select.outputs.runtime_alerts }} @@ -129,7 +124,7 @@ jobs: if: (github.event_name == 'schedule' || github.event.inputs.mode == 'full') && needs.classify.outputs.runtime_alerts != '' - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript timeout-minutes: 40 environment: ci-triage steps: @@ -218,7 +213,7 @@ jobs: needs: classify if: (github.event_name == 'schedule' || github.event.inputs.mode == 'full') && needs.classify.outputs.dev_alerts != '' - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript timeout-minutes: 40 environment: ci-triage steps: diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml index 5942bdb0c355..e748668b92db 100644 --- a/.github/workflows/enforce-license-compliance.yml +++ b/.github/workflows/enforce-license-compliance.yml @@ -19,7 +19,7 @@ on: jobs: enforce-license-compliance: - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript steps: - name: 'Enforce License Compliance' uses: getsentry/action-enforce-license-compliance@main diff --git a/.github/workflows/external-contributors.yml b/.github/workflows/external-contributors.yml index 1b131781dc05..6e3a3c5aff8c 100644 --- a/.github/workflows/external-contributors.yml +++ b/.github/workflows/external-contributors.yml @@ -12,7 +12,7 @@ jobs: permissions: pull-requests: write contents: write - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript if: | github.event.pull_request.merged == true && github.event.pull_request.author_association != 'COLLABORATOR' diff --git a/.github/workflows/flaky-test-detector.yml b/.github/workflows/flaky-test-detector.yml index b95132dbb488..fbde86cf1a0f 100644 --- a/.github/workflows/flaky-test-detector.yml +++ b/.github/workflows/flaky-test-detector.yml @@ -18,7 +18,7 @@ concurrency: jobs: flaky-detector: - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-large timeout-minutes: 60 name: 'Check tests for flakiness' # Also skip if PR is from master -> develop diff --git a/.github/workflows/gitflow-merge-conflict.yml b/.github/workflows/gitflow-merge-conflict.yml index 102d05b6d03b..6195a73350d5 100644 --- a/.github/workflows/gitflow-merge-conflict.yml +++ b/.github/workflows/gitflow-merge-conflict.yml @@ -9,7 +9,7 @@ on: jobs: check-merge-conflicts: name: Detect merge conflicts in gitflow PRs - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-small if: | ${{ contains(github.event.pull_request.labels.*.name, 'Dev: Gitflow') }} permissions: diff --git a/.github/workflows/gitflow-sync-develop.yml b/.github/workflows/gitflow-sync-develop.yml index 20f8b335fd0f..21d3c45dc1d0 100644 --- a/.github/workflows/gitflow-sync-develop.yml +++ b/.github/workflows/gitflow-sync-develop.yml @@ -17,7 +17,7 @@ env: jobs: main: name: Create PR master->develop - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-small permissions: pull-requests: write contents: write diff --git a/.github/workflows/issue-package-label.yml b/.github/workflows/issue-package-label.yml index 8ac1c7987801..c855066f318f 100644 --- a/.github/workflows/issue-package-label.yml +++ b/.github/workflows/issue-package-label.yml @@ -7,7 +7,7 @@ on: jobs: add_labels: name: Add package label - runs-on: ubuntu-latest + runs-on: namespace-profile-sentry-javascript-small if: ${{ !github.event.issue.pull_request }} steps: - name: Get used package from issue body diff --git a/.github/workflows/label-external-prs.yml b/.github/workflows/label-external-prs.yml index e6a73aaae5a7..6caf6fae7387 100644 --- a/.github/workflows/label-external-prs.yml +++ b/.github/workflows/label-external-prs.yml @@ -9,7 +9,7 @@ jobs: name: Add external label permissions: pull-requests: write - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-small if: | github.event.pull_request.author_association != 'COLLABORATOR' && github.event.pull_request.author_association != 'MEMBER' diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml index baa9f4838f23..1073b0c17b51 100644 --- a/.github/workflows/lighthouse.yml +++ b/.github/workflows/lighthouse.yml @@ -11,7 +11,7 @@ on: jobs: build-and-upload: name: Bundle and upload Lighthouse cells - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-large timeout-minutes: 30 env: LIGHTHOUSE_LAB_URL: ${{ secrets.LIGHTHOUSE_LAB_URL }} diff --git a/.github/workflows/pr-review-reminder.yml b/.github/workflows/pr-review-reminder.yml index 457430fc957c..e601f859d2c4 100644 --- a/.github/workflows/pr-review-reminder.yml +++ b/.github/workflows/pr-review-reminder.yml @@ -22,7 +22,7 @@ jobs: remind-reviewers: # `schedule` has no `repository` on github.event; forks must be skipped only for workflow_dispatch. if: github.event_name == 'schedule' || github.event.repository.fork != true - runs-on: ubuntu-latest + runs-on: namespace-profile-sentry-javascript-small steps: - name: Checkout repository uses: actions/checkout@v7 diff --git a/.github/workflows/pr-stale-notifier.yml b/.github/workflows/pr-stale-notifier.yml index 13bba260a0b0..3c4816dafebe 100644 --- a/.github/workflows/pr-stale-notifier.yml +++ b/.github/workflows/pr-stale-notifier.yml @@ -15,7 +15,7 @@ concurrency: jobs: stale: - runs-on: ubuntu-latest + runs-on: namespace-profile-sentry-javascript-small steps: - name: Warn and close stale PRs uses: actions/stale@v11 diff --git a/.github/workflows/release-comment-issues.yml b/.github/workflows/release-comment-issues.yml index dfb782b1b6d8..88055af892c8 100644 --- a/.github/workflows/release-comment-issues.yml +++ b/.github/workflows/release-comment-issues.yml @@ -12,7 +12,7 @@ on: # This workflow is triggered when a release is published jobs: release-comment-issues: - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-small name: 'Notify issues' steps: - name: Get version diff --git a/.github/workflows/release-size-info.yml b/.github/workflows/release-size-info.yml index a1f75303d1ff..591a14b6b553 100644 --- a/.github/workflows/release-size-info.yml +++ b/.github/workflows/release-size-info.yml @@ -13,7 +13,7 @@ on: # It fetches the size-limit info from the release branch and adds it to the release jobs: release-size-info: - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-small name: 'Add size-limit info to release' steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3924c5bf2a2d..e579c239dcfe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ permissions: jobs: release: - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-small name: 'Release a new version' steps: - name: Get auth token diff --git a/.github/workflows/track-framework-updates.yml b/.github/workflows/track-framework-updates.yml index 0a74bad0b923..3e0172884e7f 100644 --- a/.github/workflows/track-framework-updates.yml +++ b/.github/workflows/track-framework-updates.yml @@ -18,7 +18,7 @@ concurrency: jobs: track-updates: - runs-on: ubuntu-latest + runs-on: namespace-profile-sentry-javascript-small environment: ci-triage permissions: contents: read diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 9e29641264dc..f3c9f955547f 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -6,7 +6,7 @@ on: jobs: validate-pr: - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-small permissions: pull-requests: write steps: diff --git a/.github/workflows/weekly-flaky-tests.yml b/.github/workflows/weekly-flaky-tests.yml index 5c99a4b5f93f..bb0e5b3866c9 100644 --- a/.github/workflows/weekly-flaky-tests.yml +++ b/.github/workflows/weekly-flaky-tests.yml @@ -18,7 +18,7 @@ concurrency: jobs: report: name: Weekly flaky test report - runs-on: ubuntu-24.04 + runs-on: namespace-profile-sentry-javascript-small timeout-minutes: 20 steps: - uses: actions/checkout@v7 diff --git a/scripts/dependency-hash-key.js b/scripts/dependency-hash-key.js deleted file mode 100644 index 9af70a756561..000000000000 --- a/scripts/dependency-hash-key.js +++ /dev/null @@ -1,75 +0,0 @@ -const crypto = require('crypto'); -const fs = require('fs'); -const path = require('path'); - -/** - * Build a cache key for the dependencies of the monorepo. - * In addition to the content of the pnpm-lock.yaml and pnpm-workspace.yaml files, we also include - * dependencies of all workspace packages in the cache key. - * This ensures that we get a consistent cache key even if a dependency change does not affect - * the pnpm-lock.yaml file. - */ -function outputDependencyCacheKey() { - const lockfileContent = fs.readFileSync(path.join(process.cwd(), 'pnpm-lock.yaml'), 'utf8'); - - const workspaceContent = fs.readFileSync(path.join(process.cwd(), 'pnpm-workspace.yaml'), 'utf8'); - - const hashParts = [lockfileContent, workspaceContent]; - - const packageJson = require(path.join(process.cwd(), 'package.json')); - - const workspacePackages = packageJson.workspaces || []; - - // Get the package name (e.g. @sentry/browser) of all workspace packages - // we want to ignore their version numbers later - const workspacePackageNames = getWorkspacePackageNames(workspacePackages); - - // Add the dependencies of the workspace itself - hashParts.push(getNormalizedDependencies(packageJson, workspacePackageNames)); - - // Now for each workspace package, add the dependencies - workspacePackages.forEach(workspace => { - const packageJsonPath = path.join(process.cwd(), workspace, 'package.json'); - const packageJson = require(packageJsonPath); - hashParts.push(getNormalizedDependencies(packageJson, workspacePackageNames)); - }); - - const hash = crypto.createHash('md5').update(hashParts.join('\n')).digest('hex'); - // We log the output in a way that the GitHub Actions can append it to the output - // We prefix it with `dependencies-` so it is easier to identify in the logs - // eslint-disable-next-line no-console - console.log(`hash=dependencies-${hash}`); -} - -function getNormalizedDependencies(packageJson, workspacePackageNames) { - const { dependencies, devDependencies } = packageJson; - - const mergedDependencies = { - ...devDependencies, - ...dependencies, - }; - - const normalizedDependencies = {}; - - // Sort the keys to ensure a consistent order - Object.keys(mergedDependencies) - .sort() - .forEach(key => { - // If the dependency is a workspace package, ignore the version - // No need to invalidate a cache after every release - const version = workspacePackageNames.includes(key) ? '**workspace**' : mergedDependencies[key]; - normalizedDependencies[key] = version; - }); - - return JSON.stringify(normalizedDependencies); -} - -function getWorkspacePackageNames(workspacePackages) { - return workspacePackages.map(workspace => { - const packageJsonPath = path.join(process.cwd(), workspace, 'package.json'); - const packageJson = require(packageJsonPath); - return packageJson.name; - }); -} - -outputDependencyCacheKey();