forked from krowinski/php-mysql-replication
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
56 lines (44 loc) · 2.25 KB
/
.travis.yml
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
dist: trusty
language: php
php:
- 5.5
- 5.6
- 7.0
env:
- DB=mysql57
- DB=mysql56
cache:
apt: true
bundler: true
directories:
- $HOME/.composer/cache
sudo: required
before_script:
- "sudo /etc/init.d/mysql stop || true"
- "sudo apt-get remove mysql* -y"
- "if [ $DB = 'mysql57' ]; then echo deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7 | sudo tee /etc/apt/sources.list.d/mysql.list; sudo apt-get update; sudo apt-get install mysql-server -y --allow-unauthenticated; fi"
- "if [ $DB = 'mysql56' ]; then echo deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.6 | sudo tee /etc/apt/sources.list.d/mysql.list; sudo apt-get update; sudo apt-get install mysql-server -y --allow-unauthenticated; fi"
- "sudo mysql_upgrade"
# Config
- "echo '[mysqld]' | sudo tee /etc/mysql/conf.d/replication.cnf"
- "echo 'log-bin=mysql-bin' | sudo tee -a /etc/mysql/conf.d/replication.cnf"
- "echo 'server-id=1' | sudo tee -a /etc/mysql/conf.d/replication.cnf"
- "echo 'binlog-format = row' | sudo tee -a /etc/mysql/conf.d/replication.cnf"
# Enable GTID
- "echo '[mysqld]' | sudo tee /etc/mysql/conf.d/gtid.cnf"
- "echo 'gtid_mode=ON' | sudo tee -a /etc/mysql/conf.d/gtid.cnf"
- "echo 'enforce_gtid_consistency' | sudo tee -a /etc/mysql/conf.d/gtid.cnf"
- "echo 'binlog_format=ROW' | sudo tee -a /etc/mysql/conf.d/gtid.cnf"
- "echo 'log_slave_updates' | sudo tee -a /etc/mysql/conf.d/gtid.cnf"
# Start mysql (avoid errors to have logs)
- "sudo /etc/init.d/mysql restart || true"
- "sudo tail -1000 /var/log/syslog"
- "mysql --version"
- "mysql -u root -e 'SELECT VERSION();'"
- "mysql -u root -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost';\""
- "mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root mysql"
- if [ $DB = 'mysql56' ]; then echo "USE mysql;\nUPDATE user SET password=PASSWORD('root') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root; fi
- if [ $DB = 'mysql57' ]; then echo "USE mysql;\nUPDATE user SET authentication_string=PASSWORD('root') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root; fi
install:
travis_retry composer install --no-interaction --prefer-source;
script: vendor/bin/phpunit