Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Checkout server OpenAPI source
uses: actions/checkout@v4
with:
repository: Life-USTC/server-nextjs
path: server-nextjs

- uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: OpenAPI spec is synced with server
run: make check-openapi-sync OPENAPI_SOURCE=server-nextjs/public/openapi.generated.json

- name: Build
run: make build

Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
VERSION ?= dev
OPENAPI_SOURCE ?= ../server-nextjs/public/openapi.generated.json
LDFLAGS := -ldflags "-X github.com/Life-USTC/CLI/internal/cmd/root.version=$(VERSION)"

.PHONY: build clean test lint install generate
.PHONY: build clean test lint install generate sync-openapi check-openapi-sync

build:
go build $(LDFLAGS) -o life-ustc ./cmd/life-ustc
Expand All @@ -22,3 +23,9 @@ install:
generate:
go tool oapi-codegen -config api/oapi-codegen.yaml api/openapi.json
go run ./internal/cmd/apicmd/genpaths

sync-openapi:
cp $(OPENAPI_SOURCE) api/openapi.json

check-openapi-sync:
cmp -s $(OPENAPI_SOURCE) api/openapi.json
Comment on lines +30 to +31
Loading
Loading