-
Notifications
You must be signed in to change notification settings - Fork 2
85 lines (83 loc) · 2.47 KB
/
run-tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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