55 lines
1.2 KiB
YAML
55 lines
1.2 KiB
YAML
name: Backend CI
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- "backend/**"
|
|
pull_request:
|
|
paths:
|
|
- "backend/**"
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: backend
|
|
|
|
services:
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports: ["6379:6379"]
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
env:
|
|
POSTGRES_DB: sighej
|
|
POSTGRES_USER: sighej
|
|
POSTGRES_PASSWORD: sighej
|
|
ports: ["5432:5432"]
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
cache: pip
|
|
cache-dependency-path: backend/requirements*.txt
|
|
|
|
- name: Install dependencies
|
|
run: pip install -r requirements-dev.txt
|
|
|
|
- name: Lint (ruff)
|
|
run: pip install ruff && ruff check .
|
|
|
|
- name: Run tests
|
|
env:
|
|
REDIS_URL: redis://localhost:6379
|
|
DATABASE_URL: postgresql+asyncpg://sighej:sighej@localhost:5432/sighej
|
|
run: pytest -v
|