Skip to content

Commit

Permalink
use gomods; add make generate; add CI check for tidiness+generation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 authored Aug 6, 2024
1 parent 242e5e5 commit 0827183
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 22 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/relay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,22 @@ jobs:
path: |
./unit_coverage.txt
./race_coverage.txt
check-tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: "go.mod"
- name: Ensure "make gomodtidy" has been run
run: |
make gomodtidy
git diff --exit-code
- name: Ensure "make generate" has been run
run: |
make rm-mocked
make generate
git diff --exit-code
22 changes: 18 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,25 @@ format-go-fmt:
cd ./ops && go fmt ./...
cd ./integration-tests && go fmt ./...

.PHONY: gomods
gomods: ## Install gomods
go install github.com/jmank88/[email protected]

.PHONY: gomodtidy
gomodtidy:
go mod tidy
cd ./ops && go mod tidy
cd ./integration-tests && go mod tidy
gomodtidy: gomods
gomods tidy

.PHONY: mockery
mockery: $(mockery) ## Install mockery.
go install github.com/vektra/mockery/[email protected]

.PHONY: rm-mocked
rm-mocked:
grep -rl "^// Code generated by mockery" | grep .go$ | xargs -r rm

.PHONY: generate
generate: mockery gomods
gomods -w go generate -x ./...

.PHONY: lint-go
lint-go: lint-go-ops lint-go-relayer lint-go-test
Expand Down
68 changes: 61 additions & 7 deletions pkg/cosmos/client/mocks/ReaderWriter.go

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

33 changes: 24 additions & 9 deletions pkg/monitoring/fcdclient/mocks/Client.go

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

2 changes: 1 addition & 1 deletion pkg/monitoring/mocks/ChainReader.go

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

2 changes: 1 addition & 1 deletion pkg/monitoring/mocks/Metrics.go

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

0 comments on commit 0827183

Please sign in to comment.