From 45a7175074e82e3b1ef6a09754eafe3b8266cace Mon Sep 17 00:00:00 2001 From: shortstacked Date: Mon, 11 Aug 2025 09:05:35 +0100 Subject: [PATCH] ci: Exclude test controller in CI by default (#18136) --- .github/workflows/playwright-test-reusable.yml | 2 ++ scripts/build-n8n.mjs | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/playwright-test-reusable.yml b/.github/workflows/playwright-test-reusable.yml index 5b271a5834..a3641bfe89 100644 --- a/.github/workflows/playwright-test-reusable.yml +++ b/.github/workflows/playwright-test-reusable.yml @@ -49,6 +49,8 @@ jobs: with: build-command: ${{ inputs.test-mode == 'docker-build' && 'pnpm build:docker' || 'pnpm turbo build:playwright' }} enable-docker-cache: ${{ inputs.test-mode != 'local' }} + env: + INCLUDE_TEST_CONTROLLER: ${{ inputs.test-mode == 'docker-build' && 'true' || '' }} - name: Install Browsers (Docker Build) if: inputs.test-mode == 'docker-build' diff --git a/scripts/build-n8n.mjs b/scripts/build-n8n.mjs index 689cf4e4dc..334c0722a6 100755 --- a/scripts/build-n8n.mjs +++ b/scripts/build-n8n.mjs @@ -14,6 +14,10 @@ import path from 'path'; // Check if running in a CI environment const isCI = process.env.CI === 'true'; +// Check if test controller should be excluded (CI + flag not set) +const excludeTestController = + process.env.CI === 'true' && process.env.INCLUDE_TEST_CONTROLLER !== 'true'; + // Disable verbose output and force color only if not in CI $.verbose = !isCI; process.env.FORCE_COLOR = isCI ? '0' : '1'; @@ -169,6 +173,15 @@ startTimer('package_deploy'); await fs.ensureDir(config.compiledAppDir); +if (excludeTestController) { + const cliPackagePath = path.join(config.rootDir, 'packages/cli/package.json'); + const content = await fs.readFile(cliPackagePath, 'utf8'); + const packageJson = JSON.parse(content); + packageJson.files.push('!dist/**/e2e.*'); + await fs.writeFile(cliPackagePath, JSON.stringify(packageJson, null, 2)); + echo(chalk.gray(' - Excluded test controller from packages/cli/package.json')); +} + await $`cd ${config.rootDir} && NODE_ENV=production DOCKER_BUILD=true pnpm --filter=n8n --prod --legacy deploy --no-optional ./compiled`; const packageDeployTime = getElapsedTime('package_deploy');