github: testing action workflow improvements and update to test Go1.16 (#4358)

This commit is contained in:
Doug Fawley 2021-04-22 14:59:51 -07:00 committed by GitHub
parent f02863c306
commit 74fe6eaa41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
69 changed files with 175 additions and 48 deletions

View File

@ -37,71 +37,77 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- type: vet - type: vet+tests
goversion: 1.15 goversion: 1.16
- type: race
goversion: 1.15 - type: tests
- type: 386 goversion: 1.16
goversion: 1.15 testflags: -race
- type: retry
goversion: 1.15 - type: tests
goversion: 1.16
grpcenv: GRPC_GO_RETRY=on
- type: extras - type: extras
goversion: 1.16
- type: tests
goversion: 1.16
goarch: 386
- type: tests
goversion: 1.16
goarch: arm64
- type: tests
goversion: 1.15 goversion: 1.15
- type: tests - type: tests
goversion: 1.14 goversion: 1.14
- type: tests
goversion: 1.13 - type: tests # Keep until interop tests no longer require Go1.11
- type: tests111 goversion: 1.11
goversion: 1.11 # Keep until interop tests no longer require Go1.11
- type: arm64
goversion: 1.15
steps: steps:
# Setup the environment. # Setup the environment.
- name: Setup GOARCH=386 - name: Setup GOARCH
if: ${{ matrix.type == '386' }} if: matrix.goarch != ''
run: echo "GOARCH=386" >> $GITHUB_ENV run: echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV
- name: Setup GOARCH=arm64
if: ${{ matrix.type == 'arm64' }}
run: echo "GOARCH=arm64" >> $GITHUB_ENV
- name: Setup qemu emulator - name: Setup qemu emulator
if: ${{ matrix.type == 'arm64' }} if: matrix.goarch == 'arm64'
# setup qemu-user-static emulator and register it with binfmt_misc so that aarch64 binaries # setup qemu-user-static emulator and register it with binfmt_misc so that aarch64 binaries
# are automatically executed using qemu. # are automatically executed using qemu.
run: docker run --rm --privileged multiarch/qemu-user-static:5.2.0-2 --reset --credential yes --persistent yes run: docker run --rm --privileged multiarch/qemu-user-static:5.2.0-2 --reset --credential yes --persistent yes
- name: Setup RETRY
if: ${{ matrix.type == 'retry' }} - name: Setup GRPC environment
run: echo "GRPC_GO_RETRY=on" >> $GITHUB_ENV if: matrix.grpcenv != ''
run: echo "${{ matrix.grpcenv }}" >> $GITHUB_ENV
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: ${{ matrix.goversion }} go-version: ${{ matrix.goversion }}
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v2
# Only run vet for 'vet' runs. # Only run vet for 'vet' runs.
- name: Run vet.sh - name: Run vet.sh
if: ${{ matrix.type == 'vet' }} if: startsWith(matrix.type, 'vet')
run: ./vet.sh -install && ./vet.sh run: ./vet.sh -install && ./vet.sh
# Main tests run for everything except when testing "extras", the race # Main tests run for everything except when testing "extras"
# detector and Go1.11 (where we run a reduced set of tests). # (where we run a reduced set of tests).
- name: Run tests - name: Run tests
if: ${{ matrix.type != 'extras' && matrix.type != 'race' && matrix.type != 'tests111' }} if: contains(matrix.type, 'tests')
run: | run: |
go version go version
go test -cpu 1,4 -timeout 7m google.golang.org/grpc/... go test ${{ matrix.testflags }} -cpu 1,4 -timeout 7m google.golang.org/grpc/...
# Race detector tests
- name: Run test race
if: ${{ matrix.TYPE == 'race' }}
run: |
go version
go test -race -cpu 1,4 -timeout 7m google.golang.org/grpc/...
# Non-core gRPC tests (examples, interop, etc) # Non-core gRPC tests (examples, interop, etc)
- name: Run extras tests - name: Run extras tests
if: ${{ matrix.TYPE == 'extras' }} if: matrix.type == 'extras'
run: | run: |
go version go version
examples/examples_test.sh examples/examples_test.sh
@ -109,12 +115,3 @@ jobs:
interop/interop_test.sh interop/interop_test.sh
cd ${GITHUB_WORKSPACE}/security/advancedtls && go test -cpu 1,4 -timeout 7m google.golang.org/grpc/security/advancedtls/... cd ${GITHUB_WORKSPACE}/security/advancedtls && go test -cpu 1,4 -timeout 7m google.golang.org/grpc/security/advancedtls/...
cd ${GITHUB_WORKSPACE}/security/authorization && go test -cpu 1,4 -timeout 7m google.golang.org/grpc/security/authorization/... cd ${GITHUB_WORKSPACE}/security/authorization && go test -cpu 1,4 -timeout 7m google.golang.org/grpc/security/authorization/...
# Reduced set of tests for Go 1.11
- name: Run Go1.11 tests
if: ${{ matrix.type == 'tests111' }}
run: |
go version
tests=$(find ${GITHUB_WORKSPACE} -name '*_test.go' | xargs -n1 dirname | sort -u | sed "s:^${GITHUB_WORKSPACE}:.:" | sed "s:\/$::" | grep -v ^./security | grep -v ^./credentials/sts | grep -v ^./credentials/tls/certprovider | grep -v ^./credentials/xds | grep -v ^./xds )
echo "Running tests for " ${tests}
go test -cpu 1,4 -timeout 7m ${tests}

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.
* *

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2021 gRPC authors. * Copyright 2021 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2021 gRPC authors. * Copyright 2021 gRPC authors.

View File

@ -41,7 +41,7 @@ func getFromMetadata(timeout time.Duration, urlStr string) ([]byte, error) {
} }
resp, err := client.Do(req) resp, err := client.Do(req)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed communicating with metadata server: %w", err) return nil, fmt.Errorf("failed communicating with metadata server: %v", err)
} }
defer resp.Body.Close() defer resp.Body.Close()
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
@ -49,7 +49,7 @@ func getFromMetadata(timeout time.Duration, urlStr string) ([]byte, error) {
} }
body, err := ioutil.ReadAll(resp.Body) body, err := ioutil.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed reading from metadata server: %w", err) return nil, fmt.Errorf("failed reading from metadata server: %v", err)
} }
return body, nil return body, nil
} }

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.
* *

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.
* *

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.
* *

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.
* *

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.
* *

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.
* *

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2021 gRPC authors. * Copyright 2021 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2021 gRPC authors. * Copyright 2021 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2021 gRPC authors. * Copyright 2021 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2021 gRPC authors. * Copyright 2021 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,4 @@
// +build go1.12
// +build !386 // +build !386
/* /*

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2019 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2021 gRPC authors. * Copyright 2021 gRPC authors.

View File

@ -1,3 +1,4 @@
// +build go1.12
// +build !386 // +build !386
/* /*

View File

@ -1,3 +1,4 @@
// +build go1.12
// +build !386 // +build !386
/* /*

View File

@ -1,3 +1,4 @@
// +build go1.12
// +build !386 // +build !386
/* /*

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.

View File

@ -1,3 +1,5 @@
// +build go1.12
/* /*
* *
* Copyright 2020 gRPC authors. * Copyright 2020 gRPC authors.