diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..5ec487d --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,32 @@ +## 变更摘要 + + + +- + +## 影响范围 + + + +- + +## 验证结果 + + + +```text + +``` + +## 风险与回滚 + +- 主要风险: +- 回滚方式: + +## 安全与范围确认 + +- [ ] PR 只处理一个明确主题,没有夹带无关修改。 +- [ ] 未提交 `.env`、API Key、Token、密码、Cookie、浏览器数据、数据库、日志、缓存或构建产物。 +- [ ] 自动化验证没有连接真实账号、调用付费 Provider、发送消息、发布内容、部署或修改生产数据。 +- [ ] 如有界面变化,已提供脱敏截图;没有则说明“无”。 +- [ ] 如有数据、配置或兼容性变化,已说明迁移与回滚方式。 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4d9e541 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,66 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + validation: + name: Rust and Web UI + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + GH_OAUTH_CLIENT_ID: ci-placeholder + steps: + - name: Check out repository + uses: actions/checkout@v7 + + - name: Set up Node.js + uses: actions/setup-node@v7 + with: + node-version: "22" + cache: npm + cache-dependency-path: web-ui/package-lock.json + + - name: Install Web UI dependencies + working-directory: web-ui + run: npm ci --no-audit + + - name: Check Web UI formatting + working-directory: web-ui + run: npm run format:check + + - name: Lint Web UI + working-directory: web-ui + run: npm run lint + + - name: Test Web UI + working-directory: web-ui + run: npm test + + - name: Build Web UI + working-directory: web-ui + run: npm run build + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Check Rust formatting + run: cargo fmt --all --check + + - name: Lint Rust + run: cargo clippy --all-targets --all-features -- -D warnings + + - name: Test Rust + run: cargo test --all-features