1name: Testing 2 3# Trigger on pushes, PRs (excluding documentation changes), and nightly. 4on: 5 push: 6 pull_request: 7 schedule: 8 - cron: 0 0 * * * # daily at 00:00 9 10# Always force the use of Go modules 11env: 12 GO111MODULE: on 13 14jobs: 15 # Check generated protos match their source repos (optional for PRs). 16 vet-proto: 17 runs-on: ubuntu-latest 18 steps: 19 # Setup the environment. 20 - name: Setup Go 21 uses: actions/setup-go@v2 22 with: 23 go-version: 1.15 24 - name: Checkout repo 25 uses: actions/checkout@v2 26 27 # Run the vet checks. 28 - name: vet 29 run: ./vet.sh -install && ./vet.sh 30 31 # Run the main gRPC-Go tests. 32 tests: 33 # Proto checks are run in the above job. 34 env: 35 VET_SKIP_PROTO: 1 36 runs-on: ubuntu-latest 37 strategy: 38 matrix: 39 include: 40 - type: vet 41 goversion: 1.15 42 - type: race 43 goversion: 1.15 44 - type: 386 45 goversion: 1.15 46 - type: retry 47 goversion: 1.15 48 - type: extras 49 goversion: 1.15 50 - type: tests 51 goversion: 1.14 52 - type: tests 53 goversion: 1.13 54 - type: tests111 55 goversion: 1.11 # Keep until interop tests no longer require Go1.11 56 57 steps: 58 # Setup the environment. 59 - name: Setup GOARCH=386 60 if: ${{ matrix.type == '386' }} 61 run: echo "GOARCH=386" >> $GITHUB_ENV 62 - name: Setup RETRY 63 if: ${{ matrix.type == 'retry' }} 64 run: echo "GRPC_GO_RETRY=on" >> $GITHUB_ENV 65 - name: Setup Go 66 uses: actions/setup-go@v2 67 with: 68 go-version: ${{ matrix.goversion }} 69 - name: Checkout repo 70 uses: actions/checkout@v2 71 72 # Only run vet for 'vet' runs. 73 - name: Run vet.sh 74 if: ${{ matrix.type == 'vet' }} 75 run: ./vet.sh -install && ./vet.sh 76 77 # Main tests run for everything except when testing "extras", the race 78 # detector and Go1.11 (where we run a reduced set of tests). 79 - name: Run tests 80 if: ${{ matrix.type != 'extras' && matrix.type != 'race' && matrix.type != 'tests111' }} 81 run: | 82 go version 83 go test -cpu 1,4 -timeout 7m google.golang.org/grpc/... 84 85 # Race detector tests 86 - name: Run test race 87 if: ${{ matrix.TYPE == 'race' }} 88 run: | 89 go version 90 go test -race -cpu 1,4 -timeout 7m google.golang.org/grpc/... 91 92 # Non-core gRPC tests (examples, interop, etc) 93 - name: Run extras tests 94 if: ${{ matrix.TYPE == 'extras' }} 95 run: | 96 go version 97 examples/examples_test.sh 98 security/advancedtls/examples/examples_test.sh 99 interop/interop_test.sh 100 cd ${GITHUB_WORKSPACE}/security/advancedtls && go test -cpu 1,4 -timeout 7m google.golang.org/grpc/security/advancedtls/... 101 cd ${GITHUB_WORKSPACE}/security/authorization && go test -cpu 1,4 -timeout 7m google.golang.org/grpc/security/authorization/... 102 103 # Reduced set of tests for Go 1.11 104 - name: Run Go1.11 tests 105 if: ${{ matrix.type == 'tests111' }} 106 run: | 107 go version 108 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 ) 109 echo "Running tests for " ${tests} 110 go test -cpu 1,4 -timeout 7m ${tests} 111