CI: fix healthcheck schema path, update stale thinking-hot-tail test,… #41
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
| # ═══════════════════════════════════════════════════════════════ | |
| # Tofu (豆腐) — Continuous Integration | |
| # ═══════════════════════════════════════════════════════════════ | |
| # | |
| # Runs on every push to main and on all pull requests. | |
| # Jobs: lint → test-unit → test-api → healthcheck | |
| # | |
| # ═══════════════════════════════════════════════════════════════ | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| TRADING_ENABLED: "0" | |
| PYTHONDONTWRITEBYTECODE: "1" | |
| jobs: | |
| # ── Lint ───────────────────────────────────────────────────── | |
| lint: | |
| name: Lint (ruff) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - name: Install ruff | |
| run: pip install ruff | |
| - name: Ruff check | |
| run: ruff check lib/ routes/ tests/ | |
| # ── Unit Tests ─────────────────────────────────────────────── | |
| test-unit: | |
| name: Unit Tests (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov | |
| - name: Run unit tests with coverage | |
| run: > | |
| python -m pytest -m unit | |
| --cov=lib --cov=routes | |
| --cov-report=term-missing | |
| --cov-report=xml:coverage.xml | |
| --tb=short -q | |
| - name: Upload coverage artifact | |
| if: matrix.python-version == '3.12' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage.xml | |
| retention-days: 14 | |
| if-no-files-found: ignore | |
| # ── API Integration Tests ─────────────────────────────────── | |
| test-api: | |
| name: API Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| timeout-minutes: 15 | |
| # No service containers needed — SQLite is built into Python | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov | |
| - name: Run API tests | |
| run: > | |
| python -m pytest -m api | |
| --cov=lib --cov=routes | |
| --cov-report=term-missing | |
| --tb=short -q | |
| # ── Healthcheck ───────────────────────────────────────────── | |
| healthcheck: | |
| name: Healthcheck | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Run healthcheck | |
| run: python healthcheck.py |