Files
mtusi2026lab2/.github/workflows/application.yml

33 lines
1.0 KiB
YAML

name: Application
on: [push, pull_request]
permissions:
contents: read
jobs:
smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create disposable local secrets
run: |
python3 - <<'PY'
from pathlib import Path
from secrets import token_urlsafe
Path('secrets').mkdir(exist_ok=True)
password = token_urlsafe(32)
Path('secrets/postgres_password').write_text(password)
Path('secrets/database_url').write_text(
f'postgresql://messenger:{password}@postgres:5432/messenger'
)
Path('.env').write_text(Path('.env.example').read_text())
PY
- name: Build and start
run: docker compose --env-file .env up -d --build --wait
- name: Public API smoke
run: make test
- name: Persistence through full restart
run: make test-persistence ACTION_SCRIPT=scripts/restart.sh
- name: Stop without deleting data
if: always()
run: docker compose --env-file .env down