Skip to content

Merge pull request #30 from kartoza/dimasciput-patch-1 #11

Merge pull request #30 from kartoza/dimasciput-patch-1

Merge pull request #30 from kartoza/dimasciput-patch-1 #11

Workflow file for this run

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