-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (81 loc) · 2.39 KB
/
django.yml
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
86
name: Django CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.12]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
working-directory: deployment/docker
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Run Flake8 test
run: flake8 .
django_test:
needs: lint
name: 'Django Test'
runs-on: ubuntu-22.04
strategy:
matrix:
python-version:
- 3.12
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build test image
uses: docker/build-push-action@v4
with:
context: .
file: deployment/docker/Dockerfile
push: false
load: true
target: test
tags: kartoza/africa_rangeland_watch:test
cache-from: |
type=gha,scope=test
type=gha,scope=dev
cache-to: type=gha,scope=test
- name: Run docker-compose services
working-directory: deployment
run: |
echo "Override docker-compose for testing purposes"
cp docker-compose.override.test.yml docker-compose.override.yml
cp .template.test.env .env
cd ../
make dev
make wait-db
make sleep
make migrate
make npm-install
make build-react
make dev-runserver
make sleep
- name: Run Coverage test
working-directory: deployment
run: |
cat << EOF | docker compose exec -T dev bash
python manage.py makemigrations
python manage.py migrate
python manage.py collectstatic --noinput --verbosity 0
export DJANGO_SETTINGS_MODULE=core.settings.dev && coverage run manage.py test && coverage xml
EOF
docker cp africa_rangeland_watch-dev-1:/home/web/django_project/coverage.xml ../coverage.xml