Skip to content

🧪 FastAPI Tests #338

🧪 FastAPI Tests

🧪 FastAPI Tests #338

Workflow file for this run

name: 🧪 FastAPI Tests
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:
schedule:
- cron: '0 6 * * 1-5'
jobs:
fastapi-test:
name: FastAPI tests (${{ matrix.docker_tag }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- docker_tag: main-pg17-ud
skip_marker: ws
db_schema: ud_40
- docker_tag: main-pg17-ws
skip_marker: ud
db_schema: ws_40
services:
db:
image: ghcr.io/giswater/gw-db:${{ matrix.docker_tag }}
env:
POSTGRES_DB: gw_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres -d gw_db"
--health-interval=5s
--health-timeout=5s
--health-retries=10
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]"
- name: Run tests with pytest
env:
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: gw_db
DB_USER: postgres
DB_PASSWORD: postgres
DB_SCHEMA: ${{ matrix.db_schema }}
API_BASIC: true
API_PROFILE: true
API_FLOW: true
API_MINCUT: true
API_WATER_BALANCE: true
API_MAPZONES: true
API_ROUTING: true
API_CRM: true
API_EPA: true
run: pytest -v -m "not ${{ matrix.skip_marker }}"