Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
48 changes: 48 additions & 0 deletions .github/workflows/proto-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Protobuf CI

on:
push:
branches:
- main
paths:
- "proto/**"
pull_request:
paths:
- "proto/**"

jobs:
buf:
name: buf check
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
version: 1.49.0
push: false

buf-gen:
name: buf generate
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
version: 1.49.0
setup_only: true

- name: Generate
run: buf generate
shell: bash

- name: Exit if diff exists
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "Generated files are different from committed files. Please run 'buf generate' and commit the changes."
exit 1
fi
shell: bash
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ CLIENT_SECRET=my-client-secret
```
traQで作成するClientは リダイレクトURL に `http://localhost:8080/api/oauth2/callback`、スコープに `openid`, `profile` を指定します。
`task run-server` で portal server が 8080番 ポートで起動します。

## protobuf について

[proto/README.md](proto/README.md) を参照してください。
15 changes: 14 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tasks:
cmds:
- go test -cover -race ./...

gen:
go:gen:
cmds:
- task: up-db
- go generate ./...
Expand All @@ -26,6 +26,19 @@ tasks:
- server/openapi/*.go
- server/models/**/*.go

proto:gen:
cmds:
- buf generate
sources:
- proto/**/*.proto
generates:
- gen/**

gen:
cmds:
- task: go:gen
- task: proto:gen

up-db:
cmds:
- docker compose up -d --wait db
Expand Down
16 changes: 16 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: v2
managed:
enabled: true
override:
- file_option: go_package_prefix
value: github.com/traPtitech/piscon-portal-v2/proto/gen
plugins:
- remote: buf.build/grpc/go:v1.5.1
out: gen
opt:
- paths=source_relative
# dependencies
- remote: buf.build/protocolbuffers/go:v1.36.1
out: gen
opt:
- paths=source_relative
10 changes: 10 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# For details on buf.yaml configuration, visit https://buf.build/docs/configuration/v2/buf-yaml
version: v2
lint:
use:
- STANDARD
breaking:
use:
- FILE
modules:
- path: "proto"
Loading
Loading