Files
mtusi2026lab2/.github/workflows/application.yml

39 lines
1.1 KiB
YAML

name: Lab 2 application
on: [push, pull_request]
permissions:
contents: read
jobs:
postgres:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Build and start
run: |
python - <<'PY'
from pathlib import Path
import secrets
settings = Path(".env.example").read_text()
Path(".env").write_text(settings.replace("POSTGRES_PASSWORD=", "POSTGRES_PASSWORD=" + secrets.token_hex(24)))
PY
docker compose --env-file .env up -d --build --wait --wait-timeout 60
- name: Verify API and persistence
run: |
make test PYTHON=python
python tests/student_tests.py
python tests/contract_edge_tests.py
chmod +x scripts/restart.sh
make test-persistence PYTHON=python ACTION_SCRIPT=scripts/restart.sh
- name: Stop lab services
if: always()
run: |
if [ -f .env ]; then
docker compose --env-file .env down
fi