Repository navigation
refactor(frontend): colocate owner-scoped CSS (#943) #1697
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Backend CI | |
| on: | |
| push: | |
| pull_request: | |
| # 分支和 PR 上,同一 ref 新 run 取消旧的,省额度。 | |
| # main 例外:每个 commit 单独成组。main 上所有 push 共用一个 ref,连着合几个 PR 时 | |
| # 先合的 run 会被后合的掐掉,提交页面留下的是「取消」(显示成红叉),而不是这个 commit | |
| # 自己的 CI 结论——真挂了也看不出来。加 sha 让每个合入点各自跑完。 | |
| concurrency: | |
| group: ci-${{ github.ref }}${{ github.ref == 'refs/heads/main' && format('-{0}', github.sha) || '' }} | |
| cancel-in-progress: true | |
| # 开源项目最小权限 | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint-and-test: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: backend # uv workspace 在 backend/,不是 repo 根 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install uv | |
| # setup-uv 自 v8.0.0 起停止发布 floating major tag(@v7/@v8), | |
| # 出于安全只发布 immutable tag,故用具体版本号 | |
| uses: astral-sh/setup-uv@v8.3.2 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --frozen # 用提交的 uv.lock 锁定版本,不偷偷升级 | |
| - name: Ruff | |
| run: uv run ruff check . | |
| - name: OpenAPI contract drift | |
| run: | | |
| uv run python -m scripts.export_openapi | |
| if ! git diff --quiet -- ../openapi.json; then | |
| echo "::error::openapi.json 与代码对不上:改了 API 模型但没重新导出。" | |
| echo "在 backend/ 下跑这一条,然后把 openapi.json 一起提交:" | |
| echo " uv run python -m scripts.export_openapi && git add ../openapi.json" | |
| echo "--- 实际差异 ---" | |
| git --no-pager diff -- ../openapi.json | |
| exit 1 | |
| fi | |
| - name: Import-linter (分层契约) | |
| run: uv run lint-imports | |
| - name: Pytest | |
| run: uv run pytest -q --cov=packages --cov-report=term-missing --cov-report=xml:coverage.xml | |
| - name: Upload coverage to Codecov | |
| if: always() | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: backend/coverage.xml | |
| flags: backend | |
| fail_ci_if_error: false |