# 合并的前提(架构 §8):类型检查、单元测试、租户隔离用例都通过;接口契约校验通过。 name: ci on: push: branches: [main] pull_request: concurrency: group: ci-${{ github.ref }} cancel-in-progress: true jobs: server: runs-on: ubuntu-24.04 services: postgres: image: postgres:16-alpine env: POSTGRES_USER: bd_owner POSTGRES_PASSWORD: dev-owner POSTGRES_DB: bid_doctor ports: ["5432:5432"] options: >- --health-cmd "pg_isready -U bd_owner" --health-interval 2s --health-retries 30 valkey: image: valkey/valkey:8-alpine ports: ["6379:6379"] gotenberg: # 投标样例和招标样例都可能是 Word,转换要走 Gotenberg(SK2) image: gotenberg/gotenberg:8 ports: ["3109:3000"] env: BD_TEST_PG: 127.0.0.1:5432 BD_TEST_VALKEY: redis://127.0.0.1:6379/1 steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v6 with: version: "0.12.20" - run: uv sync --frozen - name: 数据库角色(直接跑部署用的脚本,两边不会漂移,SK2) env: PGHOST: 127.0.0.1 PGPASSWORD: dev-owner POSTGRES_USER: bd_owner POSTGRES_DB: bid_doctor BD_APP_PASSWORD: dev-app run: sh deploy/compose/postgres/init-roles.sh - working-directory: server run: | ../.venv/bin/ruff check src tests migrations ../.venv/bin/ruff format --check src tests migrations ../.venv/bin/pyright ../.venv/bin/lint-imports ../.venv/bin/pytest -q web: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v4 with: node-version: 22 cache: pnpm - run: pnpm install --frozen-lockfile --ignore-scripts - name: 接口类型要和 openapi.yaml 一致 run: | pnpm gen:api git diff --exit-code packages/api-client/src/schema.d.ts - run: pnpm typecheck - run: pnpm build contract: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - name: OpenAPI 完整校验(api-design §8) run: npx --yes @redocly/cli@1.34.0 lint docs/architecture/openapi.yaml --skip-rule operation-4xx-response --skip-rule no-server-example.com