-
Notifications
You must be signed in to change notification settings - Fork 13k
ci(evals): only run evals in CI if prompts or tools changed #20898
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
90d0ea0
ci(evals): only run evals if prompts or tools changed
gundermanc 4462dbb
refactor(ci): clean up check_evals_trigger.js
gundermanc 4e18959
ci(evals): add error logging to trigger script
gundermanc 31cd47f
ci(evals): use origin remote for trigger check
gundermanc 95a49be
ci(evals): rename script and fix yamllint errors
gundermanc 3be302a
Update scripts/changed_prompt.js
gundermanc 37726d9
PR feedback.
gundermanc 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,47 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2026 Google LLC | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| import { execSync } from 'node:child_process'; | ||
|
|
||
| const EVALS_FILE_PREFIXES = [ | ||
| 'packages/core/src/prompts/', | ||
| 'packages/core/src/tools/', | ||
| ]; | ||
|
|
||
| function main() { | ||
| try { | ||
| // Fetch main branch from origin. | ||
| execSync('git fetch origin main', { | ||
| stdio: 'ignore', | ||
| }); | ||
gundermanc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Find the merge base with main | ||
|
||
| const mergeBase = execSync('git merge-base HEAD FETCH_HEAD', { | ||
| encoding: 'utf-8', | ||
| }).trim(); | ||
|
|
||
| // Get changed files | ||
| const changedFiles = execSync(`git diff --name-only ${mergeBase} HEAD`, { | ||
| encoding: 'utf-8', | ||
| }) | ||
| .split('\n') | ||
| .filter(Boolean); | ||
|
|
||
| const shouldRun = changedFiles.some((file) => | ||
| EVALS_FILE_PREFIXES.some((prefix) => file.startsWith(prefix)), | ||
| ); | ||
|
|
||
| console.log(shouldRun ? 'true' : 'false'); | ||
| } catch (error) { | ||
| // If anything fails (e.g., no git history), run evals to be safe | ||
| console.warn( | ||
| 'Warning: Failed to determine if evals should run. Defaulting to true.', | ||
| ); | ||
| console.error(error); | ||
| console.log('true'); | ||
| } | ||
| } | ||
|
|
||
| main(); | ||
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.
consider adding the evals/ directory too
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.
Ok, added. Note that as written, only the ALWAYS_PASSES evals will end up getting run during the CI. Breaking changes to USUALLY_PASSES ones will not.
I guess we could make it smart enough to compute the delta, but I'd rather aspire to stabilizing as many tests as possible and running them during the CI by default.