aboutsummaryrefslogtreecommitdiff
path: root/.travis.yml
blob: bb7ff142ab12e719d7f006b5b2e918bc041474ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
language: python

dist: trusty
sudo: false

python:
  - 2.7
  - 3.4
  - 3.5
  - 3.6

addons:
  postgresql: "9.6"

services:
  - mysql
  - postgresql

env:
  matrix:
    - PW_TEST_DB_TYPE=postgres PW_TEST_DB_USER=postgres
    - PW_TEST_DB_TYPE=mysql PW_TEST_DB_USER=root
  global:
    - PW_TEST_DB_PASS=""
    - PW_TEST_DB_HOST="localhost"

matrix:
  include:
    - addons:
        mariadb: '10.3'
      env:
        - PW_TEST_DB_TYPE=mysql
        - PW_TEST_DB_USER=root
    - addons:
        postgresql: "10"
        apt:
          packages:
          - postgresql-10
          - postgresql-client-10
      env:
        - PGPORT=5433
        - PW_TEST_DB_HOST=""
        - PW_TEST_DB_PORT=5433
        - PW_TEST_DB_TYPE=postgres
        - PW_TEST_DB_USER=travis
      python: 3.6
      sudo: true
      before_install:
        - sudo -u postgres psql -c "grant ALL on DATABASE postgres to travis WITH GRANT OPTION;"
    - env:
        - PGPORT=5433
        - PW_TEST_DB_HOST=""
        - PW_TEST_DB_PORT=5433
        - PW_TEST_DB_TYPE=postgres
        - PW_TEST_DB_USER=travis
      python: 3.6
      dist: trusty
      addons:
        postgresql: "11"
        apt:
          sources:
          - sourceline: 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg 11'
            key_url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
          packages:
          - postgresql-11
          - postgresql-client-11
      sudo: true
      before_install:
        - sudo -u postgres psql -c "grant ALL on DATABASE postgres to travis WITH GRANT OPTION;"


before_script:
  - if [[ $PW_TEST_DB_TYPE == mysql ]]; then mysql -e 'create database patchwork character set utf8;'; fi
  - if [[ $PW_TEST_DB_TYPE == postgres ]]; then psql -c "create database patchwork with ENCODING = 'UTF8';" -U $PW_TEST_DB_USER; fi

install:
  - pip install tox-travis

script:
  - >
    if [[ $PW_TEST_DB_TYPE == mysql ]];
    then
      mysql -e 'SELECT VERSION(), CURRENT_USER();' -u $PW_TEST_DB_USER patchwork;
    else
      psql -c "SELECT VERSION(), CURRENT_USER, current_database()" -U $PW_TEST_DB_USER patchwork;
    fi
  - tox
  - tox -e coverage

after_success:
  - codecov