Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 32 additions & 34 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -57,87 +57,83 @@ 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:
java: [11, 17, 21, 25, 26]
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
Expand Down Expand Up @@ -353,6 +349,7 @@ jobs:
with:
distribution: temurin
java-version: 11
cache: maven
- run: .kokoro/build.sh
env:
BUILD_SUBDIR: ${{matrix.package}}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
40 changes: 33 additions & 7 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}" ]]
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions .kokoro/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions .kokoro/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 17 additions & 1 deletion google-cloud-jar-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@
<relativePath>../google-cloud-pom-parent/pom.xml</relativePath>
</parent>
<properties>
<skipUnitTests>false</skipUnitTests>
<!--
Defaults to true: most modules under this parent are pure GAPIC-generated clients whose
generated tests aren't worth the CI time. Libraries with handwritten tests worth
running (java-spanner, java-bigtable, java-storage, ...) override this back to false in
their own top-level pom.xml.

Wired only into surefire's <skip> (below), not Maven's built-in skipTests, so it skips
unit tests without also skipping failsafe/ITs.
-->
<skipUnitTests>true</skipUnitTests>
<ignoreNonCompile>true</ignoreNonCompile><!-- maven-dependency-plugin:analyze to skip test scope dependencies -->
</properties>

Expand Down Expand Up @@ -197,6 +206,13 @@
</plugins>
</build>
</profile>
<profile>
<!-- This profile is used to enable GraalVM native image testing -->
<id>native</id>
<properties>
<skipUnitTests>false</skipUnitTests>
</properties>
</profile>
</profiles>

<build>
Expand Down
1 change: 1 addition & 0 deletions java-bigquery-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<description>JDBC for BigQuery</description>

<properties>
<skipUnitTests>false</skipUnitTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
Expand Down
1 change: 1 addition & 0 deletions java-bigquery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
</licenses>

<properties>
<skipUnitTests>false</skipUnitTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
Expand Down
1 change: 1 addition & 0 deletions java-bigquerystorage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
</licenses>

<properties>
<skipUnitTests>false</skipUnitTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<project.protobuf-java.version>3.25.4</project.protobuf-java.version>
Expand Down
1 change: 1 addition & 0 deletions java-bigtable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
</licenses>

<properties>
<skipUnitTests>false</skipUnitTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
Expand Down
1 change: 1 addition & 0 deletions java-common-protos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
</licenses>

<properties>
<skipUnitTests>false</skipUnitTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
Expand Down
1 change: 1 addition & 0 deletions java-datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
</licenses>

<properties>
<skipUnitTests>false</skipUnitTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
Expand Down
1 change: 1 addition & 0 deletions java-dns/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</parent>

<properties>
<skipUnitTests>false</skipUnitTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
Expand Down
3 changes: 3 additions & 0 deletions java-firestore/google-cloud-firestore-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<artifactId>google-cloud-firestore-parent</artifactId>
<version>3.46.0-SNAPSHOT</version><!-- {x-version-update:google-cloud-firestore:current} -->
</parent>
<properties>
<skipUnitTests>true</skipUnitTests>
</properties>
<dependencies>
<dependency>
<groupId>com.google.api.grpc</groupId>
Expand Down
1 change: 1 addition & 0 deletions java-firestore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
</licenses>

<properties>
<skipUnitTests>false</skipUnitTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
Expand Down
1 change: 1 addition & 0 deletions java-iam/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
</licenses>

<properties>
<skipUnitTests>false</skipUnitTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
Expand Down
1 change: 1 addition & 0 deletions java-logging-logback/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</description>

<properties>
<skipUnitTests>false</skipUnitTests>
<logback.version>1.2.13</logback.version>
<easymock.version>5.6.0</easymock.version>
<truth.version>1.4.4</truth.version>
Expand Down
Loading
Loading