Skip to content

Commit

Permalink
**Title: Enhance CI Workflow and Update Protobuf Generation** (#126)
Browse files Browse the repository at this point in the history
**Description:**

- **CI Workflow Enhancements:**
  - Updated the GitHub Actions workflow to include a new `buf-generate` target in the `git-porcelain` task. This ensures that protobuf files are generated as part of the CI checks.
  - Added a conditional installation of `buf` in the CI environment. If `buf` is not installed, it will be automatically downloaded and installed during CI runs. This prevents build failures due to missing dependencies in CI environments.

- **Makefile Updates:**
  - Introduced a new `buf-generate` target in the Makefile, which depends on the `install-buf` target. This target runs `buf generate` to regenerate protobuf files.
  - Added `install-buf` target to conditionally install `buf` only in CI environments. This ensures that local development environments are not affected if `buf` is not installed.
  - Updated the `all` target to include `buf-generate`, ensuring that all necessary build steps are executed.

- **Protobuf File Update:**
  - Updated the `gen/api/v1/service.pb.go` file to reflect changes in the protobuf generation. This includes minor changes in the file descriptor bytes, likely due to updates in the source `.proto` files or the `buf` tool version.

**Impact:**
- These changes improve the robustness of the CI pipeline by ensuring all necessary tools and steps are included.
- The updates to the protobuf files ensure that the generated code is up-to-date with the latest `.proto` definitions.

**Notes:**
- Developers should ensure `buf` is installed locally if they wish to run `buf-generate` outside of CI.
- The changes in the protobuf file are automatically generated and should be reviewed to ensure compatibility with existing code.

Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
  • Loading branch information
naveensrinivasan authored Nov 12, 2024
1 parent 03dd130 commit 4c6c3d1
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 9 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Buf Generate

on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, synchronize]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3

# Step to install buf CLI
- name: Install buf CLI
run: |
BIN="/usr/local/bin" && \
VERSION="1.46.0" && \
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v$VERSION/buf-$(uname -s)-$(uname -m)" \
-o "$BIN/buf" && \
chmod +x "$BIN/buf"
# Step to install protoc-gen-connect-go
- name: Install protoc-gen-connect-go
run: |
go install github.com/bufbuild/connect-go/cmd/protoc-gen-connect-go@latest
echo "$HOME/go/bin" >> $GITHUB_PATH
# Step to install protoc-gen-go
- name: Install protoc-gen-go
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
echo "$HOME/go/bin" >> $GITHUB_PATH
# Verify buf and protoc-gen-connect-go installation
- name: Verify buf and protoc-gen-connect-go installation
run: |
buf --version
protoc-gen-connect-go --version
protoc-gen-go --version
- name: Generate code
run: |
buf generate
make git-porcelain
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
go-version: '1.22.5'
- name: Build
run: make build
run: make build && make git-porcelain

docker:
runs-on: ubuntu-latest
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Set up Docker
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Docker
run: make docker-build
run: make docker-build && make git-porcelain
check:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ docker-build:
go-mod-tidy:
go mod tidy

git-porcelain:
git-porcelain:
git status --porcelain

all: build test docker-build go-mod-tidy git-porcelain

.PHONY: test test-e2e build clean clean-redis docker-up docker-down docker-logs docker-build all
.PHONY: test test-e2e build clean clean-redis docker-up docker-down docker-logs docker-build all buf-generate install-buf
10 changes: 5 additions & 5 deletions gen/api/v1/service.pb.go

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

0 comments on commit 4c6c3d1

Please sign in to comment.