Bump fastapi from 0.109.0 to 0.110.2 in /backend #683
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: [main] | |
paths: | |
- "backend/**" | |
- "!backend/README.md" | |
- ".github/workflows/test-backend.yaml" | |
pull_request: | |
branches: [main] | |
paths: | |
- "backend/**" | |
- "!backend/README.md" | |
- ".github/workflows/test-backend.yaml" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test Code | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
# Step into backend | |
working-directory: ./backend | |
# Service containers to run with `container-job` | |
services: | |
postgres: | |
image: postgres:14-alpine | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: admin | |
POSTGRES_PASSWORD: admin | |
POSTGRES_DB: aof | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Start keycloak service | |
# Cannot use the services section because need to access the workspace | |
# to load the realm configuration. | |
run: | | |
docker run -d --name keycloak \ | |
-p 8080:8080 -p 9990:9990 \ | |
-v ${{ github.workspace }}/backend/keycloak:/tmp/io \ | |
--network ${{ job.container.network }} \ | |
-e DB_VENDOR=h2 \ | |
-e KEYCLOAK_USER=admin \ | |
-e KEYCLOAK_PASSWORD=admin \ | |
-e KEYCLOAK_STATISTICS=all \ | |
-e KEYCLOAK_IMPORT=/tmp/io/dev-realm.json \ | |
quay.io/keycloak/keycloak:15.1.0 | |
- name: Install poetry | |
run: pipx install poetry==1.7.1 | |
- name: Set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: poetry | |
- name: Install dependencies | |
run: poetry install --no-interaction --no-ansi | |
- name: Wait for keycloak to report healthy | |
run: | | |
until curl -f http://localhost:9990/health; do | |
echo "Waiting for keycloak to become healthy..." | |
sleep 5 | |
done | |
- name: Run tests | |
env: | |
VERSION: test | |
RELEASE_ID: test | |
DB_URI: postgresql+asyncpg://admin:admin@localhost/aof | |
AUDIENCE: alphafold-backend | |
AUTH_SERVER: http://localhost:8080/auth/realms/dev | |
run: | | |
poetry run coverage run --concurrency=thread,greenlet --source=app -m pytest | |
poetry run coverage report -m | |
poetry run coverage xml | |
# https://github.com/nedbat/coveragepy/issues/1082 | |
# pytest-cov doesn't seem to support the `concurrency` flag so | |
# using coverage commands | |
- name: Stop keycloak service | |
run: docker stop keycloak | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
# Flag upload to group coverage metrics (e.g. unittests, integration) | |
flags: backend # optional |