Skip to content

updates and build out #17

updates and build out

updates and build out #17

Workflow file for this run

name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ghcr.io/${{ github.repository_owner }}/wildfire
jobs:
# ── Node.js workspace ─────────────────────────────────────────────
node:
name: Node.js (TypeScript)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Type check
run: pnpm type-check
- name: Lint
run: pnpm lint
- name: Build
run: pnpm build
- name: Test
run: pnpm test
# ── Python services ───────────────────────────────────────────────
python:
name: Python (FastAPI)
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/apigw
services:
postgres:
image: postgis/postgis:15-3.3
env:
POSTGRES_USER: wildfire
POSTGRES_PASSWORD: wildfire123
POSTGRES_DB: wildfire_ops_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-path: apps/apigw/requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-asyncio pytest-cov mypy ruff
- name: Lint with ruff
run: ruff check app/ --output-format=github
- name: Type check with mypy
run: mypy app/ --ignore-missing-imports --no-strict-optional
- name: Run tests
env:
DATABASE_URL: postgresql://wildfire:wildfire123@localhost:5432/wildfire_ops_test
REDIS_HOST: localhost
REDIS_PORT: 6379
NODE_ENV: test
SECRET_KEY: test-secret-key
run: |
pytest tests/ -v --cov=app --cov-report=term-missing --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v3
if: always()
with:
files: ./apps/apigw/coverage.xml
flags: python
name: python-coverage
# ── Docker build verification ─────────────────────────────────────
docker:
name: Docker Build
runs-on: ubuntu-latest
needs: [node, python]
strategy:
fail-fast: false
matrix:
service:
- { name: apigw, context: ./apps/apigw, dockerfile: ./apps/apigw/Dockerfile }
- { name: console, context: ./apps/console, dockerfile: ./apps/console/Dockerfile }
- { name: triangulate, context: ".", dockerfile: ./apps/triangulate/Dockerfile }
- { name: predict, context: ".", dockerfile: ./apps/predict/Dockerfile }
- { name: ingest, context: ".", dockerfile: ./apps/ingest/Dockerfile }
- { name: mission-dispatcher, context: ".", dockerfile: ./apps/mission-dispatcher/Dockerfile }
- { name: edge-agent, context: ./apps/edge-agent, dockerfile: ./apps/edge-agent/Dockerfile }
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image (no push)
uses: docker/build-push-action@v5
with:
context: ${{ matrix.service.context }}
file: ${{ matrix.service.dockerfile }}
push: false
tags: ${{ env.IMAGE_PREFIX }}-${{ matrix.service.name }}:ci-${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
# ── Security scanning ────────────────────────────────────────────
security:
name: Security Scan
runs-on: ubuntu-latest
needs: [node, python]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner (filesystem)
uses: aquasecurity/trivy-action@master
with:
scan-type: fs
scan-ref: "."
severity: CRITICAL,HIGH
exit-code: "1"
ignore-unfixed: true
- name: Run Trivy config scan (IaC)
uses: aquasecurity/trivy-action@master
with:
scan-type: config
scan-ref: infra/
severity: CRITICAL,HIGH
exit-code: "0"