Quality gates: coverage, pre-commit, markers, e2e tests #1
Workflow file for this run
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
| # =============================================================== | |
| # 🔍 Lint & Static Analysis — Code Quality Gate | |
| # =============================================================== | |
| # | |
| # This workflow: | |
| # - Runs ruff for linting and import sorting | |
| # - Runs black for code formatting checks | |
| # - Runs mypy for static type analysis | |
| # | |
| # Triggers on push to main and PRs. Skips draft PRs. | |
| # Cancels stale runs on the same branch. | |
| # | |
| # References | |
| # ────────── | |
| # - Ruff: https://docs.astral.sh/ruff/ | |
| # - Black: https://black.readthedocs.io/ | |
| # - Mypy: https://mypy.readthedocs.io/ | |
| # | |
| # Author: Manav Gupta <manavg@gmail.com> | |
| # =============================================================== | |
| name: Lint & Static Analysis | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "**.py" | |
| - "pyproject.toml" | |
| - ".github/workflows/lint.yml" | |
| pull_request: | |
| types: [opened, synchronize, ready_for_review] | |
| branches: [main] | |
| paths: | |
| - "**.py" | |
| - "pyproject.toml" | |
| - ".github/workflows/lint.yml" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # ----------------------------------------------------------------- | |
| # Minimal permissions — principle of least privilege | |
| # ----------------------------------------------------------------- | |
| permissions: | |
| contents: read | |
| jobs: | |
| # ========================================================================= | |
| # 🔍 Ruff + Black | |
| # ========================================================================= | |
| python-lint: | |
| name: Ruff & Black | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| if: github.event_name != 'pull_request' || !github.event.pull_request.draft | |
| steps: | |
| # ─────────── Setup ─────────── | |
| - name: ⬇️ Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: 🐍 Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: 📦 Install Poetry | |
| run: pipx install poetry | |
| - name: 💾 Cache Poetry dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pypoetry | |
| key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
| restore-keys: ${{ runner.os }}-poetry- | |
| - name: 📦 Install dependencies | |
| run: poetry install --no-interaction | |
| # ─────────── Checks ─────────── | |
| - name: 🔍 Ruff lint | |
| run: poetry run ruff check . | |
| - name: 🎨 Black format check | |
| run: poetry run black --check . | |
| # ========================================================================= | |
| # 🔎 Type Check | |
| # ========================================================================= | |
| typecheck: | |
| name: Mypy | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| if: github.event_name != 'pull_request' || !github.event.pull_request.draft | |
| steps: | |
| # ─────────── Setup ─────────── | |
| - name: ⬇️ Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: 🐍 Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: 📦 Install Poetry | |
| run: pipx install poetry | |
| - name: 💾 Cache Poetry dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pypoetry | |
| key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
| restore-keys: ${{ runner.os }}-poetry- | |
| - name: 📦 Install dependencies | |
| run: poetry install --no-interaction | |
| # ─────────── Check ─────────── | |
| - name: 🔎 Mypy type check | |
| run: poetry run mypy faststack_core/ cli/ |