-
Notifications
You must be signed in to change notification settings - Fork 2
74 lines (64 loc) · 1.82 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
name: Python 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_URL: "postgres://postgres:postgres@localhost:5432/postgres"
PYTHONPATH: "${{ github.workspace }}:${{ github.workspace }}/app"
DJANGO_SETTINGS_MODULE: "conf.settings.development"
REDIS_URL: "redis://localhost:6379"
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install GeoDjango dependencies
run: sudo apt-get install gdal-bin libgdal-dev libgeos-dev libproj-dev -y
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
version: "latest"
- name: Install dependencies
run: uv sync --frozen
- name: Run Django tests
working-directory: ${{ github.workspace }}/app
run: |
uv run coverage run manage.py test -v 2 --no-input
uv run coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ github.workspace }}/app/coverage.xml
services:
postgres:
image: postgis/postgis:17-3.5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7.4
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379