Update canonical/charming-actions action to v2.7.0 #1583
This file contains 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: Test Backend | |
on: | |
push: | |
branches-ignore: | |
- 'main' | |
paths: | |
- 'backend/**' | |
- '.github/workflows/test_backend.yml' | |
# Cancel inprogress runs if new commit pushed | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: [self-hosted, linux, large, jammy, x64] | |
defaults: | |
run: | |
working-directory: backend | |
services: | |
postgres: | |
image: postgres:15.2 | |
env: | |
POSTGRES_PASSWORD: password | |
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@v4 | |
with: | |
python-version: "3.10" | |
- uses: Gr1N/setup-poetry@v8 | |
with: | |
poetry-version: "1.8.2" | |
- run: poetry install | |
- run: poetry run ruff test_observer tests migrations scripts tasks | |
- run: poetry run mypy . | |
- run: poetry run pytest | |
env: | |
TEST_DB_URL: postgresql+pg8000://postgres:password@localhost:5432/postgres | |
- run: poetry run alembic upgrade head | |
env: | |
DB_URL: postgresql+pg8000://postgres:password@localhost:5432/postgres | |
- name: Check if alembic migrations are up to date | |
run: poetry run alembic check | |
env: | |
DB_URL: postgresql+pg8000://postgres:password@localhost:5432/postgres | |
- name: Start the app | |
run: poetry run uvicorn test_observer.main:app --host 0.0.0.0 --port 30000 & | |
shell: bash | |
- name: Fetch OpenAPI schema | |
run: curl http://localhost:30000/openapi.json | jq > fetched_openapi.json | |
- name: Compare with schema in repository | |
run: diff fetched_openapi.json schemata/openapi.json | |