Refactor CI workflow for Python linting and testing #18
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"] | |
| jobs: | |
| lint: | |
| name: Lint (Python 3.11) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| - name: Install ruff | |
| run: pip install ruff | |
| - name: Lint with ruff | |
| # ruff.toml in repo root defines the rule set and per-file ignores | |
| run: ruff check . --config ruff.toml | |
| test: | |
| name: Test (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| # Runs independently of lint — a lint warning never hides test results | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pip" | |
| - name: Install dependencies (CI-safe, no google-antigravity) | |
| # requirements-ci.txt excludes google-antigravity which is not on PyPI. | |
| # The package is replaced by tests/mocks/google/antigravity/ stub. | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-ci.txt | |
| - name: Run tests | |
| env: | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| # Workspace root on PATH so project modules resolve correctly. | |
| # The stub is injected by conftest.py at collection time. | |
| PYTHONPATH: ${{ github.workspace }} | |
| run: | | |
| pytest tests/test_mock_code.py -v --tb=short | |
| docker-build: | |
| name: Docker build check | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: false | |
| tags: ast-healer:ci | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |