ci: Run DB migration tests only when a migration-relevant path changes (#37518)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Charlie Kolb 2026-09-07 08:51:01 +00:00 committed by GitHub
parent 2e78aacef3
commit eef87db07b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 1 deletions

View File

@ -27,6 +27,7 @@ jobs:
workflows: ${{ fromJSON(steps.ci-filter.outputs.results).workflows == true }}
workflow_scripts: ${{ fromJSON(steps.ci-filter.outputs.results)['workflow-scripts'] == true }}
db: ${{ fromJSON(steps.ci-filter.outputs.results).db == true }}
db_migrations: ${{ fromJSON(steps.ci-filter.outputs.results)['db-migrations'] == true }}
e2e_performance: ${{ fromJSON(steps.ci-filter.outputs.results)['e2e-performance'] == true }}
instance_ai_workflow_eval: ${{ fromJSON(steps.ci-filter.outputs.results)['instance-ai-workflow-eval'] == true }}
commit_sha: ${{ steps.commit-sha.outputs.sha }}
@ -163,6 +164,23 @@ jobs:
docs/generated/**
.tbls.sqlite.yml
.tbls.postgres.yml
# Sub-filter of db. Lists the paths that can change a migration
# test result. Gates the migration step inside each DB matrix leg.
db-migrations:
packages/@n8n/db/**
packages/@n8n/backend-test-utils/**
packages/cli/test/migration/**
packages/cli/test/shared/db/**
packages/cli/test/setup-testcontainers.js
packages/cli/test/teardown-testcontainers.js
packages/cli/vitest.config.base.ts
packages/cli/vitest.config.migration.ts
packages/cli/vitest.config.migration.testcontainers.ts
packages/testing/containers/services/postgres.ts
packages/testing/containers/postgres-versions.json
packages/testing/containers/test-containers.ts
.github/workflows/test-db-reusable.yml
.github/scripts/db-test-matrix.mjs
- name: Setup and Build
if: fromJSON(steps.ci-filter.outputs.results).ci || fromJSON(steps.ci-filter.outputs.results).e2e
@ -327,6 +345,7 @@ jobs:
with:
ref: ${{ needs.install-and-build.outputs.commit_sha }}
matrix: ${{ needs.install-and-build.outputs.db_test_matrix }}
run-migrations: ${{ needs.install-and-build.outputs.db_migrations == 'true' }}
e2e-performance:
name: E2E Performance

View File

@ -11,6 +11,11 @@ on:
description: 'Job matrix JSON, from .github/scripts/db-test-matrix.mjs.'
required: true
type: string
run-migrations:
description: 'Run the migration test step in each leg. The caller turns this off when no migration-relevant path changed.'
required: false
type: boolean
default: true
env:
NODE_OPTIONS: '--max-old-space-size=6144'
@ -43,7 +48,7 @@ jobs:
run: ${{ matrix.test-cmd }}
- name: Run Migration Tests
if: matrix.migration-cmd != ''
if: matrix.migration-cmd != '' && inputs.run-migrations
working-directory: packages/cli
run: ${{ matrix.migration-cmd }}