Skip to content

Commit

Permalink
github: add Github Actions workflow for tests; support in vet.sh (#4005)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley authored and GarrettGutierrez1 committed Nov 6, 2020
1 parent 8a0ca33 commit 0afe9d2
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Testing

# Trigger on pushes, PRs (excluding documentation changes), and nightly.
on:
push:
pull_request:
paths-ignore:
- 'Documentation/**'
- 'version.go'
schedule:
- cron: 0 0 * * * # daily at 00:00

# Always force the use of Go modules
env:
GO111MODULE: on

jobs:
# Check generated protos match their source repos (optional for PRs).
vet-proto:
runs-on: ubuntu-latest
steps:
# Setup the environment.
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Checkout repo
uses: actions/checkout@v2

# Run the vet checks.
- name: vet
run: ./vet.sh -install && ./vet.sh

# Run the main gRPC-Go tests.
tests:
# Proto checks are run in the above job.
env:
VET_SKIP_PROTO: 1
runs-on: ubuntu-latest
strategy:
matrix:
include:
- type: vet
goversion: 1.14
- type: race
goversion: 1.14
- type: 386
goversion: 1.14
- type: retry
goversion: 1.14
- type: extras
goversion: 1.14
- type: tests
goversion: 1.13
- type: tests
goversion: 1.12
- type: tests
goversion: 1.11 # Keep until interop tests no longer require Go1.11

steps:
# Setup the environment.
- name: Setup GOARCH=386
if: ${{ matrix.type == '386' }}
run: echo "GOARCH=386" >> $GITHUB_ENV
- name: Setup RETRY
if: ${{ matrix.type == 'retry' }}
run: echo "GRPC_GO_RETRY=on" >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.goversion }}
- name: Checkout repo
uses: actions/checkout@v2

# Only run vet for 'vet' runs.
- name: Run vet.sh
if: ${{ matrix.type == 'vet' }}
run: ./vet.sh -install && ./vet.sh

# Main tests run for everything except when testing "extras" and the race detector.
- name: Run tests
if: ${{ matrix.type != 'extras' && matrix.type != 'race' }}
run: make test

# Race detector tests
- name: Run test race
if: ${{ matrix.TYPE == 'race' }}
run: make testrace

# Non-core gRPC tests (examples, interop, etc)
- name: Run extras tests
if: ${{ matrix.TYPE == 'extras' }}
run: |
examples/examples_test.sh
security/advancedtls/examples/examples_test.sh
interop/interop_test.sh
make testsubmodule
8 changes: 8 additions & 0 deletions vet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ if [[ "$1" = "-install" ]]; then
unzip ${PROTOC_FILENAME}
bin/protoc --version
popd
elif [[ "${GITHUB_ACTIONS}" = "true" ]]; then
PROTOBUF_VERSION=3.3.0
PROTOC_FILENAME=protoc-${PROTOBUF_VERSION}-linux-x86_64.zip
pushd /home/runner/go
wget https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/${PROTOC_FILENAME}
unzip ${PROTOC_FILENAME}
bin/protoc --version
popd
elif not which protoc > /dev/null; then
die "Please install protoc into your path"
fi
Expand Down

0 comments on commit 0afe9d2

Please sign in to comment.