Skip to content

Commit bb30be6

Browse files
committed
ci: Add Downstream Protobuf-Java Source Compatibility Test
1 parent 490615b commit bb30be6

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
on:
2+
pull_request:
3+
workflow_dispatch:
4+
inputs:
5+
protobuf_versions:
6+
description: 'Comma separated list of Protobuf-Java versions (i.e. "3.25.x","4.x.y")'
7+
required: true
8+
schedule:
9+
- cron: '0 1 * * *' # Nightly at 1am
10+
11+
name: Downstream Compatibility Nightly
12+
jobs:
13+
downstream-protobuf-test:
14+
runs-on: ubuntu-22.04
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
repo:
19+
- google-cloud-java
20+
- java-bigtable
21+
- java-bigquery
22+
- java-bigquerystorage
23+
- java-datastore
24+
- java-firestore
25+
- java-logging
26+
- java-logging-logback
27+
- java-pubsub
28+
- java-pubsublite
29+
- java-spanner-jdbc
30+
- java-spanner
31+
- java-storage
32+
- java-storage-nio
33+
# Default Protobuf-Java versions to use are specified here. Without this, the nightly workflow won't know
34+
# which values to use and would resolve to ''.
35+
protobuf-version: ${{ fromJSON(format('[{0}]', inputs.protobuf_versions || '"3.25.5","4.28.3"')) }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-java@v4
39+
with:
40+
java-version: 21
41+
distribution: temurin
42+
- name: Print Protobuf-Java testing version
43+
run: echo "Testing with Protobuf-Java v${{ matrix.protobuf-version }}"
44+
- name: Perform downstream source compatibility testing
45+
run: REPOS_UNDER_TEST="${{ matrix.repo }}" PROTOBUF_RUNTIME_VERSION="${{ matrix.protobuf-version}}" ./.kokoro/presubmit/downstream-protobuf-source-compatibility.sh
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
# Copyright 2023 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
# Comma-delimited list of repos to test with the local java-shared-dependencies
19+
if [ -z "${REPOS_UNDER_TEST}" ]; then
20+
echo "REPOS_UNDER_TEST must be set to run downstream-protobuf-source-compatibility.sh"
21+
exit 1
22+
fi
23+
24+
# Version of Protobuf-Java runtime to compile with
25+
if [ -z "${PROTOBUF_RUNTIME_VERSION}" ]; then
26+
echo "PROTOBUF_RUNTIME_VERSION must be set to run downstream-protobuf-source-compatibility.sh"
27+
exit 1
28+
fi
29+
30+
# Get the directory of the build script
31+
scriptDir=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
32+
cd "${scriptDir}/../.." # cd to the root of this repo
33+
source "$scriptDir/common.sh"
34+
setup_maven_mirror
35+
36+
for repo in ${REPOS_UNDER_TEST//,/ }; do # Split on comma
37+
# Perform source-compatibility testing on main (latest changes)
38+
git clone "https://github.com/googleapis/$repo.git" --depth=1
39+
pushd "$repo"
40+
41+
# Compile the Handwritten Library with the Protobuf-Java version to test source compatibility
42+
# Run unit tests to help check for any behavior differences (dependant on coverage)
43+
mvn clean test -B -V -ntp \
44+
-Dclirr.skip=true \
45+
-Denforcer.skip=true \
46+
-Dmaven.javadoc.skip=true \
47+
-Dprotobuf.version=${PROTOBUF_RUNTIME_VERSION} \
48+
-T 1C
49+
popd
50+
done

0 commit comments

Comments
 (0)