Skip to content

Initial framework

Initial framework #679

Workflow file for this run

name: Tests
on:
workflow_call:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
run-tests:
name: Django tests
runs-on: ubuntu-latest
env:
DATABASE: postgres
SQL_ENGINE: django.contrib.gis.db.backends.postgis
SQL_USER: postgres
SQL_PASSWORD: postgres
SQL_DATABASE: postgres
SQL_HOST: localhost
SQL_PORT: 5432
PYTHONPATH: ${{ github.workspace }}
BASE_DIR: ${{ github.workspace }}/app
DJANGO_SETTINGS_MODULE: config.django.settings.development
IMGPROXY_KEY: tests
IMGPROXY_SALT: tests
SECRET_KEY: tests
REDIS_URL: redis://localhost:6379
DJANGO_LOG_LOCATION: ${{ github.workspace }}/django.log
USER_ACTIONS_LOG_LOCATION: ${{ github.workspace }}/user_actions.log
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Python 3.11.4
uses: actions/setup-python@v4
with:
python-version: 3.11.4
cache: 'pip'
cache-dependency-path: config/requirements/development.txt
- name: Upgrade pip
run: |
pip install --upgrade pip wheel
- name: Install dependencies
run: |
pip install -r config/requirements/development.txt
- name: Install GeoDjango dependencies
run: sudo apt-get install gdal-bin libgdal-dev libgeos-dev libproj-dev
- name: Run Django tests
working-directory: ./app
run: |
touch ${{ github.workspace }}/config/__init__.py
coverage run --concurrency=multiprocessing ./manage.py test -v 2 --noinput --parallel auto
coverage combine
coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./app/coverage.xml
services:
postgres:
image: postgis/postgis:15-3.3
env:
POSTGRES_USER: ${{ env.SQL_USER }}
POSTGRES_PASSWORD: ${{ env.SQL_PASSWORD }}
POSTGRES_DB: ${{ env.DATABASE }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379