|
| 1 | +permissions: |
| 2 | + contents: read |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + # Runs on PRs targeting main, but will be filtered for Release PRs |
| 7 | + branches: |
| 8 | + - 'main' |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + protobuf_runtime_versions: |
| 12 | + description: 'Comma separated list of Protobuf-Java versions (i.e. "3.25.x","4.x.y"). Leave empty to use version from pom-parent.' |
| 13 | + required: false |
| 14 | + schedule: |
| 15 | + - cron: '0 1 * * *' # Nightly at 1am |
| 16 | + |
| 17 | +# This job intends to test the compatibility of Protobuf runtime version against modules in the monorepo. |
| 18 | +name: sdk-platform-java Downstream Protobuf Compatibility Check Nightly |
| 19 | +jobs: |
| 20 | + setup: |
| 21 | + if: github.head_ref == 'release-please--branches--main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' |
| 22 | + runs-on: ubuntu-22.04 |
| 23 | + permissions: |
| 24 | + contents: read |
| 25 | + outputs: |
| 26 | + protobuf-versions: ${{ steps.resolve-versions.outputs.protobuf-versions }} |
| 27 | + steps: |
| 28 | + - name: Checkout monorepo |
| 29 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 30 | + with: |
| 31 | + persist-credentials: false |
| 32 | + - uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 |
| 33 | + with: |
| 34 | + java-version: 11 |
| 35 | + distribution: temurin |
| 36 | + cache: maven |
| 37 | + - id: resolve-versions |
| 38 | + name: Resolve Protobuf versions |
| 39 | + env: |
| 40 | + INPUT_VERSIONS: ${{ inputs.protobuf_runtime_versions }} |
| 41 | + run: | |
| 42 | + if [ -n "${INPUT_VERSIONS}" ]; then |
| 43 | + echo "protobuf-versions=[${INPUT_VERSIONS}]" >> "$GITHUB_OUTPUT" |
| 44 | + else |
| 45 | + VERSION=$(mvn -f sdk-platform-java/gapic-generator-java-pom-parent/pom.xml help:evaluate -Dexpression=protobuf.version -q -DforceStdout) |
| 46 | + echo "protobuf-versions=[\"${VERSION}\"]" >> "$GITHUB_OUTPUT" |
| 47 | + fi |
| 48 | +
|
| 49 | + downstream-protobuf-test: |
| 50 | + needs: setup |
| 51 | + # This job runs if any of the three conditions match: |
| 52 | + # 1. PR is raised from Release-Please (PR comes from branch: release-please--branches-main) |
| 53 | + # 2. Job is invoked by the nightly job (scheduled event) |
| 54 | + # 3. Job is manually invoked via Github UI (workflow_dispatch event) |
| 55 | + if: github.head_ref == 'release-please--branches--main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' |
| 56 | + runs-on: ubuntu-22.04 |
| 57 | + permissions: |
| 58 | + contents: read |
| 59 | + strategy: |
| 60 | + fail-fast: false |
| 61 | + matrix: |
| 62 | + module: |
| 63 | + - java-bigtable |
| 64 | + - java-bigquery |
| 65 | + - java-bigquerystorage |
| 66 | + - java-datastore |
| 67 | + - java-firestore |
| 68 | + - java-grafeas |
| 69 | + - java-logging |
| 70 | + - java-logging-logback |
| 71 | + - java-pubsub |
| 72 | + - java-resourcemanager |
| 73 | + - java-showcase |
| 74 | + - java-spanner |
| 75 | + - java-spanner-jdbc |
| 76 | + - java-storage |
| 77 | + - java-storage-nio |
| 78 | + - java-translate |
| 79 | + protobuf-version: ${{ fromJSON(needs.setup.outputs.protobuf-versions) }} |
| 80 | + steps: |
| 81 | + - name: Checkout monorepo |
| 82 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 83 | + with: |
| 84 | + persist-credentials: false |
| 85 | + - uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 |
| 86 | + with: |
| 87 | + java-version: 8 |
| 88 | + distribution: temurin |
| 89 | + - run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV |
| 90 | + # Java Client Libraries are compiled with Java 11 and target Java 8. Java 11 is required because GraalVM |
| 91 | + # minimum support is for Java 11. |
| 92 | + - uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 |
| 93 | + with: |
| 94 | + java-version: 11 |
| 95 | + distribution: temurin |
| 96 | + cache: maven |
| 97 | + - name: Install monorepo modules |
| 98 | + shell: bash |
| 99 | + run: .kokoro/build.sh |
| 100 | + env: |
| 101 | + BUILD_SUBDIR: ${{ matrix.module }} |
| 102 | + JOB_TYPE: install |
| 103 | + - name: Print Protobuf-Java testing version |
| 104 | + run: echo "Testing with Protobuf-Java v${PROTOBUF_RUNTIME_VERSION}" |
| 105 | + env: |
| 106 | + PROTOBUF_RUNTIME_VERSION: ${{ matrix.protobuf-version }} |
| 107 | + - name: Perform downstream source compatibility testing |
| 108 | + run: ./sdk-platform-java/.kokoro/nightly/downstream-protobuf-source-compatibility.sh |
| 109 | + env: |
| 110 | + MODULES_UNDER_TEST: ${{ matrix.module }} |
| 111 | + PROTOBUF_RUNTIME_VERSION: ${{ matrix.protobuf-version }} |
| 112 | + GOOGLE_CLOUD_PROJECT: placeholder-test-project |
| 113 | + - name: Perform downstream binary compatibility testing |
| 114 | + run: ./sdk-platform-java/.kokoro/nightly/downstream-protobuf-binary-compatibility.sh |
| 115 | + env: |
| 116 | + MODULES_UNDER_TEST: ${{ matrix.module }} |
| 117 | + PROTOBUF_RUNTIME_VERSION: ${{ matrix.protobuf-version }} |
0 commit comments