vet & github: run vet separately from tests; make vet-proto only check protos (#5873)

This commit is contained in:
Doug Fawley 2022-12-16 16:37:31 -08:00 committed by GitHub
parent 81ad1b550f
commit 70617b11fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 10 deletions

View File

@ -19,6 +19,8 @@ jobs:
vet-proto:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
VET_ONLY_PROTO: 1
steps:
# Setup the environment.
- name: Setup Go
@ -43,7 +45,10 @@ jobs:
fail-fast: false
matrix:
include:
- type: vet+tests
- type: vet
goversion: 1.19
- type: tests
goversion: 1.19
- type: tests
@ -93,13 +98,13 @@ jobs:
# Only run vet for 'vet' runs.
- name: Run vet.sh
if: startsWith(matrix.type, 'vet')
if: matrix.type == 'vet'
run: ./vet.sh -install && ./vet.sh
# Main tests run for everything except when testing "extras"
# (where we run a reduced set of tests).
- name: Run tests
if: contains(matrix.type, 'tests')
if: matrix.type == 'tests'
run: |
go version
go test ${{ matrix.testflags }} -cpu 1,4 -timeout 7m google.golang.org/grpc/...

18
vet.sh
View File

@ -66,6 +66,17 @@ elif [[ "$#" -ne 0 ]]; then
die "Unknown argument(s): $*"
fi
# - Check that generated proto files are up to date.
if [[ -z "${VET_SKIP_PROTO}" ]]; then
PATH="/home/travis/bin:${PATH}" make proto && \
git status --porcelain 2>&1 | fail_on_output || \
(git status; git --no-pager diff; exit 1)
fi
if [[ -n "${VET_ONLY_PROTO}" ]]; then
exit 0
fi
# - Ensure all source files contain a copyright message.
# (Done in two parts because Darwin "git grep" has broken support for compound
# exclusion matches.)
@ -93,13 +104,6 @@ git grep '"github.com/envoyproxy/go-control-plane/envoy' -- '*.go' ':(exclude)*.
misspell -error .
# - Check that generated proto files are up to date.
if [[ -z "${VET_SKIP_PROTO}" ]]; then
PATH="/home/travis/bin:${PATH}" make proto && \
git status --porcelain 2>&1 | fail_on_output || \
(git status; git --no-pager diff; exit 1)
fi
# - gofmt, goimports, golint (with exceptions for generated code), go vet,
# go mod tidy.
# Perform these checks on each module inside gRPC.