Feature/tests #5
Workflow file for this run
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: Run Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up docker compose | |
run: | | |
echo "DEBUG=True" >> .env | |
echo "SECRET_KEY='key-for-testing'" >> .env | |
echo "ALLOWED_HOSTS=*" >> .env | |
echo "DATABASE_URL=postgres://postgres:secretpassword@postgres:5432/optidiagnosedb" >> .env | |
echo "POSTGRES_USER=postgres" >> .env | |
echo "POSTGRES_PASSWORD=secretpassword" >> .env | |
echo "POSTGRES_DB=optidiagnosedb" >> .env | |
docker compose up -d | |
env: | |
DEBUG: True | |
SECRET_KEY: "key_for_testing" | |
ALLOWED_HOSTS: "*" | |
DATABASE_URL: "postgres://postgres:postgres@postgres:5432/optidiagnosedb" | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: optidiagnosedb | |
- name: Wait for services to be healthy | |
run: | | |
while ! docker compose exec -T postgres pg_isready -U postgres; do | |
sleep 1 | |
done | |
- name: Run tests | |
run: docker exec opti-diagnose-api uv run optidiagnose/manage.py test optidiagnoseapi.tests | |
- name: Linter | |
run: docker compose exec api uv tool run ruff check |