Skip to content

Commit acc8012

Browse files
JPeer264claude
andcommitted
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 <noreply@anthropic.com>
1 parent 3d47e12 commit acc8012

31 files changed

Lines changed: 148 additions & 258 deletions
Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
name: 'Install pnpm dependencies'
2-
description: 'Installs pnpm dependencies and caches them.'
3-
4-
outputs:
5-
cache_key:
6-
description: 'The dependency cache key'
7-
value: ${{ steps.compute_lockfile_hash.outputs.hash }}
2+
description: 'Installs pnpm dependencies into node_modules folders on the Namespace cache volume.'
83

94
runs:
105
using: 'composite'
116
steps:
127
- name: Install pnpm
138
uses: ./.github/actions/install-pnpm
149

15-
- name: Compute dependency cache key
16-
id: compute_lockfile_hash
17-
run: node ./scripts/dependency-hash-key.js >> "$GITHUB_OUTPUT"
10+
- name: List dependency paths
11+
id: paths
12+
run: |
13+
{
14+
echo 'paths<<EOF'
15+
node -e 'const { workspaces } = require("./package.json"); for (const dir of [".", ...workspaces]) console.log(require("path").resolve(dir, "node_modules"))'
16+
echo '~/.cache/mongodb-binaries'
17+
echo 'EOF'
18+
} >> "$GITHUB_OUTPUT"
1819
shell: bash
1920

20-
- name: Check dependency cache
21-
uses: actions/cache@v6.1.0
22-
id: cache_dependencies
21+
- name: Mount dependency cache
22+
uses: namespacelabs/nscloud-cache-action@1124a6f3ce44e5cf84cc22111530961f4d2a15f9 # v1.7.0
2323
with:
24-
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
25-
key: ${{ steps.compute_lockfile_hash.outputs.hash }}
24+
cache: pnpm
25+
path: ${{ steps.paths.outputs.paths }}
2626

27+
# The cache volume can hold node_modules of another commit or branch. This is a no-op when they match
28+
# pnpm-lock.yaml.
2729
- name: Install dependencies
28-
if: steps.cache_dependencies.outputs.cache-hit != 'true'
2930
run: pnpm install --frozen-lockfile
3031
shell: bash
Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Install Playwright dependencies'
2-
description: 'Installs Playwright dependencies and caches them.'
2+
description: 'Installs Playwright browsers and system dependencies, keeping both on the Namespace cache volume.'
33
inputs:
44
browsers:
55
description: 'What browsers to install.'
@@ -26,43 +26,21 @@ runs:
2626
shell: bash
2727
working-directory: ${{ inputs.cwd }}
2828

29-
- name: Restore cached playwright binaries
30-
uses: actions/cache/restore@v6.1.0
31-
id: playwright-cache
29+
- name: Mount Playwright cache
30+
uses: namespacelabs/nscloud-cache-action@1124a6f3ce44e5cf84cc22111530961f4d2a15f9 # v1.7.0
3231
if: steps.playwright-version.outputs.version != ''
3332
with:
34-
path: |
35-
~/.cache/ms-playwright
36-
# Bump the iteration when bumping runner images to use a new cache
37-
key: playwright-${{ runner.os }}-iteration-1-${{ steps.playwright-version.outputs.version }}
33+
cache: |
34+
playwright
35+
apt
3836
39-
# We always install all browsers, if uncached
40-
# `npx` runs outside the repo, so it can't pick up a `playwright` that a parallel `pnpm install` is still linking.
41-
- name: Install Playwright dependencies (uncached)
42-
env:
43-
PLAYWRIGHT_VERSION: ${{ steps.playwright-version.outputs.version }}
44-
run: npx -y "playwright@$PLAYWRIGHT_VERSION" install chromium webkit firefox --with-deps
45-
if: steps.playwright-version.outputs.version != '' && steps.playwright-cache.outputs.cache-hit != 'true'
46-
shell: bash
47-
working-directory: ${{ runner.temp }}
48-
49-
- name: Install Playwright system dependencies only (cached)
37+
# Downloads only the browsers and apt packages that are not on the cache volume yet. `npx` runs outside the repo,
38+
# so it can't pick up a `playwright` that a parallel `pnpm install` is still linking.
39+
- name: Install Playwright
40+
if: steps.playwright-version.outputs.version != ''
5041
env:
5142
PLAYWRIGHT_BROWSERS: ${{ inputs.browsers || 'chromium webkit firefox' }}
5243
PLAYWRIGHT_VERSION: ${{ steps.playwright-version.outputs.version }}
53-
run: npx -y "playwright@$PLAYWRIGHT_VERSION" install-deps $PLAYWRIGHT_BROWSERS
54-
if: steps.playwright-version.outputs.version != '' && steps.playwright-cache.outputs.cache-hit == 'true'
44+
run: npx -y "playwright@$PLAYWRIGHT_VERSION" install --with-deps $PLAYWRIGHT_BROWSERS
5545
shell: bash
5646
working-directory: ${{ runner.temp }}
57-
58-
# Only store cache on develop branch
59-
- name: Store cached playwright binaries
60-
uses: actions/cache/save@v6.1.0
61-
if:
62-
steps.playwright-version.outputs.version != '' && github.event_name == 'push' && github.ref ==
63-
'refs/heads/develop'
64-
with:
65-
path: |
66-
~/.cache/ms-playwright
67-
# Bump the iteration when bumping runner images to use a new cache
68-
key: playwright-${{ runner.os }}-iteration-1-${{ steps.playwright-version.outputs.version }}
Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
11
name: 'Restore dependency & build cache'
2-
description: 'Restore the dependency & build cache.'
3-
4-
inputs:
5-
dependency_cache_key:
6-
description: 'The dependency cache key'
7-
required: true
2+
description: 'Installs dependencies from the Namespace cache volume and restores the build output.'
83

94
runs:
105
using: 'composite'
116
steps:
12-
- name: Install pnpm
13-
uses: ./.github/actions/install-pnpm
14-
15-
- name: Check dependency cache
16-
id: dep-cache
17-
uses: actions/cache/restore@v6.1.0
18-
with:
19-
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
20-
key: ${{ inputs.dependency_cache_key }}
21-
227
- name: Restore build artifacts
238
uses: actions/download-artifact@v7
249
with:
2510
name: build-output
2611

2712
- name: Install dependencies
28-
if: steps.dep-cache.outputs.cache-hit != 'true'
29-
run: pnpm install --frozen-lockfile
30-
shell: bash
13+
uses: ./.github/actions/install-dependencies

‎.github/workflows/auto-fix-issue.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ concurrency:
2323

2424
jobs:
2525
auto-fix-issue:
26-
runs-on: ubuntu-latest
26+
runs-on: namespace-profile-sentry-javascript
2727
environment: ci-triage
2828
permissions:
2929
# Required to create a new branch and commit the fix

‎.github/workflows/auto-release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313

1414
jobs:
1515
release:
16-
runs-on: ubuntu-24.04
16+
runs-on: namespace-profile-sentry-javascript-small
1717
name: 'Prepare a new version'
1818

1919
steps:

0 commit comments

Comments
 (0)