Skip to content

ci: optimize unit test CI runtime and rename bulk filter - #14029

Draft
lqiu96 wants to merge 16 commits into
mainfrom
optimize_ci_test_duration
Draft

ci: optimize unit test CI runtime and rename bulk filter#14029
lqiu96 wants to merge 16 commits into
mainfrom
optimize_ci_test_duration

Conversation

@lqiu96

@lqiu96 lqiu96 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Problem

  • Redundant Generated Mock Tests: Pure GAPIC-generated clients contain thousands of auto-generated mock unit tests that test template echo behavior against in-process mock servers. These tests consume 40+ minutes per matrix CI run across 240+ client libraries.
  • Coverage is Already Provided Elsewhere: Core generator templates and GAX runtime behaviors are already thoroughly tested by java-showcase (showcase.yaml), while business logic in handwritten/split libraries is validated in dedicated split-units jobs.

High-Level Changes

  • Fast Global Monorepo Compile Pass: In .kokoro/build.sh, dynamically runs mvn compile -T 1C for full monorepo CI runs (units matrix jobs), reducing full-repository validation from 40+ minutes to ~2 minutes while keeping all required GitHub status check names.
  • Skip Unit Tests on GAPICs by Default: Configured <skipUnitTests>true</skipUnitTests> in google-cloud-jar-parent/pom.xml to skip surefire execution for generated modules, while preserving test compilation and enabling -Pnative GraalVM test discovery.
  • Preserve Testing for Handwritten & Platform Modules: Explicitly configured <skipUnitTests>false</skipUnitTests> on all 18 handwritten/combo library root POMs (java-storage, java-spanner, java-bigquery, java-bigtable, sdk-platform-java, etc.) so all handwritten unit tests continue to run in split-units.
  • CI Workflow & Script Optimizations: Added cache: maven to split CI jobs in .github/workflows/ci.yaml and multi-threaded execution (-T 1C) in .kokoro/dependencies.sh.

- Rename bulk-filter to generated-libraries-filter in ci.yaml
- Add -T 1C to test execution in build.sh for parallel module builds
- Switch from mvn install to mvn test during test execution to prevent redundant re-packaging and re-installation into local maven repository
@lqiu96
lqiu96 requested review from a team as code owners August 10, 2026 21:21

@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 updates the build script .kokoro/build.sh to run mvn test instead of mvn install and adds the -T 1C flag for parallel execution. The reviewer points out that using mvn test will skip integration tests and verification phases, and suggests using mvn verify instead to ensure all tests are properly executed.

Comment thread .kokoro/build.sh Outdated
@lqiu96
lqiu96 marked this pull request as draft August 10, 2026 21:22
lqiu96 added 12 commits August 10, 2026 21:48
- Update units, units-8-runtime, and windows jobs to only run on push to main
- Keep -T 1C parallel flag and use mvn install in build.sh for full lifecycle compatibility
…it tests

- Add compile case in .kokoro/build.sh to run mvn compile with -T 1C
- Update units, units-8-runtime, and windows CI jobs to run compile instead of running unit tests
- Fix stale bulk-filter references in ci.yaml
- Keep original job names (units (11), units (8), windows, bulk-filter)
- Use JOB_TYPE: compile so jobs run fast compilation without renaming GitHub checks
- Rename filter job to generated-libraries-filter for clarity
- Preserve required job display names for units, units (8), and windows
- Set JOB_TYPE: test in units, units-8-runtime, and windows to leverage dynamic compile goal in build.sh
- Add ignoredUnusedDeclaredDependency for protobuf-java with combine.children=append in maven-dependency-plugin config
- Preserves compile-time classpath required by javac for Struct while satisfying dependency:analyze
- Override skipUnitTests to false in java-logging-logback/pom.xml so test sources compile and run
- Enables dependency:analyze to properly recognize test-scoped dependencies in split-dependencies CI
- Explicitly set skipUnitTests=false in all handwritten library root POMs
- Set skipUnitTests=true in pure generated submodules (firestore-admin, gapic-storage-v2)
- Ensures handwritten unit tests run in split-units and dependencies compile in split-dependencies
- Remove maven.test.skip from google-cloud-jar-parent so test classes compile for dependency:analyze and surefire skip handles execution
- Add cache: maven to split-dependencies and split-clirr in GitHub Actions workflow
- Use mvn test-compile and add -T 1C in dependencies.sh for fast parallel execution
- Add skipUnitTests=false property to native profile in google-cloud-jar-parent and native-image-shared-config
- Ensures Surefire executes client tests during native-image builds to generate test configuration required by native-maven-plugin
@lqiu96 lqiu96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 11, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 11, 2026
…ncies

- Since test classes are compiled and skipUnitTests=false is set, dependency:analyze recognizes test-scoped usages cleanly without custom ignore rules
@lqiu96 lqiu96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 11, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 11, 2026
@lqiu96 lqiu96 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 11, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 11, 2026
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants