Skip to content

Commit

Permalink
protocol buffer 環境を作成しました (#3)
Browse files Browse the repository at this point in the history
* feature: protocol buffer 環境を作成しました

* fix: ssh key の設定を行いました

* fix: api/proto/pkg を作るようにしました

* fix: protocol buffer のインストールスクリプトを修正

* fix: protocol buffer のインストールスクリプトを修正

* fix: protocol buffer のインストールスクリプトを修正

* fix: protocol buffer のインストールスクリプトを修正

* fix: protocol buffer のインストールスクリプトを修正

* fix: protocol buffer のインストールスクリプトを修正

* fix: protocol buffer のインストールスクリプトを修正

* fix: protocol buffer のインストールスクリプトを修正

* fix: protocol buffer のインストールスクリプトを修正

* fix: protocol buffer のインストールスクリプトを修正

* feature: protoc のバージョンを環境変数から指定できるようにした

* fix: gen ディレクトリへの staticcheck のチェックをなくしました
  • Loading branch information
kei01234kei authored Nov 16, 2023
1 parent bf5e7ca commit da82b8c
Show file tree
Hide file tree
Showing 13 changed files with 597 additions and 4 deletions.
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

0 comments on commit da82b8c

Please sign in to comment.