Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github actions #1

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[flake8]
exclude = */docs/*,*/.tox/*,*/.venv/*,*/.pycharm_helpers/*,*/migrations/*,docs/*,*/__init__.py,
*/manage.py,*/wsgi.py,
# we don't check this for now, until it's been fixed. otherwise it will throw lot of errors
qgis-app/plugins/*,
qgis-app/userexport/*,
qgis-app/lib/templatetags/*,
vagrant_assets/*,
qgis-app/users/*,
qgis-app/settings*,
qgis-app/qgis_context_processor.py,
qgis-app/search_sites.py,
qgis-app/urls.py,
qgis-app/custom_haystack_urls.py,
qgis-app/middleware.py,
qgis-app/homepage.py
max-line-length = 79

# E12x continuation line indentation
# E251 no spaces around keyword / parameter equals
# E303 too many blank lines (3)
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E251,E303,W503,W504,W60,F405
54 changes: 54 additions & 0 deletions .github/workflows/build-test-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: pr-test
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- 3.7
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2

- name: Test installing development dependencies
run: |
python -m pip install --upgrade pip
pip install flake8

- name: Run Flake8 test
run: flake8 .
test:
runs-on: ubuntu-latest
needs:
- lint
steps:
- uses: actions/checkout@v2
- name: Run docker-compose build
working-directory: dockerize
run: docker-compose build
- name: Run the containers
working-directory: dockerize
run: docker-compose up -d db devweb
- name: Run Coverage test
working-directory: dockerize
run: |
cat << EOF | docker-compose exec -T devweb bash
pip install coverage
python manage.py makemigrations
python manage.py migrate
coverage run manage.py test
coverage xml
EOF
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
67 changes: 67 additions & 0 deletions dockerize/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
version: '3'
services:
db:
image: kartoza/postgis:9.6-2.4
environment:
- ALLOW_IP_RANGE=0.0.0.0/0
- POSTGRES_USER=docker
- POSTGRES_PASS=docker
volumes:
- ./backups:/backups
restart: unless-stopped

devweb:
build: docker
hostname: uwsgi
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=settings_docker
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- RABBITMQ_HOST=rabbitmq
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
links:
- db:db
- rabbitmq:rabbitmq
- worker:worker
restart: unless-stopped
user: root

rabbitmq:
image: library/rabbitmq:3.6
hostname: rabbitmq
environment:
- RABBIT_PASSWORD=rabbit_test_password
- USER=rabbit_user
- RABBITMQ_NODENAME=rabbit
restart: unless-stopped

worker:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-worker
build: docker
hostname: uwsgi
working_dir: /home/web/django_project
command: celery -A plugins worker -l info
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=settings_docker
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- RABBITMQ_HOST=rabbitmq
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
links:
- db:db
- rabbitmq:rabbitmq