diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0f09190fa3..7b7626ca5e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,15 +1,17 @@ -on: +'on': push: branches: - - main - pull_request: + - 2.59.x + pull_request: null name: ci jobs: build: runs-on: ubuntu-22.04 strategy: matrix: - java: [ 11, 17] + java: + - 11 + - 17 steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 @@ -22,45 +24,60 @@ jobs: run: | mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ -Dfmt.skip -DenableTestCoverage - # The `envVarTest` profile runs tests that require an environment variable - name: Env Var Tests run: | mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ -Dfmt.skip -DenableTestCoverage -PenvVarTest - # Set the Env Var for this step only env: GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS: true GOOGLE_SDK_JAVA_LOGGING: true - run: bazelisk version - name: Install Maven modules - run: | - mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip + run: > + mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip + -Dfmt.skip - name: Integration Tests run: | bazelisk --batch test //test/integration/... - name: Gradle Build Generated Storage Client Library - run: | + run: > echo "Building Storage lib from generated source..." + mkdir /tmp/java-storage - bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java - tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage + + bazelisk --batch build + @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java + + tar zxvf + bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz + -C /tmp/java-storage + pushd /tmp/java-storage/google-cloud-storage-v2-java + ./gradlew clean build publishToMavenLocal sourcesJar allJars - popd + popd - name: Gradle Build Generated Compute Client Library - run: | + run: > echo "Building Compute lib from generated source..." + mkdir /tmp/java-compute - bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java - tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute + + bazelisk --batch build + @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java + + tar zxvf + bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz + -C /tmp/java-compute + pushd /tmp/java-compute/google-cloud-compute-small-v1-java + ./gradlew clean build publishToMavenLocal sourcesJar allJars + popd build-java-21: - name: "build(21) except self-service clients" - # Support for Java 21 is available for all use cases except self-service clients. + name: build(21) except self-service clients runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -74,12 +91,10 @@ jobs: run: | mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ -Dfmt.skip -DenableTestCoverage - # The `envVarTest` profile runs tests that require an environment variable - name: Env Var Tests run: | mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ -Dfmt.skip -DenableTestCoverage -PenvVarTest - # Set the Env Var for this step only env: GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS: true @@ -92,8 +107,7 @@ jobs: run: | bazelisk --batch test //test/integration/... build-java-24: - name: "build(24) except self-service clients" - # Support for Java 24 is available for all use cases except self-service clients. + name: build(24) except self-service clients runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -107,12 +121,10 @@ jobs: run: | mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ -Dfmt.skip -DenableTestCoverage - # The `envVarTest` profile runs tests that require an environment variable - name: Env Var Tests run: | mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ -Dfmt.skip -DenableTestCoverage -PenvVarTest - # Set the Env Var for this step only env: GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS: true @@ -122,15 +134,14 @@ jobs: run: | mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip - name: Integration Tests - # note need to set shouldInstallTestSecurityManager=false due to https://github.com/bazelbuild/bazel/issues/24354 - run: | - bazelisk --batch test //test/integration/... --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false + run: > + bazelisk --batch test //test/integration/... + --jvmopt=-Dcom.google.testing.junit.runner.shouldInstallTestSecurityManager=false build-java8-except-gapic-generator-java: - name: "build(8) except for gapic-generator-java" + name: build(8) except for gapic-generator-java runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - # Java 8 tests uses JDK 17 to compile and JDK 8 to run tests. - uses: actions/setup-java@v4 with: java-version: 8 @@ -143,36 +154,46 @@ jobs: distribution: temurin - name: Compile with Java 17 and run tests with Java 8 shell: bash - run: | + run: > set -x + export JAVA_HOME=$JAVA_HOME + export PATH=${JAVA_HOME}/bin:$PATH - # Maven surefire plugin lets us to specify the JVM when running tests via + + # Maven surefire plugin lets us to specify the JVM when running tests + via + # the "jvm" system property. + mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \ -Dfmt.skip \ -Djvm="${JAVA8_HOME}/bin/java" - # The `envVarTest` profile runs tests that require an environment variable - name: Compile with Java 17 and run tests with Java 8 (Env Var Tests) shell: bash - run: | + run: > set -x + export JAVA_HOME=$JAVA_HOME + export PATH=${JAVA_HOME}/bin:$PATH - # Maven surefire plugin lets us to specify the JVM when running tests via + + # Maven surefire plugin lets us to specify the JVM when running tests + via + # the "jvm" system property. + export GOOGLE_CLOUD_UNIVERSE_DOMAIN=random.com + mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ -Dfmt.skip -DenableTestCoverage -Dsurefire.failIfNoSpecifiedTests=false \ -PenvVarTest - # Set the Env Var for this step only env: GOOGLE_CLOUD_UNIVERSE_DOMAIN: random.com GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS: true GOOGLE_SDK_JAVA_LOGGING: true - build-java8-gapic-generator-java: - name: "build(8) for gapic-generator-java" + name: build(8) for gapic-generator-java runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -190,7 +211,9 @@ jobs: java-version: 8 distribution: temurin - run: java -version - - name: Run tests in Java 8 with the source compiled in Java 11 for gapic-generator-java + - name: >- + Run tests in Java 8 with the source compiled in Java 11 for + gapic-generator-java shell: bash run: | mvn -V -B -ntp surefire:test --projects 'gapic-generator-java' @@ -199,25 +222,41 @@ jobs: run: | bazelisk --batch test //test/integration/... - name: Gradle Build Generated Storage Client Library - run: | + run: > echo "Building Storage lib from generated source..." + mkdir /tmp/java-storage - bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java - tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage + + bazelisk --batch build + @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java + + tar zxvf + bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz + -C /tmp/java-storage + pushd /tmp/java-storage/google-cloud-storage-v2-java + ./gradlew clean build publishToMavenLocal sourcesJar allJars - popd + popd - name: Gradle Build Generated Compute Client Library - run: | + run: > echo "Building Compute lib from generated source..." + mkdir /tmp/java-compute - bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java - tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute + + bazelisk --batch build + @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java + + tar zxvf + bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz + -C /tmp/java-compute + pushd /tmp/java-compute/google-cloud-compute-small-v1-java + ./gradlew clean build publishToMavenLocal sourcesJar allJars - popd + popd lint: runs-on: ubuntu-22.04 steps: @@ -229,9 +268,7 @@ jobs: cache: maven - run: java -version - name: Java Linter - # Exclude the root project run: mvn -B -ntp fmt:check - compatibility: runs-on: ubuntu-22.04 steps: @@ -243,12 +280,9 @@ jobs: cache: maven - run: java -version - name: Compatibility check - # package jar so that gapic-generator-java module can use - # testlib modules of gax run: mvn package clirr:check -DskipTests -Dfmt.skip - build-java8-showcase: - name: "build(8) for showcase" + name: build(8) for showcase runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -259,8 +293,9 @@ jobs: cache: maven - name: Install all modules using Java 11 shell: bash - run: | - mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip + run: > + mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip + -Dfmt.skip - uses: actions/setup-java@v3 with: java-version: 8 @@ -268,46 +303,61 @@ jobs: - run: java -version - name: Parse showcase version working-directory: java-showcase/gapic-showcase - run: echo "SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)" >> "$GITHUB_ENV" + run: >- + echo "SHOWCASE_VERSION=$(mvn help:evaluate + -Dexpression=gapic-showcase.version -q -DforceStdout)" >> + "$GITHUB_ENV" - name: Install showcase server - run: | - sudo mkdir -p /usr/src/showcase - sudo chown -R ${USER} /usr/src/ - curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${{env.SHOWCASE_VERSION}}/gapic-showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz - cd /usr/src/showcase/ - tar -xf showcase-* - ./gapic-showcase run & - cd - + run: > + sudo mkdir -p /usr/src/showcase + + sudo chown -R ${USER} /usr/src/ + + curl --location + https://github.com/googleapis/gapic-showcase/releases/download/v${{env.SHOWCASE_VERSION}}/gapic-showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz + --output + /usr/src/showcase/showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz + + cd /usr/src/showcase/ + + tar -xf showcase-* + + ./gapic-showcase run & + + cd - - name: Showcase integration tests working-directory: java-showcase run: | - mvn verify \ - -P enable-integration-tests \ - --batch-mode \ - --no-transfer-progress - # The `slf4j1_logback` profile brings logging dependency and compiles logging tests, require env var to be set + mvn verify \ + -P enable-integration-tests \ + --batch-mode \ + --no-transfer-progress - name: Showcase integration tests - Logging SLF4J 1.x working-directory: java-showcase - run: | - mvn clean verify -P '!showcase,enable-integration-tests,loggingTestBase,slf4j1_logback' \ - --batch-mode \ - --no-transfer-progress - # Set the Env Var for this step only + run: > + mvn clean verify -P + '!showcase,enable-integration-tests,loggingTestBase,slf4j1_logback' \ + --batch-mode \ + --no-transfer-progress env: - GOOGLE_SDK_JAVA_LOGGING: true - # The `disabledLogging` profile tests logging disabled when logging dependency present, - # do not set env var for this step + GOOGLE_SDK_JAVA_LOGGING: true - name: Showcase integration tests - Logging disabed working-directory: java-showcase - run: | - mvn clean verify -P '!showcase,enable-integration-tests,loggingTestBase,disabledLogging' \ + run: > + mvn clean verify -P + '!showcase,enable-integration-tests,loggingTestBase,disabledLogging' + \ --batch-mode \ --no-transfer-progress showcase: runs-on: ubuntu-22.04 strategy: matrix: - java: [ 11, 17, 21, 24 ] + java: + - 11 + - 17 + - 21 + - 24 steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 @@ -316,8 +366,9 @@ jobs: distribution: temurin - run: mvn -version - name: Install Maven modules - run: | - mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip + run: > + mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip + -Dfmt.skip - name: Java Linter if: matrix.java >= 17 working-directory: java-showcase @@ -332,15 +383,27 @@ jobs: --no-transfer-progress - name: Parse showcase version working-directory: java-showcase/gapic-showcase - run: echo "SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)" >> "$GITHUB_ENV" + run: >- + echo "SHOWCASE_VERSION=$(mvn help:evaluate + -Dexpression=gapic-showcase.version -q -DforceStdout)" >> + "$GITHUB_ENV" - name: Install showcase server - run: | + run: > sudo mkdir -p /usr/src/showcase + sudo chown -R ${USER} /usr/src/ - curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${{env.SHOWCASE_VERSION}}/gapic-showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz + + curl --location + https://github.com/googleapis/gapic-showcase/releases/download/v${{env.SHOWCASE_VERSION}}/gapic-showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz + --output + /usr/src/showcase/showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz + cd /usr/src/showcase/ + tar -xf showcase-* + ./gapic-showcase run & + cd - - name: Showcase integration tests working-directory: java-showcase @@ -349,37 +412,34 @@ jobs: -P enable-integration-tests \ --batch-mode \ --no-transfer-progress - # The `slf4j2_logback` profile brings logging dependency and compiles logging tests, require env var to be set - name: Showcase integration tests - Logging SLF4J 2.x working-directory: java-showcase - run: | - mvn clean verify -P '!showcase,enable-integration-tests,loggingTestBase,slf4j2_logback' \ + run: > + mvn clean verify -P + '!showcase,enable-integration-tests,loggingTestBase,slf4j2_logback' \ --batch-mode \ --no-transfer-progress - # Set the Env Var for this step only env: GOOGLE_SDK_JAVA_LOGGING: true - # The `slf4j1_logback` profile brings logging dependency and compiles logging tests, require env var to be set - name: Showcase integration tests - Logging SLF4J 1.x working-directory: java-showcase - run: | - mvn clean verify -P '!showcase,enable-integration-tests,loggingTestBase,slf4j1_logback' \ + run: > + mvn clean verify -P + '!showcase,enable-integration-tests,loggingTestBase,slf4j1_logback' \ --batch-mode \ --no-transfer-progress - # Set the Env Var for this step only env: GOOGLE_SDK_JAVA_LOGGING: true - # The `disabledLogging` profile tests logging disabled when logging dependency present, - # do not set env var for this step - name: Showcase integration tests - Logging disabed working-directory: java-showcase - run: | - mvn clean verify -P '!showcase,enable-integration-tests,loggingTestBase,disabledLogging' \ + run: > + mvn clean verify -P + '!showcase,enable-integration-tests,loggingTestBase,disabledLogging' + \ --batch-mode \ --no-transfer-progress - showcase-clirr: - if: ${{ github.base_ref != '' }} # Only execute on pull_request trigger event + if: ${{ github.base_ref != '' }} runs-on: ubuntu-22.04 steps: - name: Checkout @ target branch @@ -392,75 +452,82 @@ jobs: distribution: temurin cache: maven - name: Install sdk-platform-java and showcase to local maven repository - run: | + run: > mvn install -B -ntp -T 1C -DskipTests + cd java-showcase + mvn install -B -ntp -T 1C -DskipTests - SHOWCASE_CLIENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - echo "SHOWCASE_CLIENT_VERSION=$SHOWCASE_CLIENT_VERSION" >> "$GITHUB_ENV" + + SHOWCASE_CLIENT_VERSION=$(mvn help:evaluate + -Dexpression=project.version -q -DforceStdout) + + echo "SHOWCASE_CLIENT_VERSION=$SHOWCASE_CLIENT_VERSION" >> + "$GITHUB_ENV" - name: Checkout sdk-platform-java @ PR merge commit uses: actions/checkout@v3 - name: Install sdk-platform-java @ PR merge commit run: mvn install -B -ntp -T 1C -DskipTests - # Showcase golden test ensures that src changes are already reflected in the PR. - name: Clirr check working-directory: java-showcase - run: | + run: > mvn versions:set -B -ntp -DnewVersion=local - mvn clirr:check -B -ntp -Dclirr.skip=false -DcomparisonVersion=$SHOWCASE_CLIENT_VERSION + mvn clirr:check -B -ntp -Dclirr.skip=false + -DcomparisonVersion=$SHOWCASE_CLIENT_VERSION gapic-generator-java-bom: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - java-version: 11 - distribution: temurin - cache: maven - - name: Install Maven modules to local Maven repository - run: | - mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip - - name: Validate gapic-generator-java-bom - uses: googleapis/java-cloud-bom/tests/validate-bom@47ad868794c5d38ee7eb95d69371a7a79f84d890 - with: - bom-path: gapic-generator-java-bom/pom.xml - + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: temurin + cache: maven + - name: Install Maven modules to local Maven repository + run: > + mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip + -Dfmt.skip + - name: Validate gapic-generator-java-bom + uses: >- + googleapis/java-cloud-bom/tests/validate-bom@47ad868794c5d38ee7eb95d69371a7a79f84d890 + with: + bom-path: gapic-generator-java-bom/pom.xml unmanaged_dependency_check: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - uses: actions/setup-java@v4 - with: - java-version: 11 - distribution: temurin - - run: mvn -version - - name: Unit Tests - run: | - mvn test --batch-mode --no-transfer-progress - working-directory: java-shared-dependencies/unmanaged-dependency-check - - name: Install Maven modules - run: | - mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip -Dfmt.skip - - name: Unmanaged dependency check - uses: ./java-shared-dependencies/unmanaged-dependency-check - with: - bom-path: gapic-generator-java-bom/pom.xml - + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: temurin + - run: mvn -version + - name: Unit Tests + run: | + mvn test --batch-mode --no-transfer-progress + working-directory: java-shared-dependencies/unmanaged-dependency-check + - name: Install Maven modules + run: > + mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip + -Dfmt.skip + - name: Unmanaged dependency check + uses: ./java-shared-dependencies/unmanaged-dependency-check + with: + bom-path: gapic-generator-java-bom/pom.xml dependency_analyzer_unit_test: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - run: mvn -version - - name: Unit Tests - run: | - mvn test --batch-mode --no-transfer-progress - working-directory: java-shared-dependencies/dependency-analyzer + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + - run: mvn -version + - name: Unit Tests + run: | + mvn test --batch-mode --no-transfer-progress + working-directory: java-shared-dependencies/dependency-analyzer diff --git a/.github/workflows/downstream.yaml b/.github/workflows/downstream.yaml index c6b3f64856..f050be5555 100644 --- a/.github/workflows/downstream.yaml +++ b/.github/workflows/downstream.yaml @@ -1,15 +1,13 @@ -on: +'on': push: branches: - - main + - 2.59.x pull_request: - # Changes to these directories do not directly affect the downstream libraries paths-ignore: - gapic-generator-java/** - library_generation/** - showcase/** - test/** - name: Downstream Check jobs: downstream-compatibility: @@ -46,7 +44,9 @@ jobs: - name: Test helper scripts run: ./.kokoro/presubmit/common_test.sh - name: Perform downstream compatibility testing - run: REPOS_UNDER_TEST="${{ matrix.repo }}" ./.kokoro/presubmit/downstream-compatibility.sh + run: >- + REPOS_UNDER_TEST="${{ matrix.repo }}" + ./.kokoro/presubmit/downstream-compatibility.sh downstream-compatibility-spring-generator: runs-on: ubuntu-22.04 strategy: diff --git a/.github/workflows/downstream_protobuf_compatibility_check_nightly.yaml b/.github/workflows/downstream_protobuf_compatibility_check_nightly.yaml index 6c0ac5f088..4379ea9a10 100644 --- a/.github/workflows/downstream_protobuf_compatibility_check_nightly.yaml +++ b/.github/workflows/downstream_protobuf_compatibility_check_nightly.yaml @@ -1,25 +1,23 @@ -on: +'on': pull_request: - # Runs on PRs targeting main, but will be filtered for Release PRs branches: - - 'main' + - 2.59.x workflow_dispatch: inputs: protobuf_runtime_versions: - description: 'Comma separated list of Protobuf-Java versions (i.e. "3.25.x","4.x.y"). - Note: Surround each version in the list with quotes ("")' + description: >- + Comma separated list of Protobuf-Java versions (i.e. + "3.25.x","4.x.y"). Note: Surround each version in the list with quotes + ("") required: true schedule: - - cron: '0 1 * * *' # Nightly at 1am - + - cron: 0 1 * * * name: Downstream Protobuf Compatibility Check Nightly jobs: downstream-protobuf-test: - # This job runs if any of the three conditions match: - # 1. PR is raised from Release-Please (PR comes from branch: release-please--branches-main) - # 2. Job is invoked by the nightly job (scheduled event) - # 3. Job is manually invoked via Github UI (workflow_dispatch event) - if: github.head_ref == 'release-please--branches--main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + if: >- + github.head_ref == 'release-please--branches--main' || github.event_name + == 'schedule' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -39,9 +37,9 @@ jobs: - java-spanner - java-storage - java-storage-nio - # Default Protobuf-Java versions to use are specified here. Without this, the nightly workflow won't know - # which values to use and would resolve to ''. - protobuf-version: ${{ fromJSON(format('[{0}]', inputs.protobuf_runtime_versions || '"3.25.5","4.29.0"')) }} + protobuf-version: >- + ${{ fromJSON(format('[{0}]', inputs.protobuf_runtime_versions || + '"3.25.5","4.29.0"')) }} steps: - name: Checkout sdk-platform-java repo uses: actions/checkout@v4 @@ -50,8 +48,6 @@ jobs: java-version: 8 distribution: temurin - run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV - # Java Client Libraries are compiled with Java 11 and target Java 8. Java 11 is required because GraalVM - # minimum support is for Java 11. - uses: actions/setup-java@v4 with: java-version: 11 @@ -59,7 +55,12 @@ jobs: - name: Print Protobuf-Java testing version run: echo "Testing with Protobuf-Java v${{ matrix.protobuf-version }}" - name: Perform downstream source compatibility testing - run: REPOS_UNDER_TEST="${{ matrix.repo }}" PROTOBUF_RUNTIME_VERSION="${{ matrix.protobuf-version }}" ./.kokoro/nightly/downstream-protobuf-source-compatibility.sh + run: >- + REPOS_UNDER_TEST="${{ matrix.repo }}" PROTOBUF_RUNTIME_VERSION="${{ + matrix.protobuf-version }}" + ./.kokoro/nightly/downstream-protobuf-source-compatibility.sh - name: Perform downstream binary compatibility testing - run: REPOS_UNDER_TEST="${{ matrix.repo }}" PROTOBUF_RUNTIME_VERSION="${{ matrix.protobuf-version }}" ./.kokoro/nightly/downstream-protobuf-binary-compatibility.sh - + run: >- + REPOS_UNDER_TEST="${{ matrix.repo }}" PROTOBUF_RUNTIME_VERSION="${{ + matrix.protobuf-version }}" + ./.kokoro/nightly/downstream-protobuf-binary-compatibility.sh diff --git a/.github/workflows/downstream_unmanaged_dependency_check.yaml b/.github/workflows/downstream_unmanaged_dependency_check.yaml index a3886cc81c..f5f139e5ab 100644 --- a/.github/workflows/downstream_unmanaged_dependency_check.yaml +++ b/.github/workflows/downstream_unmanaged_dependency_check.yaml @@ -1,12 +1,11 @@ -on: +'on': push: branches: - - main + - 2.59.x pull_request: paths: - .github/workflows/downstream_unmanaged_dependency_check.yaml - java-shared-dependencies/** - name: Downstream Unmanaged Dependency Check jobs: validate: @@ -57,24 +56,40 @@ jobs: - name: Install the modules of the downstream repository shell: bash working-directory: ${{ matrix.repo }} - run: | - # No argument to build.sh installs the modules in local Maven repository + run: > + # No argument to build.sh installs the modules in local Maven + repository + .kokoro/build.sh - name: Run unmanaged dependency check shell: bash - run: | + run: > set -euo pipefail + set -x - # java-bigtable has "-deps-bom" that declares its dependencies. It's not a good + + # java-bigtable has "-deps-bom" that declares its dependencies. It's + not a good + # BOM to list the artifacts generated by that repository. - bom_dir=$(find ${{ matrix.repo }} -type d -name 'google-*-bom' ! -name '*-deps-bom') + + bom_dir=$(find ${{ matrix.repo }} -type d -name 'google-*-bom' ! -name + '*-deps-bom') + bom_absolute_path=$(realpath "${bom_dir}/pom.xml") - cd sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check + + cd + sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check + echo "Running Unmanaged Dependency Check against ${bom_absolute_path}" - unmanaged_dependencies=$(mvn exec:java -Dexec.args="../pom.xml ${bom_absolute_path}" -q) + + unmanaged_dependencies=$(mvn exec:java -Dexec.args="../pom.xml + ${bom_absolute_path}" -q) + if [[ "${unmanaged_dependencies}" != "[]" ]]; then echo "With this change, the unmanaged dependencies check installed in ${{ matrix.repo }} will start to" echo "fail due to ${unmanaged_dependencies}, among the artifacts listed in ${bom_absolute_path}." exit 1 fi + echo "Unmanaged dependency check passed" diff --git a/.github/workflows/shared_dependencies.yaml b/.github/workflows/shared_dependencies.yaml index 6fedbf7984..6e7dff11b0 100644 --- a/.github/workflows/shared_dependencies.yaml +++ b/.github/workflows/shared_dependencies.yaml @@ -1,12 +1,12 @@ -on: +'on': push: branches: - - main + - 2.59.x pull_request: paths: - - 'gapic-generator-java-bom/**' - - 'gapic-generator-java-pom-parent/**' - - 'java-shared-dependencies/**' + - gapic-generator-java-bom/** + - gapic-generator-java-pom-parent/** + - java-shared-dependencies/** name: shared-dependencies version check jobs: upper-bound-check: @@ -14,15 +14,15 @@ jobs: runs-on: ubuntu-latest if: github.repository_owner == 'googleapis' steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 17 - - run: java -version - - name: Install maven modules - run: | - mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip - - name: Check the BOM content satisfies the upper-bound-check test case - run: mvn -B -V -ntp verify -Dcheckstyle.skip - working-directory: java-shared-dependencies/upper-bound-check \ No newline at end of file + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + - run: java -version + - name: Install maven modules + run: | + mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip + - name: Check the BOM content satisfies the upper-bound-check test case + run: mvn -B -V -ntp verify -Dcheckstyle.skip + working-directory: java-shared-dependencies/upper-bound-check diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml index e29b1baac6..72aa4290c0 100644 --- a/.github/workflows/sonar.yaml +++ b/.github/workflows/sonar.yaml @@ -1,10 +1,13 @@ name: SonarCloud Build -on: +'on': push: branches: - - main + - 2.59.x pull_request: - types: [opened, synchronize, reopened] + types: + - opened + - synchronize + - reopened jobs: build: name: Build @@ -12,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + fetch-depth: 0 - name: Set up JDK 17 uses: actions/setup-java@v3 with: @@ -37,23 +40,31 @@ jobs: mvn install -T 1C -DskipTests -ntp -B - name: Parse showcase version working-directory: java-showcase/gapic-showcase - run: echo "SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)" >> "$GITHUB_ENV" + run: >- + echo "SHOWCASE_VERSION=$(mvn help:evaluate + -Dexpression=gapic-showcase.version -q -DforceStdout)" >> + "$GITHUB_ENV" - name: Install showcase server - run: | - sudo mkdir -p /usr/src/showcase - sudo chown -R ${USER} /usr/src/ - curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${{env.SHOWCASE_VERSION}}/gapic-showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz - cd /usr/src/showcase/ - tar -xf showcase-* - ./gapic-showcase run & - cd - - # Intentionally do not run the Env Var Tests (no -PenvVarTests) as setting the Env Var - # may alter the results for other tests that use Env Var in the logic. Adding a Sonar - # step for a few tests (env var tests) may be overkill and should be better covered - # when we can upgrade to JUnit 5 (https://github.com/googleapis/sdk-platform-java/issues/1611#issuecomment-1970079325) + run: > + sudo mkdir -p /usr/src/showcase + + sudo chown -R ${USER} /usr/src/ + + curl --location + https://github.com/googleapis/gapic-showcase/releases/download/v${{env.SHOWCASE_VERSION}}/gapic-showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz + --output + /usr/src/showcase/showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz + + cd /usr/src/showcase/ + + tar -xf showcase-* + + ./gapic-showcase run & + + cd - - name: Build and analyze for full test coverage env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | mvn -B verify -Dcheckstyle.skip \ @@ -65,7 +76,7 @@ jobs: -Dsonar.host.url=https://sonarcloud.io - name: Build and analyze Showcase Integration Tests Coverage env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | mvn -B clean verify -Dcheckstyle.skip \