Skip to content

feat: 添加 GitHub Actions CI 配置 #8

Description

@lennney

问题

没有 .github/workflows/ 配置,每次 push 没有自动跑测试和 lint。代码质量完全依赖开发者本地执行。

修复方案

创建 .github/workflows/ci.yml

name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  lint-and-test:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: pgvector/pgvector:pg16
        env:
          POSTGRES_USER: ticketpilot
          POSTGRES_PASSWORD: test
          POSTGRES_DB: ticketpilot_test
        ports:
          - 5432:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

    steps:
      - uses: actions/checkout@v4
      - uses: astral-sh/setup-uv@v4
      - run: uv sync
      - name: Lint
        run: uv run ruff check src/ tests/
      - name: Test
        run: uv run pytest tests/ --cov=ticketpilot --cov-report=xml -q
        env:
          DATABASE_URL: postgresql://ticketpilot:test@localhost:5432/ticketpilot_test

涉及文件

  • .github/workflows/ci.yml(新建)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions