Skip to content

TASK-18: GitHub Actions CI — Lint, Type Check & Build #20

Description

@z4ab

Goal

Set up GitHub Actions to automatically run linting, type checking, and builds on every push and pull request to dev.

Background

The AGENTS.md review checklist lists:

  • ruff check . (Python)
  • ruff format --check . (Python)
  • tsc -b (TypeScript)
  • npm run lint (frontend)
  • vite build (frontend build)

These should run automatically in CI to prevent broken PRs from being merged.

Deliverables

.github/workflows/ci.yml

A single CI workflow with the following jobs:

Job 1: Backend Lint (Python)

backend-lint:
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-python@v5
      with: { python-version: '3.12' }
    - run: pip install ruff
    - run: ruff check adapters/ backend/ db/ pipeline/ scripts/
    - run: ruff format --check adapters/ backend/ db/ pipeline/ scripts/

Job 2: Frontend Type Check & Build

frontend-build:
  runs-on: ubuntu-latest
  defaults:
    run:
      working-directory: frontend
  steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-node@v4
      with: { node-version: '20' }
    - run: npm ci
    - run: npx tsc -b
    - run: npm run lint
    - run: npm run build

Job 3: Backend Tests

backend-tests:
  runs-on: ubuntu-latest
  services:
    postgres:
      image: postgis/postgis:16-3.4
      env:
        POSTGRES_DB: constructnear_test
        POSTGRES_USER: postgres
        POSTGRES_PASSWORD: postgres
      ports: [ '5432:5432' ]
      options: >-
        --health-cmd pg_isready
        --health-interval 5s
        --health-timeout 5s
        --health-retries 5
  steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-python@v5
      with: { python-version: '3.12' }
    - run: |
        pip install -r backend/requirements.txt
        pip install pytest pytest-asyncio httpx
    - run: psql -h localhost -U postgres -d constructnear_test -f db/schema.sql
      env: { PGPASSWORD: postgres }
    - run: pytest backend/tests -v
      env: { DATABASE_URL_TEST: 'postgres://postgres:postgres@localhost:5432/constructnear_test' }

Status Badges

Add a badge to the top of README-deploy.md:

[![CI](https://github.com/z4ab/real-estate/actions/workflows/ci.yml/badge.svg)](https://github.com/z4ab/real-estate/actions/workflows/ci.yml)

Conventions

  • Workflow triggers: push and pull_request on dev branch
  • Fail fast: if any job fails, the entire workflow is marked failed
  • Cancel in-progress runs for the same branch on new pushes
  • Use actions/cache for pip and npm to speed up subsequent runs

Acceptance Criteria

  • .github/workflows/ci.yml exists with 3 jobs
  • Ruff lint + format check runs on all Python code
  • TypeScript type check (tsc -b) passes
  • ESLint (npm run lint) passes
  • Vite build produces the frontend bundle
  • PostGIS service container starts for backend tests
  • CI badge renders correctly in the README
  • Pushes to dev trigger the workflow
  • PRs to dev trigger the workflow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions