|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + pull-requests: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint: |
| 15 | + name: Lint & Format Check |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + persist-credentials: false |
| 21 | + |
| 22 | + - name: Set up uv |
| 23 | + uses: astral-sh/setup-uv@v7 |
| 24 | + with: |
| 25 | + enable-cache: true |
| 26 | + |
| 27 | + - name: Set up Python |
| 28 | + run: uv python install 3.12 |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: uv sync --frozen --dev |
| 32 | + |
| 33 | + - name: Lint and format check with Ruff |
| 34 | + run: | |
| 35 | + uv run ruff check . |
| 36 | + uv run ruff format --check . |
| 37 | +
|
| 38 | + - name: Type check with mypy |
| 39 | + run: uv run mypy src/server.py |
| 40 | + continue-on-error: true # Report issues but don't fail build |
| 41 | + |
| 42 | + test: |
| 43 | + name: Test (Python ${{ matrix.python-version }}) |
| 44 | + runs-on: ubuntu-latest |
| 45 | + strategy: |
| 46 | + fail-fast: false |
| 47 | + matrix: |
| 48 | + python-version: ["3.10", "3.11", "3.12", "3.13"] |
| 49 | + |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + with: |
| 53 | + persist-credentials: false |
| 54 | + |
| 55 | + - name: Set up uv |
| 56 | + uses: astral-sh/setup-uv@v7 |
| 57 | + with: |
| 58 | + enable-cache: true |
| 59 | + |
| 60 | + - name: Set up Python ${{ matrix.python-version }} |
| 61 | + run: uv python install ${{ matrix.python-version }} |
| 62 | + |
| 63 | + - name: Install dependencies |
| 64 | + run: uv sync --frozen --dev |
| 65 | + |
| 66 | + - name: Create junit directory |
| 67 | + run: mkdir -p junit |
| 68 | + |
| 69 | + - name: Run tests |
| 70 | + run: uv run pytest tests/ --junitxml=junit/test-results-${{ matrix.python-version }}.xml |
| 71 | + |
| 72 | + - name: Upload test results |
| 73 | + if: always() |
| 74 | + uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + name: test-results-${{ matrix.python-version }} |
| 77 | + path: junit/test-results-*.xml |
| 78 | + |
| 79 | + build: |
| 80 | + name: Build Package |
| 81 | + runs-on: ubuntu-latest |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v4 |
| 84 | + with: |
| 85 | + persist-credentials: false |
| 86 | + |
| 87 | + - name: Set up uv |
| 88 | + uses: astral-sh/setup-uv@v7 |
| 89 | + with: |
| 90 | + enable-cache: true |
| 91 | + |
| 92 | + - name: Set up Python |
| 93 | + run: uv python install 3.12 |
| 94 | + |
| 95 | + - name: Build package |
| 96 | + run: uv build |
| 97 | + |
| 98 | + - name: Verify build outputs |
| 99 | + run: | |
| 100 | + test -f dist/*.whl |
| 101 | + test -f dist/*.tar.gz |
| 102 | +
|
| 103 | + - name: Upload build artifacts |
| 104 | + uses: actions/upload-artifact@v4 |
| 105 | + with: |
| 106 | + name: dist |
| 107 | + path: dist/ |
0 commit comments