Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7203205
perf(aws-serverless): Speed up Lambda layer build with tarball-based …
mydea Apr 16, 2026
b57849c
chore(ci): Do not build AWS lambda layer in build step
mydea Apr 16, 2026
b26d4fb
Revert "perf(aws-serverless): Speed up Lambda layer build with tarbal…
mydea Apr 16, 2026
df7849c
ensure extension is run for tarball as well
mydea Apr 16, 2026
3500c6b
avoid build dev change
mydea Apr 16, 2026
d8898a4
better dependency graph
mydea Apr 17, 2026
7ffc0b8
fix job
mydea Apr 17, 2026
7ca058d
only run layer build when needed
mydea Apr 17, 2026
943eb4b
fix path
mydea Apr 17, 2026
fc5fbff
use path directly
mydea Apr 17, 2026
cab77a9
ensure tarball depends on extension
mydea Apr 17, 2026
f1e1d97
build and cache extension
mydea Apr 17, 2026
19230d7
avoid unnecessary build cache
mydea Apr 17, 2026
120b10d
chore(ci): Streamline tarball packaging & e2e test matrix generation
mydea Apr 20, 2026
e21af88
use npx for test matrix thing
mydea Apr 20, 2026
15bf4bf
avoid glob usage so no dependencies are needed
mydea Apr 20, 2026
2d07da5
avoid ts dependency for test matrix
mydea Apr 20, 2026
b7953ea
use nx command via npx
mydea Apr 20, 2026
644dd41
Revert "use nx command via npx"
mydea Apr 20, 2026
b48b2aa
run it in build step
mydea Apr 20, 2026
aaa69ac
fix linting
mydea Apr 20, 2026
298e074
better path handling for artifacts
mydea Apr 20, 2026
670bfe5
better nx cache
mydea Apr 20, 2026
49638b4
cache per-branch
mydea Apr 20, 2026
3782d42
reset cache before storing it???
mydea Apr 20, 2026
a6360e7
store cache in .nx and cache this??
mydea Apr 20, 2026
1d0acab
no need to reset cache
mydea Apr 20, 2026
a2bcf03
fix types cache for nestjs
mydea Apr 20, 2026
d583772
small cleanup and improvements
mydea Apr 20, 2026
e00bfb9
fix linting
mydea Apr 20, 2026
a5ecde2
Merge branch 'fn/faster-lambda-layer-build' into fn/ci-test-structure
mydea Apr 22, 2026
17a5abe
full split
mydea Apr 22, 2026
e2a4045
Merge branch 'develop' into fn/ci-test-structure
mydea Apr 22, 2026
b580d38
fix angular deps
mydea Apr 22, 2026
d714b3b
more unique cache key
mydea Apr 22, 2026
dff1b97
rename artifcact
mydea Apr 22, 2026
97f5c7b
better nx cache restoration
mydea Apr 22, 2026
63c48e5
fixes for ci and size limit
mydea Apr 22, 2026
cc08ca3
fix nx cache config
mydea Apr 22, 2026
e3f2a7e
rename build back
mydea Apr 23, 2026
85288bd
swap order
mydea Apr 23, 2026
640fa43
fix artifacts
mydea Apr 23, 2026
ca59f42
Merge branch 'develop' into fn/ci-test-structure
mydea Apr 23, 2026
5e3ed42
small fixes
mydea Apr 23, 2026
3cfdd1e
fixes
mydea Apr 23, 2026
c36e943
more fixes
mydea Apr 23, 2026
4f8cd17
fix gatsby nx config
mydea Apr 23, 2026
d963894
remove condition for bundle build
mydea Apr 23, 2026
334404e
fix lint
mydea Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
327 changes: 221 additions & 106 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

13 changes: 1 addition & 12 deletions .github/workflows/flaky-test-detector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ on:
env:
HEAD_COMMIT: ${{ github.event.inputs.commit || github.sha }}

NX_CACHE_RESTORE_KEYS: |
nx-Linux-${{ github.ref }}-${{ github.event.inputs.commit || github.sha }}
nx-Linux-${{ github.ref }}
nx-Linux

# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
Expand All @@ -36,16 +31,10 @@ jobs:
with:
node-version-file: 'package.json'
cache: 'yarn'

- name: Install dependencies
run: yarn install --ignore-engines --frozen-lockfile

- name: NX cache
uses: actions/cache/restore@v5
with:
path: .nxcache
key: nx-Linux-${{ github.ref }}-${{ env.HEAD_COMMIT }}
restore-keys: ${{ env.NX_CACHE_RESTORE_KEYS }}

- name: Build packages
run: yarn build

Expand Down
2 changes: 1 addition & 1 deletion dev-packages/e2e-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ try {
```

Test apps in the folder `test-applications` will be automatically picked up by CI in the job `job_e2e_tests` (in `.github/workflows/build.yml`).
The test matrix for CI is generated in `dev-packages/e2e-tests/lib/getTestMatrix.ts`.
The test matrix for CI is generated in `dev-packages/e2e-tests/lib/getTestMatrix.mjs`.

For each test app, CI checks its dependencies (and devDependencies) to see if any of them have changed in the current PR (based on nx affected projects).
For example, if something is changed in the browser package, only E2E test apps that depend on browser will run, while others will be skipped.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,21 @@
import { execSync } from 'child_process';
import * as fs from 'fs';
import { sync as globSync } from 'glob';
import * as path from 'path';
import { dirname } from 'path';
import { parseArgs } from 'util';

interface MatrixInclude {
/** The test application (directory) name. */
'test-application': string;
/** Optional override for the build command to run. */
'build-command'?: string;
/** Optional override for the assert command to run. */
'assert-command'?: string;
/** Optional label for the test run. If not set, defaults to value of `test-application`. */
label?: string;
}
import { execSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { parseArgs } from 'node:util';

interface PackageJsonSentryTestConfig {
/** If this is true, the test app is optional. */
optional?: boolean;
/** Variant configs that should be run in non-optional test runs. */
variants?: Partial<MatrixInclude>[];
/** Variant configs that should be run in optional test runs. */
optionalVariants?: Partial<MatrixInclude>[];
/** Skip this test app for matrix generation. */
skip?: boolean;
}
const __dirname = path.dirname(fileURLToPath(import.meta.url));

/**
* This methods generates a matrix for the GitHub Actions workflow to run the E2E tests.
* It checks which test applications are affected by the current changes in the PR and then generates a matrix
* Generates a matrix for the GitHub Actions workflow to run the E2E tests.
* Checks which test applications are affected by the current changes in the PR and then generates a matrix
* including all test apps that have at least one dependency that was changed in the PR.
* If no `--base=xxx` is provided, it will output all test applications.
*
* If `--optional=true` is set, it will generate a matrix of optional test applications only.
* Otherwise, these will be skipped.
*/
function run(): void {
function run() {
const { values } = parseArgs({
args: process.argv.slice(2),
options: {
Expand All @@ -52,9 +31,7 @@ function run(): void {
// eslint-disable-next-line no-console
console.error(`Parsed command line arguments: base=${base}, head=${head}, optional=${optional}`);

const testApplications = globSync('*/package.json', {
cwd: `${__dirname}/../test-applications`,
}).map(filePath => dirname(filePath));
const testApplications = discoverTestApplicationDirs();

// For GitHub Action debugging (using stderr the 'matrix=...' output is not polluted)
// eslint-disable-next-line no-console
Expand All @@ -67,7 +44,7 @@ function run(): void {
: testApplications;

const optionalMode = optional === 'true';
const includes: MatrixInclude[] = [];
const includes = [];

includedTestApplications.forEach(testApp => {
addIncludesForTestApp(testApp, includes, { optionalMode });
Expand All @@ -78,11 +55,18 @@ function run(): void {
console.log(`matrix=${JSON.stringify({ include: includes })}`);
}

function addIncludesForTestApp(
testApp: string,
includes: MatrixInclude[],
{ optionalMode }: { optionalMode: boolean },
): void {
/** Direct children of `test-applications/` that contain a `package.json` (replaces glob one-segment + package.json). */
function discoverTestApplicationDirs() {
const appsRoot = path.join(__dirname, '..', 'test-applications');
return fs
.readdirSync(appsRoot, { withFileTypes: true })
.filter(entry => entry.isDirectory())
.map(entry => entry.name)
.filter(name => fs.existsSync(path.join(appsRoot, name, 'package.json')))
.sort();
}

function addIncludesForTestApp(testApp, includes, { optionalMode }) {
const packageJson = getPackageJson(testApp);

const shouldSkip = packageJson.sentryTest?.skip || false;
Expand All @@ -108,7 +92,7 @@ function addIncludesForTestApp(
});
}

function getSentryDependencies(appName: string): string[] {
function getSentryDependencies(appName) {
const packageJson = getPackageJson(appName);

const dependencies = {
Expand All @@ -119,11 +103,7 @@ function getSentryDependencies(appName: string): string[] {
return Object.keys(dependencies).filter(key => key.startsWith('@sentry'));
}

function getPackageJson(appName: string): {
dependencies?: { [key: string]: string };
devDependencies?: { [key: string]: string };
sentryTest?: PackageJsonSentryTestConfig;
} {
function getPackageJson(appName) {
const fullPath = path.resolve(__dirname, '..', 'test-applications', appName, 'package.json');

if (!fs.existsSync(fullPath)) {
Expand All @@ -133,19 +113,14 @@ function getPackageJson(appName: string): {
return JSON.parse(fs.readFileSync(fullPath, 'utf8'));
}

run();

function getAffectedTestApplications(
testApplications: string[],
{ base = 'develop', head }: { base?: string; head?: string },
): string[] {
function getAffectedTestApplications(testApplications, { base = 'develop', head }) {
const additionalArgs = [`--base=${base}`];

if (head) {
additionalArgs.push(`--head=${head}`);
}

let affectedProjects: string[] = [];
let affectedProjects = [];
try {
affectedProjects = execSync(`yarn --silent nx show projects --affected ${additionalArgs.join(' ')}`)
.toString()
Expand Down Expand Up @@ -201,7 +176,7 @@ function getAffectedTestApplications(
return Array.from(testAppsToRun);
}

function getChangedTestApps(base: string, head?: string): false | Set<string> {
function getChangedTestApps(base, head) {
const changedFiles = execSync(`git diff --name-only ${base}${head ? `..${head}` : ''} -- .`, {
encoding: 'utf-8',
})
Expand All @@ -214,7 +189,7 @@ function getChangedTestApps(base: string, head?: string): false | Set<string> {
// eslint-disable-next-line no-console
console.error(`Changed files since ${base}${head ? `..${head}` : ''}: ${JSON.stringify(changedFiles)}`);

const changedTestApps: Set<string> = new Set();
const changedTestApps = new Set();
const testAppsPrefix = 'dev-packages/e2e-tests/test-applications/';

for (const file of changedFiles) {
Expand All @@ -233,3 +208,5 @@ function getChangedTestApps(base: string, head?: string): false | Set<string> {

return changedTestApps;
}

run();
4 changes: 2 additions & 2 deletions dev-packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"test:prepare": "ts-node prepare.ts",
"test:validate": "ts-node validate-packed-tarball-setup.ts",
"clean": "rimraf tmp node_modules packed && yarn clean:test-applications && yarn clean:pnpm",
"ci:build-matrix": "ts-node ./lib/getTestMatrix.ts",
"ci:build-matrix-optional": "ts-node ./lib/getTestMatrix.ts --optional=true",
"ci:build-matrix": "node ./lib/getTestMatrix.mjs",
"ci:build-matrix-optional": "node ./lib/getTestMatrix.mjs --optional=true",
"ci:copy-to-temp": "ts-node ./ciCopyToTemp.ts",
"ci:pnpm-overrides": "ts-node ./ciPnpmOverrides.ts",
"clean:test-applications": "rimraf --glob test-applications/**/{node_modules,dist,build,.next,.nuxt,.sveltekit,.react-router,.astro,.output,pnpm-lock.yaml,.last-run.json,test-results,.angular,event-dumps}",
Expand Down
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
}
},
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"cacheDirectory": ".nxcache",
"cacheDirectory": ".nx/cache",
"tui": {
"autoExit": true
},
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"private": true,
"scripts": {
"build": "node ./scripts/verify-packages-versions.js && nx run-many -t build:transpile build:types build:bundle build:layer",
"build": "node ./scripts/verify-packages-versions.js && nx run-many -t build:transpile build:types build:bundle",
"build:ci": "node ./scripts/verify-packages-versions.js && nx run-many -t build:transpile build:types",
"build:bundle": "nx run-many -t build:bundle",
"build:layer": "nx run-many -t build:layer",
"build:dev": "nx run-many -t build:types build:transpile",
"build:dev:filter": "nx run-many -t build:dev -p",
"build:transpile": "nx run-many -t build:transpile",
Expand All @@ -11,6 +13,7 @@
"build:dev:watch": "nx run-many -t build:dev:watch",
"build:tarball": "run-s clean:tarballs build:tarballs",
"build:tarballs": "nx run-many -t build:tarball",
"ci:print-build-artifact-paths": "node ./scripts/ci-print-build-artifact-paths.mjs",
"changelog": "ts-node ./scripts/get-commit-list.ts",
"generate-changelog": "ts-node ./scripts/generate-changelog.ts",
"circularDepCheck": "nx run-many -t circularDepCheck",
Expand Down
5 changes: 1 addition & 4 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@
"^build:types"
],
"outputs": [
"{projectRoot}/build/esm2015",
"{projectRoot}/build/fesm2015",
"{projectRoot}/build/fesm2020",
"{projectRoot}/build/*.d.ts"
"{projectRoot}/build"
]
}
}
Expand Down
23 changes: 7 additions & 16 deletions packages/aws-serverless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@
"@vercel/nft": "^1.3.0"
},
"scripts": {
"build": "run-p build:transpile build:types build:extension && run-s build:layer",
"build": "run-p build:transpile build:types",
"build:extension": "rollup -c rollup.lambda-extension.config.mjs && yarn ts-node scripts/buildLambdaExtension.ts",
"build:layer": "rimraf build/aws && yarn ts-node scripts/buildLambdaLayer.ts",
Comment thread
mydea marked this conversation as resolved.
"build:dev": "run-p build:transpile build:types",
"build:transpile": "rollup -c rollup.npm.config.mjs",
"build:transpile": "run-s build:transpile:npm build:extension",
Comment thread
cursor[bot] marked this conversation as resolved.
"build:transpile:npm": "rollup -c rollup.npm.config.mjs",
"build:types": "run-s build:types:core build:types:downlevel",
"build:types:core": "tsc -p tsconfig.types.json",
"build:types:downlevel": "yarn downlevel-dts build/npm/types build/npm/types-ts3.8 --to ts3.8",
Expand Down Expand Up @@ -117,20 +118,10 @@
],
"outputs": [
"{projectRoot}/build/npm/esm",
"{projectRoot}/build/npm/cjs"
]
},
"build:extension": {
"inputs": [
"production",
"^production"
],
"dependsOn": [
"^build:transpile"
],
"outputs": [
"{projectRoot}/build/npm/cjs",
"{projectRoot}/build/lambda-extension"
]
],
"cache": true
},
"build:layer": {
"inputs": [
Expand All @@ -139,7 +130,7 @@
],
"dependsOn": [
"build:transpile",
"build:extension"
"build:types"
],
"outputs": [
"{projectRoot}/build/aws"
Expand Down
19 changes: 19 additions & 0 deletions packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,24 @@
"volta": {
"extends": "../../package.json"
},
"nx": {
"targets": {
"build:transpile": {
"inputs": [
"production",
"^production"
],
"outputs": [
"{projectRoot}/build/esm",
"{projectRoot}/build/cjs",
"{projectRoot}/*.d.ts"
],
"dependsOn": [
"^build:transpile"
],
"cache": true
}
}
},
"sideEffects": false
}
19 changes: 19 additions & 0 deletions packages/nestjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,24 @@
"volta": {
"extends": "../../package.json"
},
"nx": {
"targets": {
"build:types": {
"inputs": [
"production",
"^production"
],
"dependsOn": [
"^build:types"
],
"outputs": [
"{projectRoot}/build/types",
"{projectRoot}/build/types-ts3.8",
"{projectRoot}/*.d.ts"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was not properly cached before, but we generate types into the root directory here.

],
"cache": true
}
}
},
"sideEffects": false
}
Loading
Loading