-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[CI] Jest through moon #253279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
[CI] Jest through moon #253279
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
7ab487c
fix jest moon tasks, fix moon configs to make query work
delanni f3bf66c
filter tests before sending up to ci-stats
delanni dd4f2fb
Merge branch 'main' into jest-through-moon
delanni 05e5480
crash when pipeline ts fails to run
delanni ec28178
stop using @kbn/ packages to find dependency tree
delanni 990e0cd
disable runAll functionality, force pre-filtering
delanni 1ff0e1a
fix strategies, modularize
delanni de349cf
add source dependency to jest tasks
delanni 2db6b95
Changes from node scripts/eslint_all_files --no-cache --fix
kibanamachine c2c6f7c
refine affected filtering, and critical paths
delanni 205bdec
Resolve merge conflicts: keep filtered jest configs and moon node tasks
delanni 015810b
move affected filtering to kbn-moon
delanni f8fdbdb
make direct reference to the kbn-moon package
delanni b75f04a
Merge branch 'main' into jest-through-moon
delanni da5b1a7
try to remove dependencies from affected
delanni 192d7e0
try bootstrapping in pipeline.sh
delanni d4a2f57
Apply suggestion from @delanni
delanni b6c050a
fulfill kbn-moon/affected's requirements in .buildkite
delanni 7d086e3
Revert "try bootstrapping in pipeline.sh"
delanni ce6913d
export ts-node properties so all calls will behave similarly
delanni 0313254
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine 84e5a02
Changes from node scripts/eslint_all_files --no-cache --fix
kibanamachine 0984399
try installing tslib
delanni 8d391ce
correct import
delanni 066e876
try directing ts-node to .buildkite
delanni 25de124
Revert "try directing ts-node to .buildkite"
delanni e4ec15f
Revert "correct import"
delanni 229e896
Revert "try installing tslib"
delanni 621a16a
Revert "export ts-node properties so all calls will behave similarly"
delanni 2face6d
Reapply "try bootstrapping in pipeline.sh"
delanni 80d93fc
Revert "fulfill kbn-moon/affected's requirements in .buildkite"
delanni fc2eaef
Revert "Apply suggestion from @delanni"
delanni 27f357a
Revert "try bootstrapping in pipeline.sh"
delanni 313f71c
Revert "try to remove dependencies from affected"
delanni bdba9b5
Revert "make direct reference to the kbn-moon package"
delanni 69c1605
Revert "move affected filtering to kbn-moon"
delanni c412400
adjust code to be closer to the extracted PR version
delanni 6775c52
Merge branch 'main' into jest-through-moon
delanni fcd3a47
add a critical set to run all tests, and a label
delanni 4e6aff7
fix import, use critical files
delanni 99c6128
update affected-packages from the working branch
delanni c397186
disable the critical file check to see the filtering in action
delanni 7aa76b9
add dummy change to trigger a set of changes
delanni 35f15b4
Merge branch 'main' into jest-through-moon
delanni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the "Elastic License | ||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| export const UNCATEGORIZED_MODULE_ID = '[uncategorized]'; | ||
|
|
||
| export const NO_SELECTIVE_TESTS_LABEL = 'ci:no-selective-tests'; | ||
|
|
||
| // TODO: find reasonable set of critical files for unit tests | ||
| export const CRITICAL_FILES_JEST_UNIT_TESTS = [ | ||
| 'scripts/jest.js', | ||
| 'scripts/jest_all.js', | ||
| 'package.json', | ||
| 'yarn.lock', | ||
| 'tsconfig.json', | ||
| 'src/platform/packages/shared/kbn-test/**/*', | ||
| ]; | ||
|
|
||
| // TODO: find reasonable set of critical files for integration tests | ||
| export const CRITICAL_FILES_JEST_INTEGRATION_TESTS = [ | ||
| 'scripts/jest_integration.js', | ||
| 'scripts/jest_all.js', | ||
| 'package.json', | ||
| 'yarn.lock', | ||
| 'tsconfig.json', | ||
| 'src/platform/packages/shared/kbn-test/**/*', | ||
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the "Elastic License | ||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| /** | ||
| * CLI script to list affected packages | ||
| * | ||
| * Usage: | ||
| * .buildkite/scripts/list-affected-packages [options] | ||
| * | ||
| * Options: | ||
| * --deep Include downstream dependencies (default: false) | ||
| * --json Output as JSON array | ||
| * --merge-base Git commit to compare against (default: GITHUB_PR_MERGE_BASE env var or 'main') | ||
| * --strategy Strategy to use: git or moon (default: git) | ||
| * | ||
| * Examples: | ||
| * .buildkite/scripts/list-affected-packages | ||
| * .buildkite/scripts/list-affected-packages --deep | ||
| * .buildkite/scripts/list-affected-packages --deep --json | ||
| * .buildkite/scripts/list-affected-packages --merge-base HEAD~5 | ||
| * .buildkite/scripts/list-affected-packages --strategy moon --deep | ||
| */ | ||
|
|
||
| // Must be before imports to suppress logging | ||
| process.env.AFFECTED_LOGGING = 'false'; | ||
|
|
||
| const path = require('path'); | ||
|
|
||
| // Add the parent directories to the require path so we can load TypeScript via ts-node | ||
| require('ts-node').register({ | ||
| transpileOnly: true, | ||
| compilerOptions: { | ||
| module: 'commonjs', | ||
| }, | ||
| project: path.join(__dirname, '../tsconfig.json'), | ||
| }); | ||
|
|
||
| const affectedPackages = require(path.join(__dirname, '../pipeline-utils/affected-packages')); | ||
| const getAffectedPackages = affectedPackages.getAffectedPackages; | ||
|
|
||
| async function main() { | ||
| const args = process.argv.slice(2); | ||
|
|
||
| // Parse flags | ||
| const flags = { | ||
| deep: args.includes('--deep'), | ||
| json: args.includes('--json'), | ||
| mergeBase: undefined, | ||
| strategy: 'git', | ||
| }; | ||
|
|
||
| // Parse --merge-base value | ||
| const mergeBaseIndex = args.indexOf('--merge-base'); | ||
| if (mergeBaseIndex !== -1 && args[mergeBaseIndex + 1]) { | ||
| flags.mergeBase = args[mergeBaseIndex + 1]; | ||
| } else { | ||
| // Default to GITHUB_PR_MERGE_BASE env var or 'main' | ||
| flags.mergeBase = process.env.GITHUB_PR_MERGE_BASE || 'main'; | ||
| } | ||
|
|
||
| // Parse --strategy value | ||
| const strategyIndex = args.indexOf('--strategy'); | ||
| if (strategyIndex !== -1 && args[strategyIndex + 1]) { | ||
| const strategy = args[strategyIndex + 1]; | ||
| if (strategy !== 'git' && strategy !== 'moon') { | ||
| console.error(`Invalid strategy: ${strategy}. Must be 'git' or 'moon'.`); | ||
| process.exit(1); | ||
| } | ||
| flags.strategy = strategy; | ||
| } | ||
|
|
||
| try { | ||
| // Get affected packages with logging disabled | ||
| const affectedPackages = await getAffectedPackages(flags.mergeBase, { | ||
| strategy: flags.strategy, | ||
| includeDownstream: flags.deep, | ||
| logging: false, | ||
| }); | ||
|
|
||
| const packageList = Array.from(affectedPackages).sort(); | ||
|
|
||
| if (flags.json) { | ||
| // Output as JSON array | ||
| console.log(JSON.stringify(packageList, null, 2)); | ||
| } else { | ||
| // Output one package per line | ||
| packageList.forEach(pkg => console.log(pkg)); | ||
| } | ||
|
|
||
| process.exit(0); | ||
| } catch (error) { | ||
| console.error('Error getting affected packages:', error.message); | ||
| process.exit(1); | ||
| } | ||
| } | ||
|
|
||
| main(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is already in main