72 lines
2.0 KiB
YAML
72 lines
2.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_DB: app
|
|
POSTGRES_USER: app
|
|
POSTGRES_PASSWORD: app
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U app -d app"
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
env:
|
|
DB_HOST: 127.0.0.1
|
|
DB_PORT: 5432
|
|
DB_NAME: app
|
|
DB_USER: app
|
|
DB_PASS: app
|
|
JWT_SECRET: ci-only-jwt-secret
|
|
BOT_API_KEY: ci-only-service-key-at-least-32-characters
|
|
BOT_API_KEY_SCOPES: discord:session,outbox:claim,outbox:deliver
|
|
DISCORD_ENROLLMENT_MODE: allowlist
|
|
DISCORD_ALLOWLIST: "123456789"
|
|
OPENROUTER_API_KEY: ci-only-provider-key
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
cache: pip
|
|
cache-dependency-path: |
|
|
requirements.txt
|
|
requirements-dev.txt
|
|
- name: Install dependencies
|
|
run: python -m pip install -r requirements-dev.txt
|
|
- name: Apply database migrations
|
|
run: python -m core.migrations upgrade
|
|
- name: Lint
|
|
run: ruff check .
|
|
- name: Test
|
|
run: pytest --cov-fail-under=80
|
|
|
|
compose-smoke:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
ENV_FILE: .env.example
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Start migrated API and scheduler
|
|
run: docker compose --env-file .env.example up --build --wait --wait-timeout 180 app scheduler
|
|
- name: Check API health
|
|
run: |
|
|
curl --fail --show-error http://localhost:8080/health/live
|
|
curl --fail --show-error http://localhost:8080/health/ready
|
|
- name: Show service logs after failure
|
|
if: failure()
|
|
run: docker compose --env-file .env.example logs
|
|
- name: Stop services
|
|
if: always()
|
|
run: docker compose --env-file .env.example down --volumes
|