Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(internal/kokoro): enable apidiff #3761

Merged
merged 2 commits into from
Mar 2, 2021
Merged
Changes from all commits
Commits
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
17 changes: 7 additions & 10 deletions internal/kokoro/check_incompat_changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Skipped until https://github.com/golang/go/issues/34849 is resolved.
exit 0

# Display commands being run
set -x

# Only run apidiff checks on go1.12 (we only need it once).
if [[ `go version` != *"go1.12"* ]]; then
# Only run apidiff checks on go1.16 (we only need it once).
if [[ `go version` != *"go1.16"* ]]; then
exit 0
fi

if git log -1 | grep BREAKING_CHANGE_ACCEPTABLE; then
exit 0
fi

go mod download golang.org/x/exp
go install golang.org/x/exp/cmd/apidiff

# We compare against master@HEAD. This is unfortunate in some cases: if you're
# working on an out-of-date branch, and master gets some new feature (that has
# nothing to do with your work on your branch), you'll get an error message.
# Thankfully the fix is quite simple: rebase your branch.
git clone https://code.googlesource.com/gocloud /tmp/gocloud
git clone https://github.com/googleapis/google-cloud-go /tmp/gocloud

MANUALS="bigquery bigtable datastore firestore pubsub spanner storage logging"
STABLE_GAPICS="container/apiv1 dataproc/apiv1 iam iam/admin/apiv1 iam/credentials/apiv1 kms/apiv1 language/apiv1 logging/apiv2 logging/logadmin pubsub/apiv1 spanner/apiv1 translate/apiv1 vision/apiv1"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is 1. out of date and 2. not scalable imo.

Any ideas?

Expand All @@ -46,11 +44,10 @@ for dir in $MANUALS $STABLE_GAPICS; do
apidiff -w /tmp/pkg.master $pkg
cd - > /dev/null

# TODO(deklerk): there's probably a nicer way to do this that doesn't require
# two invocations
if ! apidiff -incompatible /tmp/pkg.master $pkg | (! read); then
apidiff -incompatible /tmp/pkg.master $pkg > diff.txt
if [ -s diff.txt ]; then
echo "Detected incompatible API changes between master@HEAD and current state:"
apidiff -incompatible /tmp/pkg.master $pkg
cat diff.txt
exit 1
fi
done