diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e6987e9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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/ssh-agent@v0.8.0 + 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 diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 87e7571..bcd86f7 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..923d0a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# for protobuf +api/proto/pkg + +firebase-adminsdk-secret.json diff --git a/.idea/misc.xml b/.idea/misc.xml index 2ca2389..81525b5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ -