Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,24 @@ jobs:
# Check that the generated ent code is up to date
# see https://entgo.io/docs/ci/
- uses: ent/contrib/ci@e38dfb6484dfbe64b8bd060fe6a219a1aa5da770 # master
name: "Check all generated code is checked in"
name: "Check all ent generated code is checked in"
if: ${{ matrix.app != 'main-module' }}
with:
working-directory: app/${{ matrix.app }}

# Check that the generated API code is up to date
# We install the tools and run the protoc generation before checking differences
- name: "Check all API generated code is checked in"
if: ${{ matrix.app == 'main-module' }}
run: |
make init-api-tools
make api
if [ -n "$(git status --porcelain)" ]; then
echo "Error: The Git repository is dirty (has uncommitted changes). Make sure all the generated API-related files are checked in."
git status --porcelain
exit 1
fi

- name: Test
if: ${{ matrix.app != 'main-module' }}
run: make -C app/${{ matrix.app }} test
Expand Down
2 changes: 1 addition & 1 deletion app/artifact-cas/api/cas/v1/status_http.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 app/controlplane/api/controlplane/v1/status_http.pb.go

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

17 changes: 11 additions & 6 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@ VERSION=$(shell git describe --tags --always)

.PHONY: init
# init env
init:
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
go install github.com/envoyproxy/protoc-gen-validate@v1.0.1
go install github.com/go-kratos/kratos/cmd/protoc-gen-go-errors/v2@latest
go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@latest
init: init-api-tools
go install github.com/google/wire/cmd/wire@latest
go install github.com/vektra/mockery/v2@v2.20.0
go install ariga.io/atlas/cmd/atlas@v0.12.0

# initialize API tooling
.PHONY: init-api-tools
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split the tools for API handling to its own target so the impact in the CI during installation is limited.

init-api-tools:
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
go install github.com/bufbuild/buf/cmd/buf@v1.10.0
go install github.com/envoyproxy/protoc-gen-validate@v1.0.1
# Tools fixed to a specific version via its commit since they are not released standalone
go install github.com/go-kratos/kratos/cmd/protoc-gen-go-errors/v2@v2.0.0-20231102162905-3fc8fb7a0a0b
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also make sure to "fix the version" of some of these deps, before it was latest.

go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@v2.0.0-20231102162905-3fc8fb7a0a0b

# show help
help:
Expand Down