Skip to content

Commit 0afe9d2

Browse files
dfawleyGarrettGutierrez1
authored andcommitted
github: add Github Actions workflow for tests; support in vet.sh (#4005)
1 parent 8a0ca33 commit 0afe9d2

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

.github/workflows/testing.yml

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

vet.sh

+8
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ if [[ "$1" = "-install" ]]; then
6060
unzip ${PROTOC_FILENAME}
6161
bin/protoc --version
6262
popd
63+
elif [[ "${GITHUB_ACTIONS}" = "true" ]]; then
64+
PROTOBUF_VERSION=3.3.0
65+
PROTOC_FILENAME=protoc-${PROTOBUF_VERSION}-linux-x86_64.zip
66+
pushd /home/runner/go
67+
wget https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/${PROTOC_FILENAME}
68+
unzip ${PROTOC_FILENAME}
69+
bin/protoc --version
70+
popd
6371
elif not which protoc > /dev/null; then
6472
die "Please install protoc into your path"
6573
fi

0 commit comments

Comments
 (0)