.github/workflows/python-package.yml
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Testing
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-18.04
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
python-version: [ 3.6, 3.8 ]
django-version: [ 2.2.*, 3.1.* ]
postgres: [ 'postgis/postgis:10-2.5', 'pgrouting/pgrouting:10-2.5-2.6.3' ]
experimental: [false]
include:
#TODO: Fix when github action do not show failed for the workflow with continue-on-error
#- django-version: dev
# experimental: true
# python-version: 3.8
# postgres: 'postgis/postgis:10-2.5'
#- django-version: dev
# experimental: true
# python-version: 3.8
# postgres: 'pgrouting/pgrouting:10-2.5-2.6.3'
- django-version: 3.2a1
experimental: true
python-version: 3.8
postgres: 'postgis/postgis:10-2.5'
- django-version: 3.2a1
experimental: true
python-version: 3.8
postgres: 'pgrouting/pgrouting:10-2.5-2.6.3'
services:
postgres:
image: ${{ matrix.postgres }}
env:
POSTGRES_DB: travis_ci_test
POSTGRES_PASSWORD: travis_ci_test
POSTGRES_USER: travis_ci_test
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install libproj-dev binutils gdal-bin libgdal-dev
python -m pip install --upgrade pip setuptools wheel
if [[ '${{ matrix.postgres }}' == 'pgrouting/pgrouting:10-2.5-2.6.3' ]]; then
pip install .[dev,routing] -U
else
pip install .[dev] -U
fi
if [[ ${{ matrix.django-version }} == dev ]]; then
pip install -e git+https://github.com/django/django@master#egg=django;
else
pip install Django==${{ matrix.django-version }} -U;
fi
if [[ ${{ matrix.django-version }} == 2.2.* ]]; then
# https://github.com/psycopg/psycopg2/issues/1293
pip install psycopg2==2.8.*
else
pip install psycopg2
fi
- name: Check migration
run: |
./manage.py makemigrations --check
- name: Test with coverage
run: |
if [[ '${{ matrix.postgres }}' == 'postgis/postgis:10-2.5' ]]; then
coverage run ./manage.py test --exclude-tag=routing
coverage run -a ./manage.py test --exclude-tag=routing --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode
else
coverage run ./manage.py test --tag=routing --settings=test_terra_geocrud.settings.routing
fi
- name: Coverage upload
run: |
pip install codecov
codecov