Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .buildkite/pipeline-utils/affected-packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,7 @@ const filteredFiles = filterFilesByPackages(
2. Return affected project IDs

**Performance**: ~5-7 seconds

## PR Jest selective testing

On pull request builds, Jest unit and integration test groups are narrowed to configs under affected packages (see `pick_test_group_run_order` in CI stats). Add the GitHub label `ci:prevent-selective-testing` to run the full Jest suite instead. Touching files listed in `CRITICAL_FILES_JEST_*` in `const.ts` also skips filtering for the relevant test type.
2 changes: 1 addition & 1 deletion .buildkite/pipeline-utils/affected-packages/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

export const UNCATEGORIZED_MODULE_ID = '[uncategorized]';

export const SELECTIVE_TESTS_LABEL = 'ci:use-selective-testing';
export const PREVENT_SELECTIVE_TESTS_LABEL = 'ci:prevent-selective-testing';

// Changes here skip affected-package filtering for Jest (full run).
// Keep narrow: global test harness, transforms, CI selection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,20 @@ import {
getAffectedPackages,
listChangedFiles,
filterFilesByPackages,
SELECTIVE_TESTS_LABEL,
PREVENT_SELECTIVE_TESTS_LABEL,
CRITICAL_FILES_JEST_UNIT_TESTS,
touchedCriticalFiles,
CRITICAL_FILES_JEST_INTEGRATION_TESTS,
} from '../affected-packages';
import { collectEnvFromLabels, expandAgentQueue, getRequiredEnv } from '#pipeline-utils';

// TODO: this is always false on on-merge, when switching to enable this by default, check if this is a PR
const USE_SELECTIVE_TESTING = process.env.GITHUB_PR_LABELS?.includes(SELECTIVE_TESTS_LABEL);
const prLabels =
process.env.GITHUB_PR_LABELS?.split(',')
.map((l) => l.trim())
.filter(Boolean) ?? [];
const isPrBuild = Boolean(process.env.GITHUB_PR_NUMBER);
const preventSelectiveTesting = prLabels.includes(PREVENT_SELECTIVE_TESTS_LABEL);
const USE_SELECTIVE_TESTING = isPrBuild && !preventSelectiveTesting;

const SHARD_ANNOTATION_SEP = '||shard=';
/**
Expand Down
Loading