67 lines (65 loc) · 2.12 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: "build"
on:
push:
branches:
- "master"
pull_request:
branches:
- "!dependabot/*"
- "*"
jobs:
lint:
name: "Lint"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/setup-go@v2"
with:
go-version: ^1.16
- name: "Install linting tools"
run: |
# This is done before checking out, as to not modify go.mod
go install mvdan.cc/gofumpt/gofumports@latest
go install github.com/mgechev/revive@latest
go install golang.org/x/tools/cmd/stringer@latest
- uses: "actions/checkout@v2"
- name: "Go Mod Tidy"
run: "go mod tidy && bash -c '[ $(git status --porcelain | tee /dev/fd/2 | wc -c) -eq 0 ]'"
- name: "Formatting (gofumpt)"
run: |
GOFUMPT_OUTPUT="$(find . -iname '*.go' -type f | grep -v pb.go | grep -v 'pb.*.go' | xargs gofumports -d)"
if [ -n "$GOFUMPT_OUTPUT" ]; then
echo "All the following files are not correctly formatted"
echo "${GOFUMPT_OUTPUT}"
exit 1
fi
- name: "Linting (revive)"
run: "bash -c '[ $(find . -iname '*.go' -type f | grep -v 'pb.*.go' | xargs revive | tee /dev/fd/2 | wc -c) -eq 0 ]'"
test:
name: "Test"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.16"
- uses: "authzed/action-testserver@v3"
- name: "go test"
run: "go test -tags integration ./..."
protobuf:
name: "Generate Protobufs"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/setup-go@v2"
with:
go-version: "^1.16"
- name: "Install Go Protobuf plugins"
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1
go install github.com/envoyproxy/protoc-gen-validate@v0.6.1
- uses: "actions/checkout@v2"
- uses: "bufbuild/buf-setup-action@v0.5.0"
with:
version: "1.0.0-rc6"
- name: "Generate & Diff Protos"
run: "./buf.gen.yaml && git diff && bash -c '[ $(git status --porcelain | tee /dev/fd/2 | wc -c) -eq 0 ]'"