dist: bionic
language: python
cache: pip
services:
  - redis
  - postgresql
  - mysql
# addons:
#   postgresql: "10"
#   apt:
#     packages:
#     - postgresql-10
#     - postgresql-10-postgis-2.4
#     - libgdal-dev

python:
  - 3.6
  - 3.7
  - 3.8
  - 3.9
  - pypy3
env:
  - DJANGO=3.0
  - DJANGO=3.1
  - DJANGO=3.2
matrix:
  exclude:
    - python: 3.6
      env: DJANGO=3.2
  include:
    - python: 3.8
      env: TOXENV=lint
    - python: 3.8
      env: DJANGO=2.1
    - python: 3.8
      env: DJANGO=2.2
    - python: 3.8
      env: DJANGO=master
    - python: 3.9
      env: DJANGO=master
  allow_failures:
    - python: pypy3   # This one works for me locally but fails with a weird error on Travis
      env: DJANGO=3.2
    - python: 3.8
      env: DJANGO=master
    - python: 3.9
      env: DJANGO=master
install:
  - pip install tox-travis
before_script:
  # check gis
  # - gdal-config --version
  # - gdal-config --cflags
  # - psql -U postgres -c "create extension postgis"
  # set up postgresql
  - psql -U postgres -c "create role cacheops login superuser"
  # postgis django backend requires these to exist
  - psql -U postgres -c "create database cacheops"
  - psql -U postgres -c "create database cacheops_slave"
  # mysql databases
  - mysql -u root -e "create user cacheops@localhost"
  - mysql -u root -e "grant all on *.* to cacheops@localhost"
  - mysql -e "create database cacheops"
  - mysql -e "create database cacheops_slave"
script:
  # - GDAL_VERSION=`gdal-config --version` tox
  - tox
