From 373f11af8050c1f431e310eeddd8e3e578da688b Mon Sep 17 00:00:00 2001 From: noahdietz Date: Wed, 19 Oct 2022 15:59:31 -0700 Subject: [PATCH 01/12] chore(ci): move apidiff to GitHub Action --- .github/workflows/apidiff.yml | 79 +++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/apidiff.yml diff --git a/.github/workflows/apidiff.yml b/.github/workflows/apidiff.yml new file mode 100644 index 00000000000..1b4642f0508 --- /dev/null +++ b/.github/workflows/apidiff.yml @@ -0,0 +1,79 @@ +--- +name: apidiff +on: + pull_request: + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: main + - name: Get main commit + id: main + run: echo "::set-output name=hash::$(git rev-parse HEAD)" + - uses: actions/checkout@v3 + - name: Get changed directories + id: changed_dirs + # Ignore changes to the internal and root directories. + run: | + dirs=$(git diff-tree --no-commit-id --name-only --diff-filter=DMR -r ${{ steps.main.outputs.hash }}..HEAD | xargs -r -L1 dirname | uniq | grep -v -e 'internal' -e '\.') + if [ -z "$dirs" ] + then + echo "::set-output name=changed::{\"changed\":[]}" + else + for d in $dirs; do list=${list},\"${d}\"; done + echo "::set-output name=changed::{\"changed\":[${list#,}]}" + fi + outputs: + changed_dirs: ${{ steps.changed_dirs.outputs.changed }} + apidiff: + needs: setup + runs-on: ubuntu-latest + if: "!contains(github.event.pull_request.labels.*.name, 'breaking change allowed')" + continue-on-error: true + strategy: + matrix: ${{ fromJson(needs.setup.outputs.changed_dirs) }} + steps: + - uses: actions/setup-go@v3 + with: + go-version: '1.18.3' + - name: Install latest apidiff + run: go install golang.org/x/exp/cmd/apidiff@latest + - uses: actions/checkout@v3 + with: + ref: main + - name: Baseline name + id: baseline + run: | + export CHANGED=${{ matrix.changed }} + echo ::set-output name=pkg::"${CHANGED//\//_}_pkg.main" + - name: Create Go package baseline + run: cd {{ matrix.changed }} && apidiff -w ${{ steps.baseline.outputs.pkg }} . + - name: Upload baseline package data + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.baseline.outputs.pkg }} + path: ${{ steps.baseline.outputs.pkg }} + retention-days: 1 + - uses: actions/checkout@v3 + - name: Download baseline package data + uses: actions/download-artifact@v3 + with: + name: ${{ steps.baseline.outputs.pkg }} + - name: Compare regenerated code to baseline + run: | + cd {{ matrix.changed }} && apidiff -incompatible ${{ steps.baseline.outputs.pkg }} . > diff.txt + cat diff.txt && ! [ -s diff.txt ] + - name: Add breaking change label + if: ${{ failure() && !github.event.pull_request.head.repo.fork }} + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.addLabels({ + issue_number: ${{ github.event.number }}, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['breaking change'] + }) \ No newline at end of file From 6730e07e06a12992678014ea8a724d7364b5b19c Mon Sep 17 00:00:00 2001 From: noahdietz Date: Wed, 19 Oct 2022 16:17:15 -0700 Subject: [PATCH 02/12] switch to github_output --- .github/workflows/apidiff.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/apidiff.yml b/.github/workflows/apidiff.yml index 1b4642f0508..79bec0575c0 100644 --- a/.github/workflows/apidiff.yml +++ b/.github/workflows/apidiff.yml @@ -12,7 +12,7 @@ jobs: ref: main - name: Get main commit id: main - run: echo "::set-output name=hash::$(git rev-parse HEAD)" + run: echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - uses: actions/checkout@v3 - name: Get changed directories id: changed_dirs @@ -21,10 +21,10 @@ jobs: dirs=$(git diff-tree --no-commit-id --name-only --diff-filter=DMR -r ${{ steps.main.outputs.hash }}..HEAD | xargs -r -L1 dirname | uniq | grep -v -e 'internal' -e '\.') if [ -z "$dirs" ] then - echo "::set-output name=changed::{\"changed\":[]}" + echo "changed={\"changed\":[]}" >> $GITHUB_OUTPUT else for d in $dirs; do list=${list},\"${d}\"; done - echo "::set-output name=changed::{\"changed\":[${list#,}]}" + echo "changed={\"changed\":[${list#,}]}" >> $GITHUB_OUTPUT fi outputs: changed_dirs: ${{ steps.changed_dirs.outputs.changed }} @@ -48,7 +48,7 @@ jobs: id: baseline run: | export CHANGED=${{ matrix.changed }} - echo ::set-output name=pkg::"${CHANGED//\//_}_pkg.main" + echo pkg="${CHANGED//\//_}_pkg.main" >> $GITHUB_OUTPUT - name: Create Go package baseline run: cd {{ matrix.changed }} && apidiff -w ${{ steps.baseline.outputs.pkg }} . - name: Upload baseline package data From 05538c97c10659384b5d398f22f05f1485c77395 Mon Sep 17 00:00:00 2001 From: noahdietz Date: Wed, 19 Oct 2022 16:25:40 -0700 Subject: [PATCH 03/12] break it up --- .github/workflows/apidiff.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/apidiff.yml b/.github/workflows/apidiff.yml index 79bec0575c0..764809af298 100644 --- a/.github/workflows/apidiff.yml +++ b/.github/workflows/apidiff.yml @@ -18,7 +18,11 @@ jobs: id: changed_dirs # Ignore changes to the internal and root directories. run: | - dirs=$(git diff-tree --no-commit-id --name-only --diff-filter=DMR -r ${{ steps.main.outputs.hash }}..HEAD | xargs -r -L1 dirname | uniq | grep -v -e 'internal' -e '\.') + tree=$(git diff-tree --no-commit-id --name-only --diff-filter=DMR -r ${{ steps.main.outputs.hash }}..HEAD) + echo $tree + uniques=$(echo $tree | xargs -r -L1 dirname | uniq) + echo $uniques + dirs=$(echo $uniques | grep -v -e 'internal' -e '\.') if [ -z "$dirs" ] then echo "changed={\"changed\":[]}" >> $GITHUB_OUTPUT From 057144ef3f2c1a1baed5e4aef3d9d851fe869c63 Mon Sep 17 00:00:00 2001 From: noahdietz Date: Wed, 19 Oct 2022 16:29:08 -0700 Subject: [PATCH 04/12] TEST BREAKING CHANGE --- accessapproval/apiv1/access_approval_client.go | 2 +- accessapproval/apiv1/doc.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accessapproval/apiv1/access_approval_client.go b/accessapproval/apiv1/access_approval_client.go index 30761818248..bca72561afa 100644 --- a/accessapproval/apiv1/access_approval_client.go +++ b/accessapproval/apiv1/access_approval_client.go @@ -55,7 +55,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultEndpoint("accessapproval.googleapis.com:443"), internaloption.WithDefaultMTLSEndpoint("accessapproval.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://accessapproval.googleapis.com/"), - internaloption.WithDefaultScopes(DefaultAuthScopes()...), + internaloption.WithDefaultScopes(defaultAuthScopes()...), internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/accessapproval/apiv1/doc.go b/accessapproval/apiv1/doc.go index 5a252e38960..8f2f53da145 100644 --- a/accessapproval/apiv1/doc.go +++ b/accessapproval/apiv1/doc.go @@ -132,7 +132,7 @@ func checkDisableDeadlines() (bool, error) { } // DefaultAuthScopes reports the default set of authentication scopes to use with this package. -func DefaultAuthScopes() []string { +func defaultAuthScopes() []string { return []string{ "https://www.googleapis.com/auth/cloud-platform", } From 165b62fcaac945aae44a00e951feb81474d806c8 Mon Sep 17 00:00:00 2001 From: noahdietz Date: Wed, 19 Oct 2022 16:32:30 -0700 Subject: [PATCH 05/12] fix action var ref --- .github/workflows/apidiff.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/apidiff.yml b/.github/workflows/apidiff.yml index 764809af298..7888f955e58 100644 --- a/.github/workflows/apidiff.yml +++ b/.github/workflows/apidiff.yml @@ -54,7 +54,7 @@ jobs: export CHANGED=${{ matrix.changed }} echo pkg="${CHANGED//\//_}_pkg.main" >> $GITHUB_OUTPUT - name: Create Go package baseline - run: cd {{ matrix.changed }} && apidiff -w ${{ steps.baseline.outputs.pkg }} . + run: cd ${{ matrix.changed }} && apidiff -w ${{ steps.baseline.outputs.pkg }} . - name: Upload baseline package data uses: actions/upload-artifact@v3 with: @@ -68,7 +68,7 @@ jobs: name: ${{ steps.baseline.outputs.pkg }} - name: Compare regenerated code to baseline run: | - cd {{ matrix.changed }} && apidiff -incompatible ${{ steps.baseline.outputs.pkg }} . > diff.txt + cd ${{ matrix.changed }} && apidiff -incompatible ${{ steps.baseline.outputs.pkg }} . > diff.txt cat diff.txt && ! [ -s diff.txt ] - name: Add breaking change label if: ${{ failure() && !github.event.pull_request.head.repo.fork }} From 4d83e3fff05e0dee08657bcce51da4d6dd937a71 Mon Sep 17 00:00:00 2001 From: noahdietz Date: Wed, 19 Oct 2022 16:37:21 -0700 Subject: [PATCH 06/12] fix upload/download paths --- .github/workflows/apidiff.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/apidiff.yml b/.github/workflows/apidiff.yml index 7888f955e58..be880f3e23c 100644 --- a/.github/workflows/apidiff.yml +++ b/.github/workflows/apidiff.yml @@ -59,13 +59,14 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ steps.baseline.outputs.pkg }} - path: ${{ steps.baseline.outputs.pkg }} + path: ${{ matrix.changed }}/${{ steps.baseline.outputs.pkg }} retention-days: 1 - uses: actions/checkout@v3 - name: Download baseline package data uses: actions/download-artifact@v3 with: name: ${{ steps.baseline.outputs.pkg }} + path: ${{ matrix.changed }} - name: Compare regenerated code to baseline run: | cd ${{ matrix.changed }} && apidiff -incompatible ${{ steps.baseline.outputs.pkg }} . > diff.txt From 7b2f0fc7617c8d4b990ebab36fb9f7a3c13a886e Mon Sep 17 00:00:00 2001 From: noahdietz Date: Wed, 19 Oct 2022 16:39:09 -0700 Subject: [PATCH 07/12] remove echos --- .github/workflows/apidiff.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/apidiff.yml b/.github/workflows/apidiff.yml index be880f3e23c..d84136d25db 100644 --- a/.github/workflows/apidiff.yml +++ b/.github/workflows/apidiff.yml @@ -19,9 +19,7 @@ jobs: # Ignore changes to the internal and root directories. run: | tree=$(git diff-tree --no-commit-id --name-only --diff-filter=DMR -r ${{ steps.main.outputs.hash }}..HEAD) - echo $tree uniques=$(echo $tree | xargs -r -L1 dirname | uniq) - echo $uniques dirs=$(echo $uniques | grep -v -e 'internal' -e '\.') if [ -z "$dirs" ] then From 552f563cf9e2ed0c310a920816a092e938802919 Mon Sep 17 00:00:00 2001 From: noahdietz Date: Wed, 19 Oct 2022 16:39:22 -0700 Subject: [PATCH 08/12] Revert "TEST BREAKING CHANGE" This reverts commit 057144ef3f2c1a1baed5e4aef3d9d851fe869c63. --- accessapproval/apiv1/access_approval_client.go | 2 +- accessapproval/apiv1/doc.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accessapproval/apiv1/access_approval_client.go b/accessapproval/apiv1/access_approval_client.go index bca72561afa..30761818248 100644 --- a/accessapproval/apiv1/access_approval_client.go +++ b/accessapproval/apiv1/access_approval_client.go @@ -55,7 +55,7 @@ func defaultGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultEndpoint("accessapproval.googleapis.com:443"), internaloption.WithDefaultMTLSEndpoint("accessapproval.mtls.googleapis.com:443"), internaloption.WithDefaultAudience("https://accessapproval.googleapis.com/"), - internaloption.WithDefaultScopes(defaultAuthScopes()...), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( grpc.MaxCallRecvMsgSize(math.MaxInt32))), diff --git a/accessapproval/apiv1/doc.go b/accessapproval/apiv1/doc.go index 8f2f53da145..5a252e38960 100644 --- a/accessapproval/apiv1/doc.go +++ b/accessapproval/apiv1/doc.go @@ -132,7 +132,7 @@ func checkDisableDeadlines() (bool, error) { } // DefaultAuthScopes reports the default set of authentication scopes to use with this package. -func defaultAuthScopes() []string { +func DefaultAuthScopes() []string { return []string{ "https://www.googleapis.com/auth/cloud-platform", } From b525d071f23eb182426fcc3920507928516f8b78 Mon Sep 17 00:00:00 2001 From: noahdietz Date: Wed, 19 Oct 2022 16:41:27 -0700 Subject: [PATCH 09/12] rename and log no changes --- .github/workflows/apidiff.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/apidiff.yml b/.github/workflows/apidiff.yml index d84136d25db..9622f884a5b 100644 --- a/.github/workflows/apidiff.yml +++ b/.github/workflows/apidiff.yml @@ -4,7 +4,7 @@ on: pull_request: jobs: - setup: + scan_changes: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -24,6 +24,7 @@ jobs: if [ -z "$dirs" ] then echo "changed={\"changed\":[]}" >> $GITHUB_OUTPUT + echo "No changes worth diffing!" else for d in $dirs; do list=${list},\"${d}\"; done echo "changed={\"changed\":[${list#,}]}" >> $GITHUB_OUTPUT @@ -31,12 +32,12 @@ jobs: outputs: changed_dirs: ${{ steps.changed_dirs.outputs.changed }} apidiff: - needs: setup + needs: scan_changes runs-on: ubuntu-latest if: "!contains(github.event.pull_request.labels.*.name, 'breaking change allowed')" continue-on-error: true strategy: - matrix: ${{ fromJson(needs.setup.outputs.changed_dirs) }} + matrix: ${{ fromJson(needs.scan_changes.outputs.changed_dirs) }} steps: - uses: actions/setup-go@v3 with: From 0b6ec0514c65aa87d77adbd82e4c7d27d4fa98ef Mon Sep 17 00:00:00 2001 From: noahdietz Date: Wed, 19 Oct 2022 16:43:40 -0700 Subject: [PATCH 10/12] remove Kokoro-based apidiff --- internal/apidiff/apidiff.go | 227 ---------------------- internal/apidiff/apidiff_test.go | 66 ------- internal/kokoro/check_incompat_changes.sh | 24 --- internal/kokoro/presubmit.sh | 1 - 4 files changed, 318 deletions(-) delete mode 100644 internal/apidiff/apidiff.go delete mode 100644 internal/apidiff/apidiff_test.go delete mode 100755 internal/kokoro/check_incompat_changes.sh diff --git a/internal/apidiff/apidiff.go b/internal/apidiff/apidiff.go deleted file mode 100644 index cd73e97c53c..00000000000 --- a/internal/apidiff/apidiff.go +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build linux || darwin -// +build linux darwin - -package main - -import ( - "flag" - "fmt" - "io/ioutil" - "log" - "os" - osexec "os/exec" - "path" - "strings" -) - -// TODO(noahdietz): remove this once the fix in golang.org/x/tools is released. -// https://github.com/golang/go/issues/44796 -const ignored = "- MaxPublishRequestBytes: value changed from 0.000582077 to 10000000" -const rootMod = "cloud.google.com/go" - -var verbose bool -var mod string -var base string - -func init() { - flag.StringVar(&mod, "mod", "", "import path of a specific module to diff") - flag.BoolVar(&verbose, "verbose", false, "enable verbose command logging") - flag.StringVar(&base, "base", "", "path to a copy of google-cloud-go to use as the base") -} - -func main() { - flag.Parse() - - head, err := exec("git", "log", "-2") - if err != nil { - log.Fatalln(err) - } - if checkAllowBreakingChange(head) { - return - } - - root, err := os.Getwd() - if err != nil { - log.Fatalln(err) - } - - _, err = exec("go", "install", "golang.org/x/exp/cmd/apidiff@latest") - if err != nil { - log.Fatalln(err) - } - - if base == "" { - temp, err := ioutil.TempDir("/tmp", "google-cloud-go-*") - if err != nil { - log.Fatalln(err) - } - defer os.RemoveAll(temp) - - _, err = exec("git", "clone", "https://github.com/googleapis/google-cloud-go", temp) - if err != nil { - log.Fatalln(err) - } - } - - diffs, diffingErrs, err := diffModules(root, base) - if err != nil { - log.Fatalln(err) - } - - if len(diffingErrs) > 0 { - fmt.Fprintln(os.Stderr, "The following packages encountered errors:") - for imp, err := range diffingErrs { - fmt.Fprintf(os.Stderr, "%s: %s\n", imp, err) - } - } - - if len(diffs) > 0 { - fmt.Fprintln(os.Stderr, "The following breaking changes were found:") - for imp, d := range diffs { - fmt.Fprintf(os.Stderr, "%s:\n%s\n", imp, d) - } - os.Exit(1) - } -} - -func diffModules(root, baseDir string) (map[string]string, map[string]error, error) { - diffs := map[string]string{} - issues := map[string]error{} - - m, err := mods() - if err != nil { - return nil, nil, err - } - - for _, modDir := range m { - modPkg := strings.TrimPrefix(modDir, "./") - modPkg = strings.TrimSuffix(modPkg, "/go.mod") - modImp := rootMod + "/" + modPkg - modAbsDir := path.Join(root, modPkg) - - if mod != "" && modImp != mod { - continue - } - - baseModDir := path.Join(baseDir, modPkg) - - subp, err := subpackages(baseModDir) - if err != nil { - return nil, nil, err - } - - for _, sub := range subp { - if sub == "." { - continue - } - subImp := modImp + strings.TrimPrefix(sub, ".") - - // Create apidiff base from repo remote HEAD. - base, err := writeBase(baseModDir, sub) - if err != nil { - issues[subImp] = err - continue - } - - // Diff the current checked out change against remote HEAD base. - out, err := diff(modAbsDir, sub, base) - if err != nil { - issues[subImp] = err - continue - } - - if out != "" && out != ignored { - diffs[subImp] = out - } - } - } - - return diffs, issues, nil -} - -func writeBase(baseModDir, subPkg string) (string, error) { - base := path.Join(baseModDir, "pkg.main") - _, err := execDir(baseModDir, "apidiff", "-w", base, subPkg) - - return base, err -} - -func diff(modDir, subpkg, base string) (string, error) { - out, err := execDir(modDir, "apidiff", "-allow-internal", "-incompatible", base, subpkg) - if err != nil { - return "", err - } - - return out, err -} - -func checkAllowBreakingChange(commit string) bool { - if strings.Contains(commit, "BREAKING CHANGE:") { - log.Println("Not running apidiff because description contained tag BREAKING_CHANGE.") - return true - } - - split := strings.Split(commit, "\n") - for _, s := range split { - if strings.Contains(s, "!:") || strings.Contains(s, "!(") { - log.Println("Not running apidiff because description contained breaking change indicator '!'.") - return true - } - } - - return false -} - -func mods() ([]string, error) { - out, err := exec("find", ".", "-name", "go.mod", "-not", "-path", "./internal/*", "-not", "-path", "./go.mod") - if err != nil { - return nil, err - } - return strings.Split(out, "\n"), nil -} - -func subpackages(base string) ([]string, error) { - out, err := execDir(base, "find", ".", "-mindepth", "1", "-name", "doc.go", "-exec", "dirname", "{}", "\\", ";") - if err != nil { - return nil, err - } - return strings.Split(out, "\n"), nil -} - -func execDir(dir, cmd string, args ...string) (string, error) { - if verbose { - log.Printf("+ %s %s\n", cmd, strings.Join(args, " ")) - } - c := osexec.Command(cmd, args...) - c.Dir = dir - out, err := c.CombinedOutput() - if err != nil { - return "", fmt.Errorf("%s: %w", out, err) - } - return strings.TrimSpace(string(out)), nil -} - -func exec(cmd string, args ...string) (string, error) { - if verbose { - log.Printf("+ %s %s\n", cmd, strings.Join(args, " ")) - } - out, err := osexec.Command(cmd, args...).CombinedOutput() - if err != nil { - return "", fmt.Errorf("%s: %w", out, err) - } - return strings.TrimSpace(string(out)), nil -} diff --git a/internal/apidiff/apidiff_test.go b/internal/apidiff/apidiff_test.go deleted file mode 100644 index e4c4bf5b571..00000000000 --- a/internal/apidiff/apidiff_test.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build linux || darwin -// +build linux darwin - -package main - -import "testing" - -func TestCheckAllowBreakingChange(t *testing.T) { - for _, tst := range []struct { - name, msg string - want bool - }{ - { - name: "disallow - no indicator", - msg: "feat: add foo", - want: false, - }, - { - name: "allow - bang indicator", - msg: "feat!: remove foo", - want: true, - }, - { - name: "allow - bang indicator pre-scope", - msg: "feat!(scope): remove foo", - want: true, - }, - { - name: "allow - tag indicator", - msg: "BREAKING CHANGE: remove foo", - want: true, - }, - { - name: "allow - multiline bang indicator", - msg: `feat: add foo - feat!: remove bar - chore: update dep`, - want: true, - }, - { - name: "allow - multiline tag indicator", - msg: `feat: add foo - BREAKING CHANGE: remove bar - chore: update dep`, - want: true, - }, - } { - if got := checkAllowBreakingChange(tst.msg); got != tst.want { - t.Errorf("%s: got %v want %v", tst.name, got, tst.want) - } - } -} diff --git a/internal/kokoro/check_incompat_changes.sh b/internal/kokoro/check_incompat_changes.sh deleted file mode 100755 index fc8b993e0c3..00000000000 --- a/internal/kokoro/check_incompat_changes.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Display commands being run -set -x - -# Only run apidiff checks on latest (we only need it once). -if [[ `go version` != *"go1.19"* ]]; then - exit 0 -fi - -go run ./internal/apidiff -verbose diff --git a/internal/kokoro/presubmit.sh b/internal/kokoro/presubmit.sh index 45cf45ed5ca..f4cf20fd48d 100755 --- a/internal/kokoro/presubmit.sh +++ b/internal/kokoro/presubmit.sh @@ -41,7 +41,6 @@ try3() { eval "$*" || eval "$*" || eval "$*"; } # All packages, including +build tools, are fetched. try3 go mod download ./internal/kokoro/vet.sh -./internal/kokoro/check_incompat_changes.sh set +e # Run all tests, don't stop after the first failure. exit_code=0 From 04670cba65dcdab08dff1fccc56afcd78f6e89b2 Mon Sep 17 00:00:00 2001 From: noahdietz Date: Wed, 19 Oct 2022 17:03:50 -0700 Subject: [PATCH 11/12] add cat to prevent grep no match error --- .github/workflows/apidiff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/apidiff.yml b/.github/workflows/apidiff.yml index 9622f884a5b..c8f8d60a1f7 100644 --- a/.github/workflows/apidiff.yml +++ b/.github/workflows/apidiff.yml @@ -20,7 +20,7 @@ jobs: run: | tree=$(git diff-tree --no-commit-id --name-only --diff-filter=DMR -r ${{ steps.main.outputs.hash }}..HEAD) uniques=$(echo $tree | xargs -r -L1 dirname | uniq) - dirs=$(echo $uniques | grep -v -e 'internal' -e '\.') + dirs=$(echo $uniques | grep -v -e 'internal' -e '\.' | cat) if [ -z "$dirs" ] then echo "changed={\"changed\":[]}" >> $GITHUB_OUTPUT From f36a567a404dc3ca497a2257371465234be40b1e Mon Sep 17 00:00:00 2001 From: noahdietz Date: Thu, 20 Oct 2022 07:47:05 -0700 Subject: [PATCH 12/12] add new line to end of file --- .github/workflows/apidiff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/apidiff.yml b/.github/workflows/apidiff.yml index c8f8d60a1f7..f45bc49a884 100644 --- a/.github/workflows/apidiff.yml +++ b/.github/workflows/apidiff.yml @@ -80,4 +80,4 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, labels: ['breaking change'] - }) \ No newline at end of file + })