name: test on: pull_request: branches: - '*' push: branches: - 'main' env: DEBUG: true DATABASE_URL: 'postgres://postgres:postgres@localhost:5432/postgres' DJANGO_DEBUG_TOOLBAR: false jobs: test: runs-on: ubuntu-latest services: postgres: image: postgres env: POSTGRES_PASSWORD: postgres options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 ports: - '5432:5432' steps: - uses: actions/checkout@v4 - name: install python uses: actions/setup-python@v5 with: python-version: '3.12' - name: set up poetry uses: abatilo/actions-poetry@v2 with: poetry-version: '1.8.2' - name: set up virtual environment run: | poetry config virtualenvs.create true --local poetry config virtualenvs.in-project true --local - name: cache virtual environment uses: actions/cache@v4 with: path: ./.venv key: venv-${{ hashFiles('poetry.lock') }} - name: install dependencies run: poetry install --with test - name: check migrations run: poetry run python manage.py makemigrations --check - name: run tests run: poetry run pytest