Skip to content

feat(ci): implement sharding for unit test performance - #9021

Merged
bshaffer merged 20 commits into
mainfrom
improve-test-performance
Aug 12, 2026
Merged

feat(ci): implement sharding for unit test performance#9021
bshaffer merged 20 commits into
mainfrom
improve-test-performance

Conversation

@bshaffer

@bshaffer bshaffer commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

fixes #7540

  • Conditional Test Sharding: Dynamically shards tests when a large number of packages are modified. Adds a job that rolls up shard results to satisfy branch protection. Uses "composite" actions to deduplicate workflow YAML between unit and windows unit tests. For what this looks like with just ONE package modified, see chore: test sharding with one package #9027

  • Run the full unit test suite: Restores triggering the full unit test suite across all packages whenever ci/ scripts change, as sharding now allows running all tests without timing out.

  • Clean CI Logs: Switches Mocha to use dot reporter and removes accidental console.log from the Firestore conformance tests.

NOTE: These tests run in about ~12min per shard (as compared to 25-30) once we migrate to a PNPM Workspace #8973

Comment thread ci/run_conditional_tests.sh Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request parallelizes test execution and adds sharding support in the CI conditional test runner, configures the Mocha reporter and silences pnpm installation in the single test runner, and updates mock discovery URLs in the googleapis-common tests. A critical syntax error was identified in the conditional test runner script, where leftover loop and conditional control structures will cause the Bash script to fail.

Comment thread ci/run_conditional_tests.sh Outdated
@bshaffer
bshaffer marked this pull request as ready for review July 30, 2026 15:12
@bshaffer
bshaffer requested review from a team as code owners July 30, 2026 15:12
@bshaffer bshaffer changed the title feat(ci): improve test performance feat(ci): improve test performance, fix failing tests Jul 30, 2026
@bshaffer

Copy link
Copy Markdown
Contributor Author

@gemini-code-assist review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces test sharding and dynamic matrix generation for GitHub Actions in the CI scripts, updates pnpm install flags, and transitions from the deprecated url.parse to the standard URL API. Additionally, it increases test timeouts, skips certain tests on Windows, handles nested error causes in gcp-metadata, and ensures startTime does not exceed endTime in Bigtable metrics. Feedback focuses on improving shell script robustness by quoting variables (BUILD_TYPE, d, and test_script) to prevent syntax or word-splitting issues, and avoiding direct mutation of the options parameter in the OpenTelemetry test stub.

Comment thread ci/run_conditional_tests.sh Outdated
Comment thread ci/run_conditional_tests.sh Outdated
Comment thread handwritten/bigtable/test/metrics-collector/gcp-metrics-handler.ts

@westarle westarle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A few comments, I think this is a really great idea!

Comment thread ci/run_conditional_tests.sh
Comment thread ci/run_conditional_tests.sh Outdated
Comment thread handwritten/bigtable/protos/protos.js Outdated
Comment thread .github/workflows/presubmit.yaml Outdated
Comment thread core/dev-packages/pack-n-play/test/test.ts Outdated
Comment thread ci/run_single_test.sh Outdated

@westarle westarle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, would you be OK with breaking the test fixes out to their own little PRs?

@bshaffer bshaffer changed the title feat(ci): improve test performance, fix failing tests feat(ci): improve test performance Jul 31, 2026
@bshaffer
bshaffer force-pushed the improve-test-performance branch 2 times, most recently from 0e8030b to 8015ceb Compare August 1, 2026 22:40
@bshaffer
bshaffer requested a review from a team as a code owner August 3, 2026 19:43
@bshaffer
bshaffer force-pushed the improve-test-performance branch from 657c33a to f18b9c1 Compare August 4, 2026 00:11
@bshaffer bshaffer changed the title feat(ci): improve test performance feat(ci): implement sharding for unit test performance Aug 4, 2026
chore(ci): reduce unit-test output due to log truncation
chore: run all ci tests
@bshaffer
bshaffer force-pushed the improve-test-performance branch from f18b9c1 to 66743ae Compare August 4, 2026 17:05
Comment thread .github/actions/check-shard-status/action.yaml Outdated
Comment thread .pnpmfile.cjs
Comment thread .github/workflows/presubmit.yaml Outdated
Comment thread ci/run_conditional_tests.sh Outdated
Comment thread .github/actions/check-shard-status/action.yaml Outdated
@bshaffer
bshaffer merged commit 1d977b5 into main Aug 12, 2026
72 checks passed
@bshaffer
bshaffer deleted the improve-test-performance branch August 12, 2026 06:46
@release-please release-please Bot mentioned this pull request Aug 11, 2026
shivanee-p pushed a commit that referenced this pull request Aug 12, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>pack-n-play: 5.1.0</summary>

##
[5.1.0](pack-n-play-v5.0.1...pack-n-play-v5.1.0)
(2026-08-12)


### Features

* **ci:** Implement sharding for unit test performance
([#9021](#9021))
([1d977b5](1d977b5))
</details>

<details><summary>gapic-generator: 5.0.1</summary>

##
[5.0.1](gapic-generator-v5.0.0...gapic-generator-v5.0.1)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>gapic-node-processing: 0.2.2</summary>

##
[0.2.2](gapic-node-processing-v0.2.1...gapic-node-processing-v0.2.2)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>google-gax: 6.0.2</summary>

##
[6.0.2](google-gax-v6.0.1...google-gax-v6.0.2)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>gaxios: 7.3.1</summary>

##
[7.3.1](gaxios-v7.3.0...gaxios-v7.3.1)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>gcp-metadata: 9.0.3</summary>

##
[9.0.3](gcp-metadata-v9.0.2...gcp-metadata-v9.0.3)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>google-auth-library: 11.0.2</summary>

##
[11.0.2](google-auth-library-v11.0.1...google-auth-library-v11.0.2)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>googleapis-common: 9.0.3</summary>

##
[9.0.3](googleapis-common-v9.0.2...googleapis-common-v9.0.3)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>proto3-json-serializer: 4.0.2</summary>

##
[4.0.2](proto3-json-serializer-v4.0.1...proto3-json-serializer-v4.0.2)
(2026-08-12)


### Bug Fixes

* **docs:** Add correct homepage URL in
/core/packages/proto3-json-serializer-nodejs
([#9131](#9131))
([b57db40](b57db40))
</details>

<details><summary>bigquery: 9.0.2</summary>

##
[9.0.2](bigquery-v9.0.1...bigquery-v9.0.2)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>bigquery-storage: 6.0.1</summary>

##
[6.0.1](bigquery-storage-v6.0.0...bigquery-storage-v6.0.1)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>bigtable: 7.2.0</summary>

##
[7.2.0](bigtable-v7.1.0...bigtable-v7.2.0)
(2026-08-12)


### Features

* **ci:** Implement sharding for unit test performance
([#9021](#9021))
([1d977b5](1d977b5))


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>cloud-profiler: 8.0.1</summary>

##
[8.0.1](cloud-profiler-v8.0.0...cloud-profiler-v8.0.1)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>datastore: 11.0.1</summary>

##
[11.0.1](datastore-v11.0.0...datastore-v11.0.1)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>error-reporting: 4.0.1</summary>

##
[4.0.1](error-reporting-v4.0.0...error-reporting-v4.0.1)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>dns: 6.0.1</summary>

##
[6.0.1](dns-v6.0.0...dns-v6.0.1)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>logging: 12.0.1</summary>

##
[12.0.1](logging-v12.0.0...logging-v12.0.1)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>logging-bunyan: 6.0.1</summary>

##
[6.0.1](logging-bunyan-v6.0.0...logging-bunyan-v6.0.1)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>logging-winston: 7.0.1</summary>

##
[7.0.1](logging-winston-v7.0.0...logging-winston-v7.0.1)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
</details>

<details><summary>pubsub: 6.0.1</summary>

##
[6.0.1](pubsub-v6.0.0...pubsub-v6.0.1)
(2026-08-12)


### Bug Fixes

* Ensure node 22 dependencies are up to date so they get the latest
patches for core and handwritten libraries
([#9116](#9116))
([fad57ff](fad57ff))
* **pubsub:** Upgrade @opentelemetry/core to ^2.8.0 to resolve
CVE-2026-54285
([#8792](#8792))
([#9092](#9092))
([004850f](004850f))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reenable test-all when CI scripts change

2 participants