name: Build and Push API # Migrated from .woodpecker/api.yml on 2026-05-18. GHA builds + pushes to # DockerHub; Keel polls and rolls the cluster Deployments. No POST to # Woodpecker — Keel is the deploy mechanism now. on: push: branches: [master] paths-ignore: - 'frontend/**' - '**.md' - '.woodpecker/**' concurrency: group: build-api-${{ github.ref }} cancel-in-progress: true env: IMAGE: viktorbarzin/realestatecrawler jobs: test-and-build: runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.13' cache: 'pip' - name: System deps run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libglib2.0-0 - name: Python deps (mirror .woodpecker/api.yml install list) run: | python -m pip install --upgrade pip pip install --quiet \ pytest pytest-asyncio pytest-cov httpx fakeredis aioresponses \ fastapi uvicorn sqlmodel sqlalchemy alembic pyjwt cryptography \ celery redis click aiohttp aiohttp-socks pillow numpy pytesseract \ opentelemetry-api opentelemetry-sdk opentelemetry-exporter-prometheus \ opentelemetry-instrumentation-fastapi opentelemetry-instrumentation-sqlalchemy \ python-dotenv webauthn apprise tenacity prometheus-client \ email-validator opencv-python-headless tqdm pandas cachetools watchdog - name: Unit tests run: pytest tests/unit/ -v --tb=short - name: Integration / regression / e2e tests run: pytest tests/integration/ tests/regression/ tests/e2e/ tests/test_listing_geojson.py -v --tb=short - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 with: username: viktorbarzin password: ${{ secrets.DOCKERHUB_TOKEN }} # github.sha is the commit hash (40-char hex, controlled by git, not # external input) — using it via env to satisfy the workflow-injection # lint hook and keep things uniform. - id: meta env: GIT_SHA: ${{ github.sha }} run: echo "sha=$(printf '%s' "$GIT_SHA" | cut -c1-8)" >> "$GITHUB_OUTPUT" # Pushes both :<8-char-sha> (traceability) and :latest (Keel watches this). # Deployments reference :latest; Keel detects the digest bump and rolls. - uses: docker/build-push-action@v6 with: context: . file: Dockerfile target: production platforms: linux/amd64 push: true tags: | ${{ env.IMAGE }}:${{ steps.meta.outputs.sha }} ${{ env.IMAGE }}:latest cache-from: type=gha,scope=api cache-to: type=gha,scope=api,mode=max