Skip to content

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

Draft
lqiu96 wants to merge 13 commits into
mainfrom
optimize_ci_test_duration
Draft

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

Conversation

@lqiu96

@lqiu96 lqiu96 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Description

This PR optimizes CI execution duration and developer build times across the google-cloud-java monorepo by compiling generated GAPIC modules without running redundant mock unit tests.

Motivation & Context

  • Generated Mock Tests Add No Marginal Value: Pure GAPIC-generated clients contain auto-generated test suites (e.g. AppConnectionsServiceClientTest) that test template echo/mock behavior against an in-process dummy server rather than handwritten business logic.
  • Coverage Already Provided Elsewhere:
    • java-showcase (showcase.yaml) comprehensively tests the GAPIC generator templates and GAX runtime across all RPC styles, features, and HTTP/JSON transcoding.
    • split-units tests all handwritten and split libraries (google-auth-library-java, java-storage, java-bigquery, java-spanner, gax-java, etc.).
    • enforcer and gapic-libraries-bom validate build integrity and dependency convergence.
  • CI Bottleneck: Executing 20,000+ mock tests across ~240+ generated libraries on matrix Java versions took 40+ minutes per CI run. Switching to parallel compilation (mvn compile -T 1C) reduces full-repo validation to ~2 minutes.

Summary of Changes

  1. Default Test Skipping for GAPICs (google-cloud-jar-parent/pom.xml):
    • Set <skipUnitTests>true</skipUnitTests> and <maven.test.skip>${skipUnitTests}</maven.test.skip> in google-cloud-jar-parent/pom.xml so pure GAPIC generated unit tests are skipped by default.
    • Handwritten libraries (java-storage, java-spanner, java-bigquery, java-bigtable, java-firestore, java-pubsub, java-logging, java-datastore, java-dns, etc.) explicitly override <skipUnitTests>false</skipUnitTests> so their unit tests always run.
    • -Penable-integration-tests sets <maven.test.skip>false</maven.test.skip> so integration tests continue to run as expected.
  2. Foundational Platform Modules (sdk-platform-java/gapic-generator-java-pom-parent/pom.xml):
    • Explicitly sets <skipUnitTests>false</skipUnitTests> so core handwritten modules (gax-java, gapic-generator-java, java-core) always execute their test suites.
  3. Dynamic Kokoro Build Goal (.kokoro/build.sh):
    • In JOB_TYPE: test, dynamically selects MAVEN_GOAL="compile" when BUILD_SUBDIR is empty (monorepo run), and MAVEN_GOAL="test" when BUILD_SUBDIR is set (handwritten/split module run).
    • Added -T 1C for parallel CPU core compilation.
  4. CI Workflow & Required Checks Compatibility (.github/workflows/ci.yaml):
    • Preserves all configured GitHub status check names (units (11), units (17), units (21), units (25), units (26), units (8), windows).
    • Renamed the filter job from bulk-filter to generated-libraries-filter for clarity.
  5. Kokoro Dependencies (.kokoro/common.sh):
    • Added grpc-gcp-java to always_install_deps_list.

- 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 11 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
@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.

1 participant