mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
41
vendor/google.golang.org/genproto/internal/kokoro/check_incompat_changes.sh
generated
vendored
Executable file
41
vendor/google.golang.org/genproto/internal/kokoro/check_incompat_changes.sh
generated
vendored
Executable file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Display commands being run
|
||||
set -x
|
||||
|
||||
# Only run apidiff checks on go1.11 (we only need it once).
|
||||
# TODO(deklerk) We should pass an environment variable from kokoro to decide
|
||||
# this logic instead.
|
||||
if [[ `go version` != *"go1.11"* ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
try3() { eval "$*" || eval "$*" || eval "$*"; }
|
||||
|
||||
try3 go get -u 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://github.com/google/go-genproto /tmp/genproto
|
||||
|
||||
V1_DIRS=`find . -type d -regex '.*v1$'`
|
||||
V1_SUBDIRS=`find . -type d -regex '.*v1\/.*'`
|
||||
for dir in $V1_DIRS $V1_SUBDIRS; do
|
||||
# turns things like ./foo/bar into foo/bar
|
||||
dir_without_junk=`echo $dir | sed -n "s#\(\.\/\)\(.*\)#\2#p"`
|
||||
pkg="google.golang.org/genproto/$dir_without_junk"
|
||||
echo "Testing $pkg"
|
||||
|
||||
cd /tmp/genproto
|
||||
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
|
||||
exit 1
|
||||
fi
|
||||
done
|
31
vendor/google.golang.org/genproto/internal/kokoro/test.sh
generated
vendored
Executable file
31
vendor/google.golang.org/genproto/internal/kokoro/test.sh
generated
vendored
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Fail on any error
|
||||
set -eo pipefail
|
||||
|
||||
# Display commands being run
|
||||
set -x
|
||||
|
||||
# cd to project dir on Kokoro instance
|
||||
cd github/go-genproto
|
||||
|
||||
go version
|
||||
|
||||
# Set $GOPATH
|
||||
export GOPATH="$HOME/go"
|
||||
export GENPROTO_HOME=$GOPATH/src/google.golang.org/genproto
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
mkdir -p $GENPROTO_HOME
|
||||
|
||||
# Move code into $GOPATH and get dependencies
|
||||
git clone . $GENPROTO_HOME
|
||||
cd $GENPROTO_HOME
|
||||
|
||||
try3() { eval "$*" || eval "$*" || eval "$*"; }
|
||||
try3 go get -v -t ./...
|
||||
|
||||
./internal/kokoro/vet.sh
|
||||
./internal/kokoro/check_incompat_changes.sh
|
||||
|
||||
# Run tests and tee output to log file, to be pushed to GCS as artifact.
|
||||
go test -race -v ./... 2>&1 | tee $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt
|
24
vendor/google.golang.org/genproto/internal/kokoro/trampoline.sh
generated
vendored
Normal file
24
vendor/google.golang.org/genproto/internal/kokoro/trampoline.sh
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2018 Google Inc.
|
||||
#
|
||||
# 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.
|
||||
set -eo pipefail
|
||||
# Always run the cleanup script, regardless of the success of bouncing into
|
||||
# the container.
|
||||
function cleanup() {
|
||||
chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh
|
||||
${KOKORO_GFILE_DIR}/trampoline_cleanup.sh
|
||||
echo "cleanup";
|
||||
}
|
||||
trap cleanup EXIT
|
||||
python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py"
|
37
vendor/google.golang.org/genproto/internal/kokoro/vet.sh
generated
vendored
Executable file
37
vendor/google.golang.org/genproto/internal/kokoro/vet.sh
generated
vendored
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Fail on any error
|
||||
set -eo pipefail
|
||||
|
||||
# Display commands being run
|
||||
set -x
|
||||
|
||||
# Only run the linter on go1.11, since it needs type aliases (and we only care
|
||||
# about its output once).
|
||||
# TODO(deklerk) We should pass an environment variable from kokoro to decide
|
||||
# this logic instead.
|
||||
if [[ `go version` != *"go1.11"* ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
pwd
|
||||
|
||||
# Fail if a dependency was added without the necessary go.mod/go.sum change
|
||||
# being part of the commit.
|
||||
GO111MODULE=on go mod tidy
|
||||
git diff go.mod | tee /dev/stderr | (! read)
|
||||
git diff go.sum | tee /dev/stderr | (! read)
|
||||
|
||||
try3() { eval "$*" || eval "$*" || eval "$*"; }
|
||||
|
||||
try3 go get -u \
|
||||
golang.org/x/lint/golint \
|
||||
golang.org/x/tools/cmd/goimports \
|
||||
honnef.co/go/tools/cmd/staticcheck
|
||||
|
||||
# Look at all .go files (ignoring .pb.go files) and make sure they have a Copyright. Fail if any don't.
|
||||
git ls-files "*[^.pb].go" | xargs grep -L "\(Copyright [0-9]\{4,\}\)" 2>&1 | tee /dev/stderr | (! read)
|
||||
gofmt -s -d -l . 2>&1 | tee /dev/stderr | (! read)
|
||||
goimports -l . 2>&1 | tee /dev/stderr | (! read)
|
||||
|
||||
# No need to golint / staticcheck when it's just proto-generated files
|
Reference in New Issue
Block a user