Skip to content

Commit 441d44b

Browse files
authored
gRPCのスキーマ定義 (#31)
1 parent 798d3a3 commit 441d44b

File tree

11 files changed

+972
-1
lines changed

11 files changed

+972
-1
lines changed

.github/workflows/proto-ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Protobuf CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "proto/**"
9+
pull_request:
10+
paths:
11+
- "proto/**"
12+
13+
jobs:
14+
buf:
15+
name: buf check
16+
runs-on: ubuntu-latest
17+
permissions:
18+
pull-requests: write
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: bufbuild/buf-action@v1
22+
with:
23+
version: 1.49.0
24+
push: false
25+
26+
buf-gen:
27+
name: buf generate
28+
runs-on: ubuntu-latest
29+
permissions:
30+
pull-requests: write
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: bufbuild/buf-action@v1
34+
with:
35+
version: 1.49.0
36+
setup_only: true
37+
38+
- name: Generate
39+
run: buf generate
40+
shell: bash
41+
42+
- name: Exit if diff exists
43+
run: |
44+
if [[ -n $(git status --porcelain) ]]; then
45+
echo "Generated files are different from committed files. Please run 'buf generate' and commit the changes."
46+
exit 1
47+
fi
48+
shell: bash

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ CLIENT_SECRET=my-client-secret
1818
```
1919
traQで作成するClientは リダイレクトURL に `http://localhost:8080/api/oauth2/callback`、スコープに `openid`, `profile` を指定します。
2020
`task run-server` で portal server が 8080番 ポートで起動します。
21+
22+
## protobuf について
23+
24+
[proto/README.md](proto/README.md) を参照してください。

Taskfile.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tasks:
1313
cmds:
1414
- go test -cover -race ./...
1515

16-
gen:
16+
go:gen:
1717
cmds:
1818
- task: up-db
1919
- go generate ./...
@@ -26,6 +26,19 @@ tasks:
2626
- server/openapi/*.go
2727
- server/models/**/*.go
2828

29+
proto:gen:
30+
cmds:
31+
- buf generate
32+
sources:
33+
- proto/**/*.proto
34+
generates:
35+
- gen/**
36+
37+
gen:
38+
cmds:
39+
- task: go:gen
40+
- task: proto:gen
41+
2942
up-db:
3043
cmds:
3144
- docker compose up -d --wait db

buf.gen.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: v2
2+
managed:
3+
enabled: true
4+
override:
5+
- file_option: go_package_prefix
6+
value: github.com/traPtitech/piscon-portal-v2/proto/gen
7+
plugins:
8+
- remote: buf.build/grpc/go:v1.5.1
9+
out: gen
10+
opt:
11+
- paths=source_relative
12+
# dependencies
13+
- remote: buf.build/protocolbuffers/go:v1.36.1
14+
out: gen
15+
opt:
16+
- paths=source_relative

buf.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# For details on buf.yaml configuration, visit https://buf.build/docs/configuration/v2/buf-yaml
2+
version: v2
3+
lint:
4+
use:
5+
- STANDARD
6+
breaking:
7+
use:
8+
- FILE
9+
modules:
10+
- path: "proto"

0 commit comments

Comments
 (0)