Files
gps-denied-onboard/.github/workflows/ci.yml
T
2026-04-02 17:11:31 +03:00

84 lines
2.4 KiB
YAML

name: CI
# Run on every push and PR to main/dev/stage* branches.
on:
push:
branches: [main, dev, "stage*"]
pull_request:
branches: [main, dev]
jobs:
# ---------------------------------------------------------------------------
# Lint — ruff for style + import sorting
# ---------------------------------------------------------------------------
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install ruff
run: pip install --no-cache-dir "ruff>=0.9"
- name: Check style and imports
run: ruff check src/ tests/
# ---------------------------------------------------------------------------
# Unit tests — fast, no SITL, no GPU
# ---------------------------------------------------------------------------
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
needs: lint
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 system deps (OpenCV headless)
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends libgl1 libglib2.0-0
- name: Install package + dev extras
run: pip install --no-cache-dir -e ".[dev]"
- name: Run unit tests (excluding SITL integration)
run: |
python -m pytest tests/ \
--ignore=tests/test_sitl_integration.py \
-q \
--tb=short
# ---------------------------------------------------------------------------
# Docker build smoke test — verify image builds successfully
# ---------------------------------------------------------------------------
docker-build:
name: Docker build smoke test
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t gps-denied-onboard:ci .
- name: Health smoke test (container start)
run: |
docker run -d --name smoke -p 8000:8000 gps-denied-onboard:ci
sleep 5
curl --retry 5 --retry-delay 2 --fail http://localhost:8000/health
docker stop smoke