Restructure backend routes #656
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: FastAPI backend with PostgreSQL | |
| permissions: {} | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./backend | |
| services: | |
| postgres: | |
| image: postgres | |
| env: | |
| POSTGRES_PASSWORD: password | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: backend | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: Install backend | |
| run: uv sync --extra pg | |
| - name: Create test database | |
| run: psql -h localhost -U postgres -c 'CREATE DATABASE "acidwatch_test";' | |
| env: | |
| PGPASSWORD: password | |
| - name: Run pytest | |
| run: | | |
| uv run alembic upgrade head | |
| uv run pytest tests --test-alembic | |
| env: | |
| ACIDWATCH_DATABASE: postgresql://postgres:password@localhost:5432/postgres | |
| ACIDWATCH_TEST_DATABASE: postgresql://postgres:password@localhost:5432/acidwatch_test |