-
-
Notifications
You must be signed in to change notification settings - Fork 629
Stop running benchmarks on non-performance PRs; add full-ci-no-benchmarks label #3950
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -80,6 +80,16 @@ jobs: | |||||
| steps: | ||||||
| - uses: actions/checkout@v6 | ||||||
| with: | ||||||
| # On pull_request events GitHub's default checkout ref is the merge | ||||||
| # commit (PR merged into the CURRENT main). Diffing that against the | ||||||
| # PR's recorded base.sha — which is main as of PR creation and can lag | ||||||
| # several commits — sweeps in every change merged to main in between, | ||||||
| # miscategorizing an unrelated runtime/JS change onto a CI-only PR and | ||||||
| # firing benchmarks spuriously (#3919: a bin/-only PR ran all four | ||||||
| # suites because eight intervening main commits leaked into the diff). | ||||||
| # Check out the PR head SHA instead so change detection sees only the | ||||||
| # PR's own commits. On push, this falls back to the pushed SHA. | ||||||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The existing comment explains the SHA drift problem well, but it could also note that checking out the fork's head SHA is safe because the benchmark jobs themselves are gated by the
Suggested change
Consider appending to the comment block above: "Fork safety: even if a fork modifies |
||||||
| fetch-depth: 50 | ||||||
|
Comment on lines
+92
to
93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With |
||||||
| persist-credentials: false | ||||||
| - name: Read runtime versions | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -366,6 +366,42 @@ test_node_renderer_source_change_runs_node_renderer_benchmark() { | |||||||||
| assert_contains "$out" '"run_core_benchmarks": false' "node renderer output" | ||||||||||
| } | ||||||||||
|
|
||||||||||
| # An uncategorized file (e.g. a new CI/tooling dotfile like .ci-dependency-versions, | ||||||||||
| # the #3855 case) runs the full TEST suite for safety, but must NOT benchmark: | ||||||||||
| # unknown files are almost always tooling, not a hot runtime path, so a Bencher | ||||||||||
| # run here is pure noise. Main pushes benchmark unconditionally, so a genuinely | ||||||||||
| # new runtime path is still measured once it lands. | ||||||||||
| test_uncategorized_file_runs_tests_but_skips_benchmarks() { | ||||||||||
| setup_repo | ||||||||||
| write_file_change ".ci-dependency-versions" "ruby: 3.2" | ||||||||||
|
|
||||||||||
| local out | ||||||||||
| out="$(detector_output)" | ||||||||||
| assert_contains "$out" '"non_runtime_only": false' "uncategorized output" | ||||||||||
| # Full test suite still runs (the safety the catch-all is there for). | ||||||||||
| assert_contains "$out" '"run_ruby_tests": true' "uncategorized output" | ||||||||||
| assert_contains "$out" '"run_pro_tests": true' "uncategorized output" | ||||||||||
| # ... but no benchmark suite. | ||||||||||
| assert_contains "$out" '"run_core_benchmarks": false' "uncategorized output" | ||||||||||
| assert_contains "$out" '"run_pro_benchmarks": false' "uncategorized output" | ||||||||||
| assert_contains "$out" '"run_pro_node_renderer_benchmarks": false' "uncategorized output" | ||||||||||
| } | ||||||||||
|
|
||||||||||
| # Spec-only changes run the gem tests but never benchmark: specs are not shipped, | ||||||||||
| # so they cannot move runtime performance (#3854 changed only CI-config specs yet | ||||||||||
| # ran the core+pro suites). | ||||||||||
| test_rspec_only_change_skips_benchmarks() { | ||||||||||
| setup_repo | ||||||||||
| write_file_change "react_on_rails/spec/react_on_rails/some_bench_spec.rb" | ||||||||||
|
|
||||||||||
| local out | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test doesn't assert the
Suggested change
(Adjust |
||||||||||
| out="$(detector_output)" | ||||||||||
| assert_contains "$out" '"run_ruby_tests": true' "rspec-bench output" | ||||||||||
| assert_contains "$out" '"run_core_benchmarks": false' "rspec-bench output" | ||||||||||
| assert_contains "$out" '"run_pro_benchmarks": false' "rspec-bench output" | ||||||||||
| assert_contains "$out" '"run_pro_node_renderer_benchmarks": false' "rspec-bench output" | ||||||||||
| } | ||||||||||
|
|
||||||||||
| test_ruby_comment_only_change_skips_heavy_tests_but_keeps_lint() { | ||||||||||
| setup_repo | ||||||||||
| perl -0pi -e 's/class Example/class Example\n # Explain the fixture./' \ | ||||||||||
|
|
@@ -798,6 +834,8 @@ run_test test_ci_infrastructure_only_change_runs_tests_but_skips_benchmarks | |||||||||
| run_test test_suite_workflow_file_runs_its_tests_but_no_benchmark | ||||||||||
| run_test test_ci_infra_plus_runtime_source_still_benchmarks | ||||||||||
| run_test test_node_renderer_source_change_runs_node_renderer_benchmark | ||||||||||
| run_test test_uncategorized_file_runs_tests_but_skips_benchmarks | ||||||||||
| run_test test_rspec_only_change_skips_benchmarks | ||||||||||
| run_test test_ruby_comment_only_change_skips_heavy_tests_but_keeps_lint | ||||||||||
| run_test test_ruby_block_comment_only_change_skips_heavy_tests_but_keeps_lint | ||||||||||
| run_test test_wrapping_ruby_code_with_block_comment_delimiters_remains_runtime_affecting | ||||||||||
|
|
||||||||||
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.
On fork PRs with more than 50 commits since the base, checking out only
pull_request.head.shaleaves the PR side shallow and not deepen-able byscript/lib/git-diff-base: that helper tries to deepen the current side by fetchingGITHUB_HEAD_REFfromorigin, but in this workfloworiginis the base repository, where fork branches usually do not exist. In that scenarioscript/ci-changes-detectorcannot find a merge base and the benchmark workflow fails before it can emit the empty fork matrix, even though fork PRs are supposed to skip benchmark suites.Useful? React with 👍 / 👎.