dist: xenial
language: python

# See aws s3 ls s3://travis-python-archives/binaries/ubuntu/16.04/x86_64/
python:
  - "nightly"
  - "pypy3"
  - "pypy"
  - "3.8"
  - "3.7"
  - "3.6"
  - "3.5"
  - "2.7"

cache: pip

services:
  - mysql

install:
  - pip install -U pip
  - pip install -U mock coverage pytest pytest-cov codecov

env:
  global:
    - TESTDB=travis.cnf

before_script:
  - "mysql --help"
  - "mysql --print-defaults"
  - "mysql -e 'create database mysqldb_test charset utf8mb4;'"

script:
  - pip install -e .
  - pytest --cov ./MySQLdb

after_success:
  - codecov

matrix:
  include:
    - &django_py27
      name: "Django test (Python 2.7)"
      python: "2.7"
      install:
        - pip install -U pip
        - wget https://github.com/django/django/archive/1.11.18.tar.gz
        - tar xf 1.11.18.tar.gz
        - pip install django-1.11.18/
        - cp ci/test_mysql.py django-1.11.18/tests/
        - pip install .

      before_script:
        - mysql -e 'create user django identified by "secret"'
        - mysql -e 'grant all on *.* to django'
        - mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql mysql

      script:
        - cd django-1.11.18/tests/
        - ./runtests.py --parallel=1 --settings=test_mysql

    - &django_py3
      <<: *django_py27
      name: "Django test (Python 3.7)"
      python: "3.7"

# vim: sw=2 ts=2 sts=2
