diff --git a/.github/workflows/ci-pull-requests.yml b/.github/workflows/ci-pull-requests.yml index 877c65b18e5..6a810d2753e 100644 --- a/.github/workflows/ci-pull-requests.yml +++ b/.github/workflows/ci-pull-requests.yml @@ -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 diff --git a/.github/workflows/test-db-reusable.yml b/.github/workflows/test-db-reusable.yml index 767caf3371e..9b74e7e2d04 100644 --- a/.github/workflows/test-db-reusable.yml +++ b/.github/workflows/test-db-reusable.yml @@ -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 }}