name: Test on Docker CI

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-22.04

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Generate the .env file and the SECRET_KEY
        run: make envfile

      - name: Build and run the Docker Compose stack
        run: docker compose up -d

      - name: Run tests
        run: docker compose run -e FROM_DOCKER_IMAGE=1 web python ./manage.py test --verbosity=2 --noinput
