Skip to content

Commit

Permalink
ci: generated files check (zeta-chain#873)
Browse files Browse the repository at this point in the history
* ci: check all generated files are up to date

* phone targets

* make generated

* Update .github/workflows/generate-files.yml

Co-authored-by: Lucas Bertrand <[email protected]>

* make generate

* Update .github/workflows/generate-files.yml

Co-authored-by: Lucas Bertrand <[email protected]>

---------

Co-authored-by: Lucas Bertrand <[email protected]>
  • Loading branch information
fadeev and lumtis authored Aug 7, 2023
1 parent 9ebd8a3 commit e3f715e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Generated Go/OpenAPI to Match Protobuf
name: Generated Files are Updated
on:
pull_request:
branches:
Expand All @@ -17,14 +17,20 @@ jobs:
run: |
echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Generate Go and OpenAPI
- name: Generate Go code from proto files
run: make proto

- name: Generate OpenAPI
run: make openapi

- name: Generate Module Documentation
run: make specs

- name: Check for changes
run: |
if git diff --exit-code --ignore-space-change --ignore-all-space --ignore-cr-at-eol; then
echo "Generated Go files are up-to-date."
else
echo "::error::Generated Go and/or OpenAPI files are not up-to-date. Please run 'make proto' locally and commit any changes."
echo "::error::Generated files are not up-to-date. Please run 'make generate' locally and commit any changes."
exit 1
fi
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,21 @@ proto:
@find . -name '*.pb.go' -type f -delete
@echo "--> Generating new Go types from protocol buffer files"
@bash ./scripts/protoc-gen-go.sh
.PHONY: proto

openapi:
@echo "--> Generating OpenAPI specs"
@bash ./scripts/protoc-gen-openapi.sh

proto-format:
@bash ./scripts/proto-format.sh

.PHONY: proto
.PHONY: openapi

specs:
@echo "--> Generating module documentation"
@go run ./scripts/gen-spec.go
.PHONY: specs

generate: proto openapi specs
.PHONY: generate

###############################################################################
### Docker Images ###
###############################################################################
Expand Down

0 comments on commit e3f715e

Please sign in to comment.