Skip to content

Commit 676eef3

Browse files
committed
Travis Matrix and Docker against multiple MySQL :bowtie:
1 parent 3b5391b commit 676eef3

File tree

5 files changed

+34
-22
lines changed

5 files changed

+34
-22
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.idea/
22
vendor/
33
composer.lock
4-
db/
4+
_db/

.travis.install-mysql-5.7.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

.travis.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,28 @@ php:
66
- '7.0'
77
- '7.1'
88

9-
services:
10-
- mysql
9+
env:
10+
- MYSQL_VERSION=5.6
11+
- MYSQL_VERSION=5.7
12+
- MYSQL_VERSION=8.0
13+
14+
dist: trusty
1115

12-
sudo: true
16+
sudo: required
17+
18+
services:
19+
- docker
1320

1421
before_install:
15-
- bash .travis.install-mysql-5.7.sh
16-
- mysql -e 'CREATE DATABASE test;'
22+
- sudo /etc/init.d/mysql stop
23+
- make start_db V=$MYSQL_VERSION
1724

1825
install: composer install
1926

2027
before_script:
2128
- mkdir -p build/logs
2229

23-
script:
24-
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml
30+
script: vendor/bin/phpunit --coverage-clover build/logs/clover.xml
2531

2632
after_script:
2733
- php vendor/bin/coveralls -v

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
DB_DIR=$(shell pwd)/_db
2+
v=5.7
3+
MYSQL_VERSION=$(v)
4+
5+
start_db:
6+
@echo Starting MySQL $(MYSQL_VERSION)
7+
docker run --rm -d --name spatial-mysql \
8+
-p 3306:3306 \
9+
-v $(DB_DIR):/var/lib/mysql \
10+
-e MYSQL_DATABASE=spatial_test \
11+
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
12+
mysql:$(MYSQL_VERSION) --character-set-server=utf8 --collation-server=utf8_general_ci
13+
docker logs -f spatial-mysql
14+
15+
purge_db:
16+
docker stop spatial-mysql
17+
rm -Rf $(DB_DIR)
18+
19+
get_ip:
20+
@docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' spatial-mysql

start_db.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)