Bump django from 4.2.17 to 5.0.10 #367
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 unit tests" | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
workflow_dispatch: | |
jobs: | |
run_tests: | |
name: Run Django Tests | |
runs-on: ubuntu-latest | |
env: | |
DATABASE_URL: postgis://postgres:postgres@localhost:5432/postgres | |
services: | |
postgres: | |
image: postgis/postgis:15-3.4-alpine | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
rabbitmq: | |
image: rabbitmq:3-alpine | |
ports: | |
- 5672:5672 | |
steps: | |
#---------------------------------------------- | |
# Checkout repo and set up Python | |
#---------------------------------------------- | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
id: checkout-repo | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: "3.12" | |
#---------------------------------------------- | |
# Install GDAL into the environment | |
#---------------------------------------------- | |
- name: Install GDAL | |
id: install-gdal | |
run: | | |
sudo apt-add-repository --yes ppa:ubuntugis/ubuntugis-unstable | |
sudo apt-get update | |
sudo apt-get install --no-install-recommends --yes gdal-bin libgdal-dev | |
#---------------------------------------------- | |
# Install & configure Poetry | |
#---------------------------------------------- | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
#---------------------------------------------- | |
# Load cached venv if cache exists | |
#---------------------------------------------- | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
#---------------------------------------------- | |
# Install project dependencies if cache does not exist | |
#---------------------------------------------- | |
- name: Install cached dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
#---------------------------------------------- | |
# Run migrations (we need to because we have to start | |
# the celery worker before running unit tests) | |
#---------------------------------------------- | |
- name: Run DB migrations | |
run: | | |
source .venv/bin/activate | |
python manage.py migrate | |
- name: Run celery worker for tests | |
run: | | |
source .venv/bin/activate | |
celery --app prs2 worker --loglevel error --detach | |
#---------------------------------------------- | |
# Run unit tests | |
#---------------------------------------------- | |
- name: Run tests | |
run: | | |
source .venv/bin/activate | |
python manage.py collectstatic | |
# NOTE: we can't run tests in parallel, because setup() may break DB constraints. | |
python manage.py test --noinput --failfast --verbosity 0 --settings prs2.test-settings |