Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocol buffer 環境を作成しました #3

Merged
merged 15 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: ci

on: pull_request

jobs:
protobuf-check:
runs-on: ubuntu-latest
env:
PROTOBUF_VERSION: "25.0"

steps:
- uses: actions/checkout@v4

- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_SECRET_KEY }}

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21.2"

# 参照
# https://grpc.io/docs/languages/go/quickstart/
- name: Install Protobuf
run: |
wget https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-x86_64.zip
unzip protoc-$PROTOBUF_VERSION-linux-x86_64.zip -d protoc-$PROTOBUF_VERSION-linux-x86_64
sudo mv protoc-$PROTOBUF_VERSION-linux-x86_64/bin/protoc /usr/local/bin/protoc
sudo mv protoc-$PROTOBUF_VERSION-linux-x86_64/include/* /usr/local/include/
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
export PATH="$PATH:$(go env GOPATH)/bin"

- name: Run protoc
run: |
make generate_proto

- name: Check for changes
id: git-check
run: |
git diff --exit-code api/gen
continue-on-error: true

- name: Fail if changes are detected
if: steps.git-check.outcome == 'failure'
run: |
echo "Changes detected in api/gen directory!"
exit 1
2 changes: 1 addition & 1 deletion .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
# you need actions/setup-go@v4 action.
- uses: actions/setup-go@v4
with:
go-version: "1.21"
go-version: "1.21.2"

# run staticcheck
- uses: reviewdog/action-staticcheck@v1
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# for protobuf
api/proto/pkg

firebase-adminsdk-secret.json
1 change: 0 additions & 1 deletion .idea/misc.xml

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

1 change: 1 addition & 0 deletions .idea/vcs.xml

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

13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.PHONY: deploy-dev
deploy-dev:
git checkout dev
git fetch origin
git reset --hard origin/main
git merge ${branch}
git log -n 2
git push -f origin dev
git checkout ${branch}

.PHONY: generate_proto
generate_proto:
sh scripts/gen_proto.sh
150 changes: 150 additions & 0 deletions api/gen/post_transaction.pb.go

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

Loading