Skip to content

Commit

Permalink
chore: improve grpc tooling and upgrade setup-go to v3 (#2553)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvrach authored Oct 18, 2022
1 parent 26b218c commit ab20ad6
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 62 deletions.
29 changes: 10 additions & 19 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: '~1.18.5'
- uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
check-latest: true
cache: true
- run: go version
- run: go mod download # Not required, used to segregate module download vs test times

Expand All @@ -47,17 +41,11 @@ jobs:
runs-on: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: '~1.18.5'
- uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
check-latest: true
cache: true
- run: go version
- run: go mod download # Not required, used to segregate module download vs test times
- name: Login to DockerHub
Expand All @@ -78,9 +66,12 @@ jobs:
runs-on: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
go-version: '~1.18.5'
check-latest: true
cache: true

- uses: actions/cache@v2
with:
path: |
Expand Down
29 changes: 18 additions & 11 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/setup-go@v3
with:
check-latest: true
cache: true
go-version: '~1.18.5'
- uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go version

- run: go mod tidy
Expand All @@ -38,6 +32,17 @@ jobs:
if: ${{ failure() }}
run: echo '::error file=Makefile,line=11,col=1::Incorrectly generated files. Ensure you have run `make mocks` and committed the files locally.'

- name: install protoc compiler
uses: arduino/setup-protoc@v1
with:
version: '3.x'
- run: make proto
- run: git diff -I '^\/\/\s+-?\s+protoc\s+v' --exit-code ## Ignore protoc version comment
- name: Error message
if: ${{ failure() }}
run: echo 'proto files are not generated correctly. Ensure you have run `make proto` and committed the files locally.'
- run: git checkout proto ## cleanup tree due to protoc version comment

- run: make fmt
- run: git diff --exit-code
- name: Error message
Expand All @@ -47,10 +52,12 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/checkout@v3
go-version: '~1.18.5'
check-latest: true
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ help: ## Show the available commands


install-tools:
go install github.com/golang/mock/mockgen@v1.6.0 || \
GO111MODULE=on go install github.com/golang/mock/mockgen@v1.6.0

go install github.com/golang/mock/mockgen@v1.6.0
go install mvdan.cc/gofumpt@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2.0

.PHONY: lint
lint: fmt ## Run linters on all go files
Expand All @@ -74,6 +74,11 @@ lint: fmt ## Run linters on all go files
fmt: install-tools ## Formats all go files
gofumpt -l -w -extra .

.PHONY: proto
proto: install-tools ## Generate protobuf files
protoc --go_out=paths=source_relative:. proto/**/*.proto
protoc --go-grpc_out=paths=source_relative:. proto/**/*.proto

cleanup-warehouse-integration:
docker-compose -f warehouse/docker-compose.test.yml down --remove-orphans --volumes

Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ require (
github.com/gofrs/uuid v4.2.0+incompatible
github.com/golang-migrate/migrate/v4 v4.15.2
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/gomodule/redigo v1.8.5
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
Expand Down Expand Up @@ -67,7 +66,7 @@ require (
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7
google.golang.org/api v0.95.0
google.golang.org/grpc v1.49.0
google.golang.org/grpc v1.50.0
google.golang.org/protobuf v1.28.1
gopkg.in/alexcesaro/statsd.v2 v2.0.0
gopkg.in/natefinch/lumberjack.v2 v2.0.0
Expand Down Expand Up @@ -196,3 +195,5 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

require github.com/golang/protobuf v1.5.2 // indirect
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2135,8 +2135,8 @@ google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11
google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw=
google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc v1.50.0 h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU=
google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
Expand Down
2 changes: 1 addition & 1 deletion proto/common/dpauth.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/common/dpauth_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions proto/databricks/databricks.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions proto/databricks/databricks_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions proto/databricks/version.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions proto/databricks/version_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions proto/rudder-sources/rudder-sources.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions proto/rudder-sources/rudder-sources_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/warehouse/warehouse.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/warehouse/warehouse_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ab20ad6

Please sign in to comment.