Skip to content

Conversation

wzieba
Copy link
Contributor

@wzieba wzieba commented Oct 6, 2025

Closes: AINFRA-1369: Merge unit tests into a single Buildkite job in WordPress/Jetpack Android

Description

This PR merges 5 separate unit tests Buildkite jobs into one.

Before After
Screenshot 2025-10-07 at 10 46 06 Screenshot 2025-10-07 at 10 46 24

Motivation

What motivated me to propose this change:

  1. Resources: with 5 separate jobs, we allocate a BK runner that builds modules from the ground just to run a few seconds of unit tests. With 1 job, we build the app once. It's especially visible when running tests on WordPress module, which builds all submodules but runs only WordPress unit tests.
  2. No significant performance regression: The signle unit tests step will still be shorter than the longest step of the pipeline (UI tests). So overall PR checks job won't be longer. It's true, that unit tests step on its own will be longer, but this is a very small (few seconds) difference.
  3. Single report: With single Buildkite step, we also gain a single Buildkite Test Engine report (example). This is better, because if we look for flaky or long unit tests, there's no benefit to look for them in 5 different "test suites".
  4. Easier automation: Lastly, this change was motivated by the work on integrating Buildkite Claude plugin. It's easier to design automations if there's one trigger, rather than 5 of them.

Testing instructions

  1. Test reports: On this PR checks, verify that you can see 6373 tests in Test Engine (button in top-right corner of logs)
  2. Code coverage reports: See that code coverage wasn't changed meaningfully by this PR (a slight change comes from the fact it's outdated branch). To double check, see in Buildkite logs that 5 reports have been uploaded to Codecov
  3. Failed tests report: Open PR [DNM] Unit tests in single job failure #22263. Verify, that tests have been reported to Test Engine, even though one of them failed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Oct 6, 2025

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr22259-454737c
Commit454737c
Direct Downloadwordpress-prototype-build-pr22259-454737c.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Oct 6, 2025

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr22259-454737c
Commit454737c
Direct Downloadjetpack-prototype-build-pr22259-454737c.apk
Note: Google Login is not supported on these builds.

Copy link

codecov bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.89%. Comparing base (33d22f3) to head (454737c).
⚠️ Report is 6 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22259      +/-   ##
==========================================
- Coverage   39.91%   39.89%   -0.03%     
==========================================
  Files        2165     2165              
  Lines      102511   102560      +49     
  Branches    14771    14791      +20     
==========================================
- Hits        40922    40920       -2     
- Misses      58122    58171      +49     
- Partials     3467     3469       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wzieba wzieba requested a review from ParaskP7 October 7, 2025 11:29
@wzieba wzieba marked this pull request as ready for review October 7, 2025 11:29
@wzieba wzieba added this to the 26.3 milestone Oct 7, 2025
@wzieba wzieba added the internal label Oct 7, 2025
@ParaskP7 ParaskP7 requested a review from Copilot October 8, 2025 09:33
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR consolidates five separate Buildkite unit test jobs into a single job to improve resource efficiency and simplify CI pipeline management. The change reduces build overhead by running all unit tests in one job instead of building modules separately for each test suite.

Key changes:

  • Merged WordPress, processors, image-editor, fluxc, and login unit test jobs into one
  • Updated test collection and reporting to handle multiple modules in a single job
  • Modified code coverage upload to handle multiple coverage reports simultaneously

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.buildkite/pipeline.yml Consolidated 5 separate unit test jobs into single job configuration
.buildkite/commands/run-unit-tests.sh Refactored script to run all unit tests together and collect results from multiple modules
.buildkite/commands/upload-code-coverage.sh Enhanced to upload multiple coverage files in one execution

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ParaskP7
Copy link
Contributor

ParaskP7 commented Oct 8, 2025

FYI @wzieba that we might want to add post-merge instructions to not forget to remove these 3 pending and soon-to-be outdated checks...

image

...from within branch protections rules of this repo:

image

Copy link
Contributor

@ParaskP7 ParaskP7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done @wzieba , much better and we gain so much out of this change, awesome! ❤️ 🚀

What motivated me to propose this change:

💯 🎯 🥇

Test reports: On this PR checks, verify that you can see 6373 tests in Test Engine (button in top-right corner of logs)

image

Code coverage reports: See that code coverage wasn't changed meaningfully by this PR (a slight change comes from the fact it's outdated branch). To double check, see in Buildkite logs that 5 reports have been uploaded to Codecov

image

Failed tests report: Open PR #22263. Verify, that tests have been reported to Test Engine, even though one of them failed.

image image

results_file="$test_results_dir/merged-test-results.xml"
if [[ "$TESTS_EXIT_STATUS" -eq 0 ]]; then
echo "--- ⚒️ Uploading code coverage"
# Find all kover XML reports and upload them
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

temp_test_results_dir=$(mktemp -d)

# Define test result directories for each module
declare -A TEST_RESULT_DIRS=(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise (❤️): Love this approach, much thing so much simpler, although, as per my previous comment, it is now harder to make this too dynamic... 💭

done

# Upload all coverage reports in a single execution
./codecov -t "$CODECOV_TOKEN" "${coverage_args[@]}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise (❤️): Nice and TIL! 🥇

@wzieba wzieba modified the milestones: 26.3, 26.4 Oct 8, 2025
Copy link

sonarqubecloud bot commented Oct 8, 2025

@wzieba wzieba enabled auto-merge (squash) October 8, 2025 10:48
@wzieba wzieba merged commit 783d50e into trunk Oct 8, 2025
23 of 24 checks passed
@wzieba wzieba deleted the tests_in_single_job branch October 8, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants