Generalize build script #364
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| UV_VERSION: 0.9.18 | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| version: ${{ env.UV_VERSION }} | |
| - name: Set up Python | |
| run: uv python install 3.13 | |
| - name: Install dependencies | |
| run: uv sync --frozen --dev | |
| - name: Run ruff check | |
| run: uv run ruff check | |
| - name: Run ruff format check | |
| run: uv run ruff format --check | |
| type-check: | |
| name: Type Check (Python ${{ matrix.python-version }}) | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| version: ${{ env.UV_VERSION }} | |
| - name: Set up Python | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --frozen --all-extras | |
| - name: Run ty | |
| run: uv run ty check | |
| meta-format-check: | |
| name: Meta Format Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| version: ${{ env.UV_VERSION }} | |
| - name: Set up Python | |
| run: uv python install 3.10 | |
| - name: Install ufmt dependencies | |
| run: uv sync --frozen --extra ufmt | |
| - name: Run ufmt check | |
| run: uv run ufmt check | |
| test: | |
| name: Test | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| version: ${{ env.UV_VERSION }} | |
| - name: Set up Python | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --frozen --all-extras | |
| - name: Install Playwright browsers (if needed) | |
| run: uv run playwright install chromium | |
| if: matrix.os == 'ubuntu-latest' | |
| - name: Run tests | |
| run: uv run pytest -vx --tb=short -m "not docker_integration" | |
| - name: Upload coverage reports (optional) | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: coverage-report | |
| path: htmlcov/ | |
| continue-on-error: true | |
| # All checks must pass | |
| all-checks: | |
| name: All Checks | |
| runs-on: ubuntu-latest | |
| needs: [lint, type-check, meta-format-check, test] | |
| if: always() | |
| steps: | |
| - name: Ensure all checks passed | |
| run: | | |
| if [[ "${{ needs.lint.result }}" != "success" || \ | |
| "${{ needs.type-check.result }}" != "success" || \ | |
| "${{ needs.meta-format-check.result }}" != "success" || \ | |
| "${{ needs.test.result }}" != "success" ]]; then | |
| echo "One or more required checks failed" | |
| exit 1 | |
| fi | |
| echo "All checks passed successfully" |