...
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
10permissions:
11 contents: read
12
13# Always force the use of Go modules
14env:
15 GO111MODULE: on
16
17jobs:
18 # Check generated protos match their source repos (optional for PRs).
19 vet-proto:
20 runs-on: ubuntu-latest
21 timeout-minutes: 20
22 steps:
23 # Setup the environment.
24 - name: Setup Go
25 uses: actions/setup-go@v5
26 with:
27 go-version: '1.22'
28 - name: Checkout repo
29 uses: actions/checkout@v4
30
31 # Run the vet-proto checks.
32 - name: vet-proto
33 run: ./scripts/vet-proto.sh -install && ./scripts/vet-proto.sh
34
35 # Run the main gRPC-Go tests.
36 tests:
37 runs-on: ubuntu-latest
38 timeout-minutes: 20
39 strategy:
40 fail-fast: false
41 matrix:
42 include:
43 - type: vet
44 goversion: '1.22'
45
46 - type: extras
47 goversion: '1.22'
48
49 - type: tests
50 goversion: '1.22'
51
52 - type: tests
53 goversion: '1.22'
54 testflags: -race
55
56 - type: tests
57 goversion: '1.22'
58 goarch: 386
59
60 - type: tests
61 goversion: '1.22'
62 goarch: arm64
63
64 - type: tests
65 goversion: '1.21'
66
67 - type: tests
68 goversion: '1.20'
69 steps:
70 # Setup the environment.
71 - name: Setup GOARCH
72 if: matrix.goarch != ''
73 run: echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV
74
75 - name: Setup qemu emulator
76 if: matrix.goarch == 'arm64'
77 # setup qemu-user-static emulator and register it with binfmt_misc so that aarch64 binaries
78 # are automatically executed using qemu.
79 run: docker run --rm --privileged multiarch/qemu-user-static:5.2.0-2 --reset --credential yes --persistent yes
80
81 - name: Setup GRPC environment
82 if: matrix.grpcenv != ''
83 run: echo "${{ matrix.grpcenv }}" >> $GITHUB_ENV
84
85 - name: Setup Go
86 uses: actions/setup-go@v5
87 with:
88 go-version: ${{ matrix.goversion }}
89
90 - name: Checkout repo
91 uses: actions/checkout@v4
92
93 # Only run vet for 'vet' runs.
94 - name: Run vet.sh
95 if: matrix.type == 'vet'
96 run: ./scripts/vet.sh -install && ./scripts/vet.sh
97
98 # Main tests run for everything except when testing "extras"
99 # (where we run a reduced set of tests).
100 - name: Run tests
101 if: matrix.type == 'tests'
102 run: |
103 go version
104 go test ${{ matrix.testflags }} -cpu 1,4 -timeout 7m google.golang.org/grpc/...
105 cd "${GITHUB_WORKSPACE}"
106 for MOD_FILE in $(find . -name 'go.mod' | grep -Ev '^\./go\.mod'); do
107 pushd "$(dirname ${MOD_FILE})"
108 go test ${{ matrix.testflags }} -cpu 1,4 -timeout 2m ./...
109 popd
110 done
111
112 # Non-core gRPC tests (examples, interop, etc)
113 - name: Run extras tests
114 if: matrix.type == 'extras'
115 run: |
116 export TERM=${TERM:-xterm}
117 go version
118 echo -e "\n-- Running Examples --"
119 examples/examples_test.sh
120 echo -e "\n-- Running AdvancedTLS Examples --"
121 security/advancedtls/examples/examples_test.sh
122 echo -e "\n-- Running Interop Test --"
123 interop/interop_test.sh
124 echo -e "\n-- Running xDS E2E Test --"
125 xds/internal/test/e2e/run.sh
126 echo -e "\n-- Running protoc-gen-go-grpc test --"
127 ./scripts/vet-proto.sh -install
128 cmd/protoc-gen-go-grpc/protoc-gen-go-grpc_test.sh
View as plain text