diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dcfee90a4f3e..19f44acf2584 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,8 +23,8 @@ on: pull_request: name: ci jobs: - # detect whether or note we should run "bulk" (non-handwritten) unit tests - bulk-filter: + # detect whether or not we should run generated (non-handwritten) unit tests + generated-libraries-filter: runs-on: ubuntu-latest permissions: pull-requests: read @@ -57,10 +57,11 @@ jobs: ci: - '.github/workflows/ci.yaml' - '.kokoro/**' - # these unit tests are "bulk" (non-handwritten) libraries + # compile all modules across supported Java versions units: runs-on: ubuntu-latest - needs: bulk-filter + needs: generated-libraries-filter + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} strategy: fail-fast: false matrix: @@ -68,76 +69,71 @@ jobs: steps: - name: Get current week within the year id: date - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} run: echo "::set-output name=week_of_year::$(date +'%W' --utc)" - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} with: persist-credentials: false - uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0 - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} with: distribution: temurin java-version: ${{matrix.java}} - run: java -version - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 id: mvn-cache - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} with: path: ~/.m2/repository key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }} - run: .kokoro/build.sh - if: ${{ needs.bulk-filter.outputs.runnable == 'true' && (needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true') }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' && (needs.generated-libraries-filter.outputs.src == 'true' || needs.generated-libraries-filter.outputs.ci == 'true') }} env: JOB_TYPE: test JOB_NAME: units-${{matrix.java}} units-8-runtime: runs-on: ubuntu-latest - needs: bulk-filter + needs: generated-libraries-filter + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} name: "units (8)" steps: - name: Get current week within the year id: date - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} run: echo "::set-output name=week_of_year::$(date +'%W' --utc)" - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} with: persist-credentials: false - uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0 - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} with: java-version: 8 distribution: temurin - - name: "Set jvm system property environment variable for surefire plugin (unit tests)" - # Maven surefire plugin (unit tests) allows us to specify JVM to run the tests. - # https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} - run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV - shell: bash - uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0 - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} with: java-version: 11 distribution: temurin cache: maven - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 id: mvn-cache - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} with: path: ~/.m2/repository key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }} - run: .kokoro/build.sh - if: ${{ needs.bulk-filter.outputs.runnable == 'true' && (needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true') }} + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' && (needs.generated-libraries-filter.outputs.src == 'true' || needs.generated-libraries-filter.outputs.ci == 'true') }} shell: bash env: JOB_TYPE: test JOB_NAME: units-8-runtime-${{matrix.java}} # detect which libraries have changed changes: - needs: bulk-filter - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + needs: generated-libraries-filter + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest permissions: pull-requests: read @@ -353,6 +349,7 @@ jobs: with: distribution: temurin java-version: 11 + cache: maven - run: .kokoro/build.sh env: BUILD_SUBDIR: ${{matrix.package}} @@ -372,11 +369,12 @@ jobs: with: distribution: temurin java-version: 17 + cache: maven - run: .kokoro/dependencies.sh env: BUILD_SUBDIR: ${{matrix.package}} required: - needs: [ bulk-filter, changes, split-units, split-clirr, split-dependencies ] + needs: [ generated-libraries-filter, changes, split-units, split-clirr, split-dependencies ] name: conditional-required-check if: ${{ always() }} # Always run even if any "needs" jobs fail runs-on: ubuntu-22.04 @@ -387,8 +385,8 @@ jobs: - name: Success otherwise run: echo "Success!" windows: - needs: bulk-filter - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + needs: generated-libraries-filter + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} runs-on: windows-latest steps: - name: Support longpaths @@ -407,8 +405,8 @@ jobs: JOB_TYPE: test JOB_NAME: windows-units lint: - needs: bulk-filter - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + needs: generated-libraries-filter + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 @@ -426,8 +424,8 @@ jobs: HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} enforcer: - needs: bulk-filter - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + needs: generated-libraries-filter + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest steps: - name: Get current week within the year @@ -449,8 +447,8 @@ jobs: - run: java -version - run: mvn -B -ntp enforcer:enforce@enforce -T 1C gapic-libraries-bom: - needs: bulk-filter - if: ${{ needs.bulk-filter.outputs.runnable == 'true' }} + needs: generated-libraries-filter + if: ${{ needs.generated-libraries-filter.outputs.runnable == 'true' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 92e714cb451e..85ffe13759f4 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -37,27 +37,28 @@ RETURN_CODE=0 case ${JOB_TYPE} in test) + MAVEN_GOAL="test" if [[ -n "${BUILD_SUBDIR}" ]] then echo "Compiling and building all modules for ${BUILD_SUBDIR}" install_modules "${BUILD_SUBDIR}" echo "Running in subdir: ${BUILD_SUBDIR}" pushd "${BUILD_SUBDIR}" - EXTRA_PROFILE_OPTS=() else - EXTRA_PROFILE_OPTS=("-PbulkTests") - install_modules "sdk-platform-java" + # These are pure GAPIC-generated modules with no unit tests to run here; Showcase + # integration tests already cover the generated code's behavior, so this pass only + # needs to confirm everything compiles. + MAVEN_GOAL="compile" fi - echo "SUREFIRE_JVM_OPT: ${SUREFIRE_JVM_OPT}" + echo "MAVEN_GOAL: ${MAVEN_GOAL}" retry_with_backoff 3 10 \ - mvn install \ + mvn ${MAVEN_GOAL} \ -B -ntp \ -Pquick-build \ -Dorg.slf4j.simpleLogger.showDateTime=true \ -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \ -Dmaven.wagon.http.retryHandler.count=5 \ - --also-make \ - ${SUREFIRE_JVM_OPT} "${EXTRA_PROFILE_OPTS[@]}" + -T 1C RETURN_CODE=$? if [[ -n "${BUILD_SUBDIR}" ]] @@ -67,6 +68,31 @@ case ${JOB_TYPE} in fi echo "Finished running unit tests" ;; + compile) + if [[ -n "${BUILD_SUBDIR}" ]] + then + echo "Compiling all modules for ${BUILD_SUBDIR}" + mvn compile \ + -B -ntp \ + -Pquick-build \ + -Dorg.slf4j.simpleLogger.showDateTime=true \ + -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \ + -Dmaven.wagon.http.retryHandler.count=5 \ + --projects "${BUILD_SUBDIR}" \ + --also-make \ + -T 1C + else + echo "Compiling all modules in repository" + mvn compile \ + -B -ntp \ + -Pquick-build \ + -Dorg.slf4j.simpleLogger.showDateTime=true \ + -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \ + -Dmaven.wagon.http.retryHandler.count=5 \ + -T 1C + fi + RETURN_CODE=$? + ;; install) if [[ -n "${BUILD_SUBDIR}" ]] then diff --git a/.kokoro/common.sh b/.kokoro/common.sh index 9a56b378131a..26de64791fc2 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -416,6 +416,7 @@ function install_modules() { printf "Installing submodules:\n%s\n" "$all_submodules" always_install_deps_list=( + 'grpc-gcp-java' 'java-monitoring/google-cloud-monitoring' 'java-monitoring/google-cloud-monitoring-bom' 'java-kms/google-cloud-kms' diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh index f341016b5033..4b0c0edcf1f8 100755 --- a/.kokoro/dependencies.sh +++ b/.kokoro/dependencies.sh @@ -56,11 +56,11 @@ then pushd "${BUILD_SUBDIR}" fi -# this should run maven enforcer -mvn install -B -V -ntp \ - -Pquick-build -DskipTests=true -Dmaven.javadoc.skip=true -Denforcer.skip=false +# this should run maven enforcer and compile test dependencies +mvn test-compile -B -V -ntp \ + -Pquick-build -DskipTests=true -Dmaven.javadoc.skip=true -Denforcer.skip=false -T 1C -mvn -B dependency:analyze -Pquick-build -DfailOnWarning=true -Dmdep.analyze.skip=false +mvn -B dependency:analyze -Pquick-build -DfailOnWarning=true -Dmdep.analyze.skip=false -T 1C if [[ -n "${BUILD_SUBDIR}" ]] then diff --git a/google-cloud-jar-parent/pom.xml b/google-cloud-jar-parent/pom.xml index b1e26861cab0..d07276a83d6b 100644 --- a/google-cloud-jar-parent/pom.xml +++ b/google-cloud-jar-parent/pom.xml @@ -19,7 +19,16 @@ ../google-cloud-pom-parent/pom.xml - false + + true true @@ -197,6 +206,13 @@ + + + native + + false + + diff --git a/java-bigquery-jdbc/pom.xml b/java-bigquery-jdbc/pom.xml index 24bd9b89eec9..6bf17a80d920 100644 --- a/java-bigquery-jdbc/pom.xml +++ b/java-bigquery-jdbc/pom.xml @@ -27,6 +27,7 @@ JDBC for BigQuery + false UTF-8 UTF-8 github diff --git a/java-bigquery/pom.xml b/java-bigquery/pom.xml index ee1fcd22dfc8..dbdd5b097703 100644 --- a/java-bigquery/pom.xml +++ b/java-bigquery/pom.xml @@ -51,6 +51,7 @@ + false UTF-8 UTF-8 github diff --git a/java-bigquerystorage/pom.xml b/java-bigquerystorage/pom.xml index 5eee00a606fb..72730f284ccb 100644 --- a/java-bigquerystorage/pom.xml +++ b/java-bigquerystorage/pom.xml @@ -51,6 +51,7 @@ + false UTF-8 UTF-8 3.25.4 diff --git a/java-bigtable/pom.xml b/java-bigtable/pom.xml index c6bd75e5f4f7..828dc7af906d 100644 --- a/java-bigtable/pom.xml +++ b/java-bigtable/pom.xml @@ -139,6 +139,7 @@ + false UTF-8 UTF-8 github diff --git a/java-common-protos/pom.xml b/java-common-protos/pom.xml index c394d6e0e109..4742ee359174 100644 --- a/java-common-protos/pom.xml +++ b/java-common-protos/pom.xml @@ -39,6 +39,7 @@ + false UTF-8 UTF-8 github diff --git a/java-datastore/pom.xml b/java-datastore/pom.xml index 674bdac579f4..81d36bac48b6 100644 --- a/java-datastore/pom.xml +++ b/java-datastore/pom.xml @@ -139,6 +139,7 @@ + false UTF-8 UTF-8 github diff --git a/java-dns/pom.xml b/java-dns/pom.xml index 128eacde4b6a..d147937ceb51 100644 --- a/java-dns/pom.xml +++ b/java-dns/pom.xml @@ -18,6 +18,7 @@ + false UTF-8 UTF-8 github diff --git a/java-firestore/google-cloud-firestore-admin/pom.xml b/java-firestore/google-cloud-firestore-admin/pom.xml index 74f2bcbb25f2..c8b77288446a 100644 --- a/java-firestore/google-cloud-firestore-admin/pom.xml +++ b/java-firestore/google-cloud-firestore-admin/pom.xml @@ -15,6 +15,9 @@ google-cloud-firestore-parent 3.46.0-SNAPSHOT + + true + com.google.api.grpc diff --git a/java-firestore/pom.xml b/java-firestore/pom.xml index 04b20ffa9e6a..b2e833b98129 100644 --- a/java-firestore/pom.xml +++ b/java-firestore/pom.xml @@ -139,6 +139,7 @@ + false UTF-8 UTF-8 github diff --git a/java-iam/pom.xml b/java-iam/pom.xml index 38e68f14a1f7..1f9b5b192c94 100644 --- a/java-iam/pom.xml +++ b/java-iam/pom.xml @@ -39,6 +39,7 @@ + false UTF-8 UTF-8 github diff --git a/java-logging-logback/pom.xml b/java-logging-logback/pom.xml index daf8f4b9d831..05b4b20bb2f0 100644 --- a/java-logging-logback/pom.xml +++ b/java-logging-logback/pom.xml @@ -14,6 +14,7 @@ + false 1.2.13 5.6.0 1.4.4 diff --git a/java-logging/pom.xml b/java-logging/pom.xml index a1d584eb2611..a39c48bb8334 100644 --- a/java-logging/pom.xml +++ b/java-logging/pom.xml @@ -51,6 +51,7 @@ + false UTF-8 UTF-8 github diff --git a/java-notification/pom.xml b/java-notification/pom.xml index ac93556a90a7..9857d5bef462 100644 --- a/java-notification/pom.xml +++ b/java-notification/pom.xml @@ -19,6 +19,7 @@ ../google-cloud-jar-parent/pom.xml + false google-cloud-notification diff --git a/java-pubsub/pom.xml b/java-pubsub/pom.xml index 21d3534d373d..fdf5bb8a449f 100644 --- a/java-pubsub/pom.xml +++ b/java-pubsub/pom.xml @@ -51,6 +51,7 @@ + false UTF-8 UTF-8 github diff --git a/java-shared-config/native-image-shared-config/pom.xml b/java-shared-config/native-image-shared-config/pom.xml index 554e6bca9bd0..747178a74d3e 100644 --- a/java-shared-config/native-image-shared-config/pom.xml +++ b/java-shared-config/native-image-shared-config/pom.xml @@ -227,6 +227,9 @@ native + + false + diff --git a/java-showcase/pom.xml b/java-showcase/pom.xml index d5e4704dd22f..04eb5813f350 100644 --- a/java-showcase/pom.xml +++ b/java-showcase/pom.xml @@ -17,6 +17,7 @@ + false UTF-8 UTF-8 github diff --git a/java-spanner-jdbc/pom.xml b/java-spanner-jdbc/pom.xml index e5ef2d1a4a46..844d846172d8 100644 --- a/java-spanner-jdbc/pom.xml +++ b/java-spanner-jdbc/pom.xml @@ -49,6 +49,7 @@ + false google-cloud-spanner-jdbc 4.13.2 3.0.2 diff --git a/java-spanner/pom.xml b/java-spanner/pom.xml index d2bf601f3905..196edb6a446b 100644 --- a/java-spanner/pom.xml +++ b/java-spanner/pom.xml @@ -51,6 +51,7 @@ + false UTF-8 UTF-8 github diff --git a/java-storage-nio/pom.xml b/java-storage-nio/pom.xml index 398d154a9ba4..cedd12514b91 100644 --- a/java-storage-nio/pom.xml +++ b/java-storage-nio/pom.xml @@ -60,6 +60,7 @@ + false UTF-8 UTF-8 github diff --git a/java-storage/gapic-google-cloud-storage-v2/pom.xml b/java-storage/gapic-google-cloud-storage-v2/pom.xml index 8a58812a9987..1b7885ef69b4 100644 --- a/java-storage/gapic-google-cloud-storage-v2/pom.xml +++ b/java-storage/gapic-google-cloud-storage-v2/pom.xml @@ -12,6 +12,9 @@ google-cloud-storage-parent 2.72.0-SNAPSHOT + + true + io.grpc diff --git a/java-storage/pom.xml b/java-storage/pom.xml index 2a22db9081f3..1eb019c1310f 100644 --- a/java-storage/pom.xml +++ b/java-storage/pom.xml @@ -51,6 +51,7 @@ + false UTF-8 UTF-8 github diff --git a/sdk-platform-java/gapic-generator-java-pom-parent/pom.xml b/sdk-platform-java/gapic-generator-java-pom-parent/pom.xml index 304f7e258e4f..03f4d51db33b 100644 --- a/sdk-platform-java/gapic-generator-java-pom-parent/pom.xml +++ b/sdk-platform-java/gapic-generator-java-pom-parent/pom.xml @@ -20,6 +20,16 @@ + false java.header 8 @@ -224,7 +234,11 @@ - + bulkTests