Skip to content

Commit 3aafe9e

Browse files
ci(e2e): rightsize namespace runner jobs
1 parent 21f2cf1 commit 3aafe9e

30 files changed

Lines changed: 133 additions & 100 deletions

File tree

‎.github/actions/install-dependencies/action.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ runs:
1111
echo 'paths<<EOF'
1212
node -e 'const { workspaces } = require("./package.json"); for (const dir of [".", ...workspaces]) console.log(require("path").resolve(dir, "node_modules"))'
1313
echo '~/.cache/mongodb-binaries'
14+
echo '~/.cache/prisma'
1415
echo 'EOF'
1516
} >> "$GITHUB_OUTPUT"
1617
shell: bash

‎.github/actions/install-playwright/action.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ runs:
3434
playwright
3535
apt
3636
37+
# `--with-deps` names packages that the runner image already has (glib, mesa, nss, ...), and `apt-get install` would
38+
# upgrade them to the latest Ubuntu update. That is half of the download on a cold cache, and the image versions work.
39+
- name: Keep installed apt packages
40+
if: steps.playwright-version.outputs.version != ''
41+
run: echo 'APT::Get::Upgrade "false";' | sudo tee /etc/apt/apt.conf.d/99-no-upgrade > /dev/null
42+
shell: bash
43+
3744
# Downloads only the browsers and apt packages that are not on the cache volume yet. `npx` runs outside the repo,
3845
# so it can't pick up a `playwright` that a parallel `pnpm install` is still linking.
3946
- name: Install Playwright

‎.github/workflows/build.yml‎

Lines changed: 35 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,14 @@ jobs:
343343
run: pnpm run lint:es-compatibility
344344
- name: Lint types
345345
run: pnpm run lint:types
346+
- name: Check for circular dependencies
347+
run: pnpm run circularDepCheck
348+
- name: Check for dts files that reference stuff in the temporary build folder
349+
run: |
350+
if grep -r --include "*.d.ts" --exclude-dir ".nx" 'import("@sentry(-internal)?/[^/]*/build' .; then
351+
echo "Found illegal TypeScript import statement."
352+
exit 1
353+
fi
346354
- name: Check Playwright versions
347355
run: |
348356
version=$(node -p "require('./dev-packages/test-utils/package.json').devDependencies['@playwright/test']")
@@ -354,7 +362,8 @@ jobs:
354362
job_check_lockfile:
355363
name: Check lockfile
356364
needs: [job_get_metadata]
357-
timeout-minutes: 10
365+
# `pnpm dedupe --check` fetches metadata for every package from npm, so this job can take 8+ min on PRs.
366+
timeout-minutes: 20
358367
runs-on: namespace-profile-sentry-javascript
359368
if: |
360369
needs.job_get_metadata.outputs.changed_deps == 'true' ||
@@ -406,27 +415,6 @@ jobs:
406415
- name: Check file formatting
407416
run: pnpm run format:check
408417

409-
job_circular_dep_check:
410-
name: Circular Dependency Check
411-
needs: [job_get_metadata, job_build]
412-
timeout-minutes: 10
413-
runs-on:
414-
namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request'
415-
&& '-pr' || '' }}
416-
steps:
417-
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
418-
uses: actions/checkout@v7
419-
with:
420-
ref: ${{ env.HEAD_COMMIT }}
421-
- name: Set up Node
422-
uses: actions/setup-node@v7
423-
with:
424-
node-version-file: 'package.json'
425-
- name: Restore caches
426-
uses: ./.github/actions/restore-cache
427-
- name: Run madge
428-
run: pnpm run circularDepCheck
429-
430418
job_artifacts:
431419
name: Upload Artifacts
432420
needs: [job_get_metadata, job_build, job_build_layer, job_build_bundles, job_build_tarballs]
@@ -772,35 +760,8 @@ jobs:
772760
overwrite: true
773761
retention-days: 7
774762

775-
job_check_for_faulty_dts:
776-
name: Check for faulty .d.ts files
777-
needs: [job_get_metadata, job_build]
778-
runs-on:
779-
namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript${{ github.event_name == 'pull_request'
780-
&& '-pr' || '' }}
781-
timeout-minutes: 5
782-
steps:
783-
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
784-
uses: actions/checkout@v7
785-
with:
786-
ref: ${{ env.HEAD_COMMIT }}
787-
- name: Set up Node
788-
uses: actions/setup-node@v7
789-
with:
790-
node-version-file: 'package.json'
791-
- name: Restore caches
792-
uses: ./.github/actions/restore-cache
793-
- name: Check for dts files that reference stuff in the temporary build folder
794-
run: |
795-
if grep -r --include "*.d.ts" --exclude-dir ".nx" 'import("@sentry(-internal)?/[^/]*/build' .; then
796-
echo "Found illegal TypeScript import statement."
797-
exit 1
798-
fi
799-
800763
job_node_integration_tests:
801-
name:
802-
Node (${{ matrix.node }})${{ (matrix.typescript && format(' (TS {0})', matrix.typescript)) || '' }} Integration
803-
Tests (${{ matrix.shard }}/3)
764+
name: Node (${{ matrix.node }}) Integration Tests (${{ matrix.shard }}/3)
804765
needs: [job_get_metadata, job_build]
805766
if: needs.job_build.outputs.changed_node_integration == 'true' || github.event_name != 'pull_request'
806767
runs-on:
@@ -812,19 +773,6 @@ jobs:
812773
matrix:
813774
node: [20.19, 22, 24, 26]
814775
shard: [1, 2, 3]
815-
typescript:
816-
- false
817-
include:
818-
# Only check typescript for latest version (to streamline CI)
819-
- node: 24
820-
typescript: '5.0'
821-
shard: 1
822-
- node: 24
823-
typescript: '5.0'
824-
shard: 2
825-
- node: 24
826-
typescript: '5.0'
827-
shard: 3
828776
steps:
829777
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
830778
uses: actions/checkout@v7
@@ -850,11 +798,6 @@ jobs:
850798
- name: Restore caches
851799
uses: ./.github/actions/restore-cache
852800

853-
- name: Overwrite typescript version
854-
if: matrix.typescript == '5.0'
855-
run: node ./scripts/use-ts-5_0.js
856-
working-directory: dev-packages/node-integration-tests
857-
858801
- name: Run integration tests
859802
working-directory: dev-packages/node-integration-tests
860803
run: pnpm run test --shard=${{ matrix.shard }}/3
@@ -1083,9 +1026,10 @@ jobs:
10831026
if:
10841027
always() && needs.job_build_tarballs.result == 'success' && needs.job_build.outputs.e2e-matrix !='{"include":[]}'
10851028
needs: [job_get_metadata, job_build, job_build_layer, job_build_tarballs]
1029+
# Most apps finish in under a minute on 4 vCPUs, so they run on 2. Apps that take longer set `sentryTest.runner`.
10861030
runs-on:
1087-
namespace-profile-sentry-javascript;overrides.cache-tag=sentry-javascript-e2e${{ github.event_name ==
1088-
'pull_request' && '-pr' || '' }}
1031+
${{ matrix.runner || 'namespace-profile-sentry-javascript-small' }};overrides.cache-tag=sentry-javascript-e2e${{
1032+
github.event_name == 'pull_request' && '-pr' || '' }}
10891033
timeout-minutes: 15
10901034
env:
10911035
# We just use a dummy DSN here, only send to the tunnel anyhow
@@ -1115,9 +1059,10 @@ jobs:
11151059
runtime: ${{ matrix.runtime }}
11161060
deno-version: ${{ matrix.deno-version }}
11171061

1118-
# Installs Playwright while the app builds. Keep it right before the build: the runner sets up a background
1119-
# composite action's steps from the job's shared `github` context, which fails with "Collection was modified" if
1120-
# a foreground step starts at that moment. Starting next to `download-artifact` also made it fail to read the event file.
1062+
# Installs Playwright while the app installs and builds. Keep it right before the install: the runner sets up a
1063+
# background composite action's steps from the job's shared `github` context, which fails with "Collection was
1064+
# modified" if a foreground step starts at that moment. Starting next to `download-artifact` also made it fail to
1065+
# read the event file.
11211066
- name: Install Playwright
11221067
id: install-playwright
11231068
background: true
@@ -1126,6 +1071,23 @@ jobs:
11261071
browsers: chromium
11271072
cwd: dev-packages/e2e-tests/test-applications/${{ matrix.test-application }}
11281073

1074+
# Every build command runs `pnpm install`, so installing first makes that a no-op. Some downloads from the npm
1075+
# registry crawl at tens of kB/s for the whole 7 minutes of the build step, and pnpm does not give up on a slow
1076+
# download. Another attempt reuses what is already in the store and opens new connections.
1077+
# The hoisted variant installs with another node linker, so installing first would only redo the install.
1078+
- name: Install E2E app dependencies
1079+
if: ${{ !contains(matrix.build-command, 'hoisted') }}
1080+
working-directory: ${{ runner.temp }}/test-application
1081+
timeout-minutes: 7
1082+
run: |
1083+
for attempt in 1 2; do
1084+
timeout 150 pnpm install && exit 0
1085+
echo "::warning::pnpm install attempt $attempt failed or did not finish in 150 s, retrying"
1086+
done
1087+
pnpm install
1088+
env:
1089+
SENTRY_E2E_WORKSPACE_ROOT: ${{ github.workspace }}
1090+
11291091
- name: Build E2E app
11301092
working-directory: ${{ runner.temp }}/test-application
11311093
timeout-minutes: 7
@@ -1216,7 +1178,6 @@ jobs:
12161178
job_lint,
12171179
job_check_lockfile,
12181180
job_check_format,
1219-
job_circular_dep_check,
12201181
job_size_check,
12211182
]
12221183
# Always run this, even if a dependent job failed

‎.github/workflows/enforce-license-compliance.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ on:
1717
- v9
1818
- v8
1919

20+
# Cancel in progress workflows on pull_requests.
21+
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
24+
cancel-in-progress: true
25+
2026
jobs:
2127
enforce-license-compliance:
2228
runs-on: namespace-profile-sentry-javascript

‎dev-packages/e2e-tests/README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ For example, if something is changed in the browser package, only E2E test apps
280280
You can add additional information about the test (e.g. canary versions, optional in CI) by adding `sentryTest` in the `package.json`
281281
of a test application.
282282

283+
The required E2E jobs run on 2 vCPUs (`namespace-profile-sentry-javascript-small`). If an app's job takes longer than
284+
about 90 seconds, set `"sentryTest": { "runner": "namespace-profile-sentry-javascript" }` to run it and its variants on
285+
4 vCPUs.
286+
283287
If you add Sentry dependencies to your test application, set the dependency versions to `latest || *` in order
284288
for it to work with both regular and prerelease versions:
285289

‎dev-packages/e2e-tests/lib/getTestMatrix.mjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ function addIncludesForTestApp(testApp, includes, { optionalMode }) {
7272
const shouldSkip = packageJson.sentryTest?.skip || false;
7373
const isOptional = packageJson.sentryTest?.optional || false;
7474
const variants = (optionalMode ? packageJson.sentryTest?.optionalVariants : packageJson.sentryTest?.variants) || [];
75+
const runner = packageJson.sentryTest?.runner;
76+
const baseInclude = { 'test-application': testApp, ...(runner ? { runner } : {}) };
7577

7678
if (shouldSkip) {
7779
return;
7880
}
7981

8082
// Add the basic test-application itself, if it is in the current mode
8183
if (optionalMode === isOptional) {
82-
includes.push({
83-
'test-application': testApp,
84-
});
84+
includes.push(baseInclude);
8585
}
8686

8787
variants.forEach(variant => {
@@ -94,7 +94,7 @@ function addIncludesForTestApp(testApp, includes, { optionalMode }) {
9494
// Don't leak the `skip` flag into the matrix include.
9595
const { skip: _skip, ...variantConfig } = variant;
9696
includes.push({
97-
'test-application': testApp,
97+
...baseInclude,
9898
...variantConfig,
9999
});
100100
});

‎dev-packages/e2e-tests/test-applications/aws-serverless-layer/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"extends": "../../package.json"
2525
},
2626
"sentryTest": {
27+
"runner": "namespace-profile-sentry-javascript",
2728
"variants": [
2829
{
2930
"build-command": "NODE_VERSION=22 pnpm test:build",

‎dev-packages/e2e-tests/test-applications/aws-serverless-layer/tests/layer.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ test.describe('Lambda layer', () => {
337337
const transactionEvent = await transactionEventPromise;
338338

339339
expect(transactionEvent.contexts?.trace?.status).toBe('ok');
340-
expect(transactionEvent.timestamp! - transactionEvent.start_timestamp!).toBeGreaterThanOrEqual(0.2);
340+
// Node timers can fire up to a millisecond early, so the 200 ms callback delay can measure as 199.x ms
341+
expect(transactionEvent.timestamp! - transactionEvent.start_timestamp!).toBeGreaterThanOrEqual(0.19);
341342
});
342343

343344
test('sets error status when a callback-style handler calls back with an error after it returned', async ({
@@ -360,7 +361,7 @@ test.describe('Lambda layer', () => {
360361
const [errorEvent, transactionEvent] = await Promise.all([errorEventPromise, transactionEventPromise]);
361362

362363
expect(transactionEvent.contexts?.trace?.status).toBe('internal_error');
363-
expect(transactionEvent.timestamp! - transactionEvent.start_timestamp!).toBeGreaterThanOrEqual(0.2);
364+
expect(transactionEvent.timestamp! - transactionEvent.start_timestamp!).toBeGreaterThanOrEqual(0.19);
364365
expect(errorEvent.contexts?.trace?.trace_id).toBe(transactionEvent.contexts?.trace?.trace_id);
365366
});
366367

‎dev-packages/e2e-tests/test-applications/browser-bfcache/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@
2323
},
2424
"volta": {
2525
"extends": "../../package.json"
26+
},
27+
"sentryTest": {
28+
"runner": "namespace-profile-sentry-javascript"
2629
}
2730
}

‎dev-packages/e2e-tests/test-applications/nextjs-15-basepath/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@
2626
},
2727
"volta": {
2828
"extends": "../../package.json"
29+
},
30+
"sentryTest": {
31+
"runner": "namespace-profile-sentry-javascript"
2932
}
3033
}

0 commit comments

Comments
 (0)