Skip to content

Merge branch 'main' into update-load-data-script #285

Merge branch 'main' into update-load-data-script

Merge branch 'main' into update-load-data-script #285

Workflow file for this run

name: Test backend
on:
push:
paths:
- "backend/**"
- ".github/workflows/test-backend.yml"
jobs:
container-job:
runs-on: ubuntu-latest
container: python:3.12.6
services:
postgres:
image: postgis/postgis:16-3.4
env:
POSTGRES_SCHEME: postgresql+psycopg
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_SERVER: postgres
POSTGRES_PORT: 5432
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repo code
uses: actions/checkout@v4
- name: Install GDAL
run: |
apt-get update
apt-get install -y openssh-client libpq-dev postgresql libpq-dev gdal-bin libgdal-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt --no-cache-dir
working-directory: backend
- name: Run tests
run: pytest -v --cov=.
working-directory: backend
env:
DOMAIN: postgres
ENVIRONMENT: test
PROJECT_NAME: Districtr v2 backend
BACKEND_CORS_ORIGINS: "http://localhost,http://localhost:5173"
SECRET_KEY: mysupersecretkey
DATABASE_URL: postgresql+psycopg://postgres:postgres@postgres:5432/postgres
POSTGRES_SCHEME: postgresql+psycopg
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_SERVER: postgres
POSTGRES_PORT: 5432