diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml index 76ca231532f9..5f51f918c34b 100644 --- a/.github/actions/install-dependencies/action.yml +++ b/.github/actions/install-dependencies/action.yml @@ -1,5 +1,10 @@ name: 'Install pnpm dependencies' -description: 'Installs pnpm dependencies into node_modules folders on the Namespace cache volume.' +description: 'Installs pnpm dependencies and caches them.' + +outputs: + cache_key: + description: 'The dependency cache key' + value: ${{ steps.compute_lockfile_hash.outputs.hash }} runs: using: 'composite' @@ -7,25 +12,19 @@ runs: - name: Install pnpm uses: ./.github/actions/install-pnpm - - name: List dependency paths - id: paths - run: | - { - echo 'paths<> "$GITHUB_OUTPUT" + - name: Compute dependency cache key + id: compute_lockfile_hash + run: node ./scripts/dependency-hash-key.js >> "$GITHUB_OUTPUT" shell: bash - - name: Mount dependency cache - uses: namespacelabs/nscloud-cache-action@1124a6f3ce44e5cf84cc22111530961f4d2a15f9 # v1.7.0 + - name: Check dependency cache + uses: actions/cache@v6.1.0 + id: cache_dependencies with: - cache: pnpm - path: ${{ steps.paths.outputs.paths }} + path: ${{ env.CACHED_DEPENDENCY_PATHS }} + key: ${{ steps.compute_lockfile_hash.outputs.hash }} - # 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 bd84a13e9107..ca6c8a2d9583 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 browsers and system dependencies, keeping both on the Namespace cache volume.' +description: 'Installs Playwright dependencies and caches them.' inputs: browsers: description: 'What browsers to install.' @@ -26,21 +26,43 @@ runs: shell: bash working-directory: ${{ inputs.cwd }} - - name: Mount Playwright cache - uses: namespacelabs/nscloud-cache-action@1124a6f3ce44e5cf84cc22111530961f4d2a15f9 # v1.7.0 + - name: Restore cached playwright binaries + uses: actions/cache/restore@v6.1.0 + id: playwright-cache if: steps.playwright-version.outputs.version != '' with: - cache: | - playwright - apt + 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 }} - # 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 != '' + # 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) env: PLAYWRIGHT_BROWSERS: ${{ inputs.browsers || 'chromium webkit firefox' }} PLAYWRIGHT_VERSION: ${{ steps.playwright-version.outputs.version }} - run: npx -y "playwright@$PLAYWRIGHT_VERSION" install --with-deps $PLAYWRIGHT_BROWSERS + run: npx -y "playwright@$PLAYWRIGHT_VERSION" install-deps $PLAYWRIGHT_BROWSERS + if: steps.playwright-version.outputs.version != '' && steps.playwright-cache.outputs.cache-hit == 'true' 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 c647c74405b9..daa5943f9877 100644 --- a/.github/actions/restore-cache/action.yml +++ b/.github/actions/restore-cache/action.yml @@ -1,13 +1,30 @@ name: 'Restore dependency & build cache' -description: 'Installs dependencies from the Namespace cache volume and restores the build output.' +description: 'Restore the dependency & build cache.' + +inputs: + dependency_cache_key: + description: 'The dependency cache key' + required: true 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 - uses: ./.github/actions/install-dependencies + if: steps.dep-cache.outputs.cache-hit != 'true' + run: pnpm install --frozen-lockfile + shell: bash diff --git a/.github/workflows/auto-fix-issue.yml b/.github/workflows/auto-fix-issue.yml index 8feb478c6edb..559f255e3e98 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: namespace-profile-sentry-javascript + runs-on: ubuntu-latest 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 38802d1c0ad6..1e79b8667dce 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -13,7 +13,7 @@ permissions: jobs: release: - runs-on: namespace-profile-sentry-javascript-small + runs-on: ubuntu-24.04 name: 'Prepare a new version' steps: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 59962d0d401f..7502ea53b9ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,14 @@ 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). @@ -52,8 +60,6 @@ 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 @@ -66,9 +72,7 @@ jobs: job_build: name: Build needs: job_get_metadata - runs-on: - namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04 timeout-minutes: 15 if: | needs.job_get_metadata.outputs.changed_any_code == 'true' || @@ -94,6 +98,7 @@ jobs: - name: Install Dependencies uses: ./.github/actions/install-dependencies + id: install_dependencies - name: Check for Affected Nx Projects uses: ./.github/actions/nx-affected-list @@ -151,6 +156,7 @@ 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') }} @@ -191,9 +197,7 @@ 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: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -213,6 +217,8 @@ 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 @@ -230,9 +236,7 @@ jobs: name: Build bundles needs: [job_get_metadata, job_build] timeout-minutes: 10 - runs-on: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -252,6 +256,8 @@ 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 @@ -268,9 +274,7 @@ jobs: job_check_branches: name: Check PR branches needs: job_get_metadata - runs-on: - namespace-profile-sentry-javascript-small;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04 if: github.event_name == 'pull_request' permissions: pull-requests: write @@ -286,9 +290,7 @@ jobs: name: Size Check needs: [job_get_metadata, job_build, job_build_bundles] timeout-minutes: 15 - runs-on: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 if: github.event_name == 'pull_request' || needs.job_get_metadata.outputs.is_base_branch == 'true' || needs.job_get_metadata.outputs.is_release == 'true' @@ -303,6 +305,8 @@ 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: @@ -321,9 +325,7 @@ jobs: # inter-package dependencies resolve cleanly. needs: [job_get_metadata, job_build] timeout-minutes: 10 - runs-on: - namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04 steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -335,6 +337,8 @@ 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 @@ -354,9 +358,7 @@ jobs: name: Check lockfile needs: [job_get_metadata] timeout-minutes: 10 - runs-on: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 if: | needs.job_get_metadata.outputs.changed_deps == 'true' || needs.job_get_metadata.outputs.is_base_branch == 'true' || @@ -387,9 +389,7 @@ jobs: name: Check file formatting needs: [job_get_metadata] timeout-minutes: 10 - runs-on: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -403,6 +403,7 @@ jobs: - name: Install Dependencies uses: ./.github/actions/install-dependencies + id: install_dependencies - name: Check file formatting run: pnpm run format:check @@ -411,9 +412,7 @@ jobs: name: Circular Dependency Check needs: [job_get_metadata, job_build] timeout-minutes: 10 - runs-on: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -425,15 +424,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: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 # Build artifacts are only needed for releasing workflow. if: needs.job_get_metadata.outputs.is_release == 'true' steps: @@ -447,6 +446,8 @@ 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 @@ -483,9 +484,7 @@ jobs: name: Browser Unit Tests needs: [job_get_metadata, job_build] timeout-minutes: 10 - runs-on: - namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04 steps: - name: Check out base commit (${{ github.event.pull_request.base.sha }}) uses: actions/checkout@v7 @@ -503,6 +502,8 @@ 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 }} @@ -517,9 +518,7 @@ 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: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: @@ -540,6 +539,8 @@ 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 @@ -549,9 +550,7 @@ 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: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v7 @@ -567,6 +566,8 @@ 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 @@ -577,9 +578,7 @@ jobs: name: Node (${{ matrix.node }}) Unit Tests needs: [job_get_metadata, job_build] timeout-minutes: 10 - runs-on: - namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: @@ -600,6 +599,8 @@ 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 }} @@ -619,9 +620,7 @@ 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: - namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04-large-js timeout-minutes: 25 strategy: fail-fast: false @@ -681,6 +680,8 @@ 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 @@ -717,9 +718,7 @@ 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: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 timeout-minutes: 15 strategy: fail-fast: false @@ -744,6 +743,8 @@ 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 @@ -776,9 +777,7 @@ jobs: job_check_for_faulty_dts: name: Check for faulty .d.ts files needs: [job_get_metadata, job_build] - runs-on: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) @@ -791,6 +790,8 @@ 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 @@ -804,9 +805,7 @@ 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: - namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04 timeout-minutes: 20 strategy: fail-fast: false @@ -850,6 +849,8 @@ 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' @@ -864,9 +865,7 @@ 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: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 timeout-minutes: 15 strategy: fail-fast: false @@ -883,6 +882,8 @@ 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 @@ -892,9 +893,7 @@ 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: - namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04 timeout-minutes: 15 strategy: fail-fast: false @@ -911,6 +910,8 @@ 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 @@ -920,9 +921,7 @@ 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: - namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04 timeout-minutes: 15 strategy: fail-fast: false @@ -945,6 +944,8 @@ 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 @@ -954,9 +955,7 @@ 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: - namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04 timeout-minutes: 15 strategy: fail-fast: false @@ -977,6 +976,8 @@ 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 @@ -999,9 +1000,7 @@ jobs: always() && needs.job_build.result == 'success' needs: [job_get_metadata, job_build] - runs-on: - namespace-profile-sentry-javascript-large;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04 timeout-minutes: 15 steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) @@ -1022,6 +1021,8 @@ 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 @@ -1053,9 +1054,7 @@ 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: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 timeout-minutes: 15 env: # We just use a dummy DSN here, only send to the tunnel anyhow @@ -1102,11 +1101,6 @@ 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 @@ -1201,9 +1195,7 @@ 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: - namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request' - && '-pr' || '' }} + runs-on: ubuntu-24.04 timeout-minutes: 15 env: E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }} @@ -1253,11 +1245,6 @@ 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 @@ -1343,9 +1330,7 @@ jobs: ] # Always run this, even if a dependent job failed if: always() - runs-on: - namespace-profile-sentry-javascript-small;overrides.cache-tag=sentry-javascript${{ github.event_name == - 'pull_request' && '-pr' || '' }} + runs-on: ubuntu-24.04 permissions: {} steps: - name: Check for failures diff --git a/.github/workflows/bump-size-limits.yml b/.github/workflows/bump-size-limits.yml index 0e4c3d80d7b7..e6ee2195ab4b 100644 --- a/.github/workflows/bump-size-limits.yml +++ b/.github/workflows/bump-size-limits.yml @@ -10,6 +10,13 @@ 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 @@ -17,7 +24,7 @@ concurrency: jobs: bump: name: Bump size-limit thresholds - runs-on: namespace-profile-sentry-javascript-large + runs-on: ubuntu-24.04 timeout-minutes: 25 steps: - name: Generate GitHub App token diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index 45d9191abae5..3db23de94844 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: namespace-profile-sentry-javascript-large + runs-on: ubuntu-24.04 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: namespace-profile-sentry-javascript + runs-on: ubuntu-24.04 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 ed114f394a19..fde346820f10 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: namespace-profile-sentry-javascript-small + runs-on: ubuntu-24.04 permissions: pull-requests: read steps: diff --git a/.github/workflows/cleanup-e2e-workers.yml b/.github/workflows/cleanup-e2e-workers.yml index 917de52e997d..69aae225e408 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: namespace-profile-sentry-javascript-small + runs-on: ubuntu-latest permissions: {} timeout-minutes: 5 env: diff --git a/.github/workflows/cleanup-pr-caches.yml b/.github/workflows/cleanup-pr-caches.yml index 4b7dbb4ee476..e4543e524c91 100644 --- a/.github/workflows/cleanup-pr-caches.yml +++ b/.github/workflows/cleanup-pr-caches.yml @@ -6,7 +6,7 @@ on: jobs: cleanup: - runs-on: namespace-profile-sentry-javascript-small + runs-on: ubuntu-latest 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 28dba37b8d7c..750b39305d1f 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: namespace-profile-sentry-javascript + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 79b9bb42a677..4e41c7f5d145 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ concurrency: jobs: analyze: name: Analyze - runs-on: namespace-profile-sentry-javascript-large + runs-on: ubuntu-latest # 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 56ebdfe42f2f..c0298ccee87d 100644 --- a/.github/workflows/dependabot-auto-triage.yml +++ b/.github/workflows/dependabot-auto-triage.yml @@ -35,6 +35,11 @@ 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 @@ -43,7 +48,7 @@ concurrency: jobs: classify: name: Classify alerts & auto-dismiss noise - runs-on: namespace-profile-sentry-javascript + runs-on: ubuntu-24.04 timeout-minutes: 20 outputs: runtime_alerts: ${{ steps.select.outputs.runtime_alerts }} @@ -124,7 +129,7 @@ jobs: if: (github.event_name == 'schedule' || github.event.inputs.mode == 'full') && needs.classify.outputs.runtime_alerts != '' - runs-on: namespace-profile-sentry-javascript + runs-on: ubuntu-24.04 timeout-minutes: 40 environment: ci-triage steps: @@ -213,7 +218,7 @@ jobs: needs: classify if: (github.event_name == 'schedule' || github.event.inputs.mode == 'full') && needs.classify.outputs.dev_alerts != '' - runs-on: namespace-profile-sentry-javascript + runs-on: ubuntu-24.04 timeout-minutes: 40 environment: ci-triage steps: diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml index e748668b92db..5942bdb0c355 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: namespace-profile-sentry-javascript + runs-on: ubuntu-24.04 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 6e3a3c5aff8c..1b131781dc05 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: namespace-profile-sentry-javascript + runs-on: ubuntu-24.04 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 fbde86cf1a0f..b95132dbb488 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: namespace-profile-sentry-javascript-large + runs-on: ubuntu-24.04 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 6195a73350d5..102d05b6d03b 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: namespace-profile-sentry-javascript-small + runs-on: ubuntu-24.04 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 21d3c45dc1d0..20f8b335fd0f 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: namespace-profile-sentry-javascript-small + runs-on: ubuntu-24.04 permissions: pull-requests: write contents: write diff --git a/.github/workflows/issue-package-label.yml b/.github/workflows/issue-package-label.yml index c855066f318f..8ac1c7987801 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: namespace-profile-sentry-javascript-small + runs-on: ubuntu-latest 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 6caf6fae7387..e6a73aaae5a7 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: namespace-profile-sentry-javascript-small + runs-on: ubuntu-24.04 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 1073b0c17b51..baa9f4838f23 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: namespace-profile-sentry-javascript-large + runs-on: ubuntu-24.04 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 e601f859d2c4..457430fc957c 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: namespace-profile-sentry-javascript-small + runs-on: ubuntu-latest 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 3c4816dafebe..13bba260a0b0 100644 --- a/.github/workflows/pr-stale-notifier.yml +++ b/.github/workflows/pr-stale-notifier.yml @@ -15,7 +15,7 @@ concurrency: jobs: stale: - runs-on: namespace-profile-sentry-javascript-small + runs-on: ubuntu-latest 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 88055af892c8..dfb782b1b6d8 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: namespace-profile-sentry-javascript-small + runs-on: ubuntu-24.04 name: 'Notify issues' steps: - name: Get version diff --git a/.github/workflows/release-size-info.yml b/.github/workflows/release-size-info.yml index 591a14b6b553..a1f75303d1ff 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: namespace-profile-sentry-javascript-small + runs-on: ubuntu-24.04 name: 'Add size-limit info to release' steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e579c239dcfe..3924c5bf2a2d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ permissions: jobs: release: - runs-on: namespace-profile-sentry-javascript-small + runs-on: ubuntu-24.04 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 3e0172884e7f..0a74bad0b923 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: namespace-profile-sentry-javascript-small + runs-on: ubuntu-latest environment: ci-triage permissions: contents: read diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index f3c9f955547f..9e29641264dc 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -6,7 +6,7 @@ on: jobs: validate-pr: - runs-on: namespace-profile-sentry-javascript-small + runs-on: ubuntu-24.04 permissions: pull-requests: write steps: diff --git a/.github/workflows/weekly-flaky-tests.yml b/.github/workflows/weekly-flaky-tests.yml index bb0e5b3866c9..5c99a4b5f93f 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: namespace-profile-sentry-javascript-small + runs-on: ubuntu-24.04 timeout-minutes: 20 steps: - uses: actions/checkout@v7 diff --git a/scripts/dependency-hash-key.js b/scripts/dependency-hash-key.js new file mode 100644 index 000000000000..9af70a756561 --- /dev/null +++ b/scripts/dependency-hash-key.js @@ -0,0 +1,75 @@ +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();