From 88196db47fb980c6d288994ae33e1366ffcbc1d7 Mon Sep 17 00:00:00 2001 From: leonincs Date: Sun, 24 May 2026 00:19:34 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=90=AD=E5=BB=BA=E5=89=8D=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E6=8C=81=E7=BB=AD=E9=9B=86=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 64 ++++++++++++++++++++++++++++++++++++++++ README.md | 7 +++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3ed2c6d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + - master + +permissions: + contents: read + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + backend: + name: Backend + runs-on: ubuntu-latest + defaults: + run: + working-directory: backend + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.24.x" + cache-dependency-path: backend/go.sum + + - name: Download dependencies + run: go mod download + + - name: Vet + run: go vet ./... + + - name: Test + run: go test -race -count=1 ./... + + frontend: + name: Frontend + runs-on: ubuntu-latest + defaults: + run: + working-directory: frontend + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + cache-dependency-path: frontend/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build diff --git a/README.md b/README.md index 540c7c7..d744a0f 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,13 @@ cd frontend npm install && npm run dev ``` +## CI + +GitHub Actions 配置位于 `.github/workflows/ci.yml`,在 Pull Request 以及推送到 `main`、`master` 时运行。 + +- 后端:Go 1.24.x,执行 `go mod download`、`go vet ./...`、`go test -race -count=1 ./...` +- 前端:Node.js 22,执行 `npm ci`、`npm run build` + ## 接口清单 ### 账号 `/account`