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
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI

# Free forever for public GitHub repos:
# - go test
# - golangci-lint (open source)
# - reviewdog PR line comments (open source, uses GITHUB_TOKEN only)
on:
push:
branches: [main]
pull_request:
workflow_dispatch:

permissions:
contents: read
pull-requests: write
checks: write

jobs:
test:
name: Go Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Test
# Integration tests self-skip without live env vars / DSN.
run: go test ./...

lint:
name: Lint & PR Review
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: golangci-lint with reviewdog
uses: reviewdog/action-golangci-lint@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
go_version_file: go.mod
golangci_lint_flags: "--timeout=5m"
# Only report issues on added lines so historical noise doesn't block every PR.
filter_mode: added
# PR: inline review comments. Non-PR: annotations via check.
reporter: github-pr-review
fail_on_error: true
46 changes: 46 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Free local/CI lint for FlowMusic2API (golangci-lint v2 + reviewdog).
# CI comments only on PR added lines (see .github/workflows/ci.yml filter_mode).
version: "2"

run:
timeout: 5m
tests: true

linters:
default: none
enable:
- errcheck
- govet
- ineffassign
- staticcheck
- unused
- misspell
- bodyclose
settings:
misspell:
locale: US
staticcheck:
# Keep style nits from blocking useful PRs; catch real bugs via default checks.
checks:
- all
- "-ST1000"
- "-ST1005"
- "-QF1003"
- "-S1021"
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
# Dead helpers may remain for API symmetry; don't fail CI solely on unused.
- path: internal/httpapi/handlers\.go
linters:
- unused
text: streamChatCompletion
paths:
- third_party$
- builtin$
- examples$
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@
- 🗄️ **缓存支持** — 本地磁盘 / S3 / Cloudflare R2 缓存,可配置过期时间
- 🖥️ **Web 管理面板** — 完整的 Token、系统配置、请求日志、模型测试界面
- 🐳 **Docker 支持** — 一键部署,支持 SQLite / PostgreSQL
- ✅ **免费 CI 审核** — GitHub Actions:`go test` + `golangci-lint` + `reviewdog` PR 行内评论(无第三方付费机器人)

### 免费 CI 说明

| 任务 | 工具 | 费用 |
|------|------|------|
| 单元测试 | `go test ./...` | 公开仓 Actions 免费 |
| 静态检查 | [golangci-lint](https://golangci-lint.run/) | 开源 |
| PR 行内评论 | [reviewdog](https://github.com/reviewdog/reviewdog) | 开源,只用 `GITHUB_TOKEN` |

- 工作流:`.github/workflows/ci.yml`(`push`/`pull_request` 自动跑)
- 配置:`.golangci.yml`
- 策略:只评论 **本次新增代码行**(`filter_mode: added`),避免历史代码噪声刷屏
- 本地复现:`go test ./...`;安装 golangci-lint 后执行 `golangci-lint run ./...`

## 快速开始

Expand Down
Loading