Add travis.yml

This commit is contained in:
Markus Frosch 2016-11-29 09:51:09 +01:00
parent 4bf26b421d
commit 9fb94e82c0
2 changed files with 44 additions and 0 deletions

24
.travis.yml Normal file
View File

@ -0,0 +1,24 @@
language: php
php:
- '5.3'
- '5.4'
- '5.5'
- '5.6'
- '7.0'
services:
- mysql
- postgresql
cache:
directories:
- vendor
env:
- DB=mysql DIRECTOR_TESTDB_RES="Director MySQL TestDB" DIRECTOR_TESTDB="director_test"
- DB=pgsql DIRECTOR_TESTDB_RES="Director PostgreSQL TestDB" DIRECTOR_TESTDB="director_test"
DIRECTOR_TESTDB_USER="director_test"
before_script:
- ./test/travis-prepare.sh
- composer install

20
test/travis-prepare.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
set -ex
psql_cmd() {
psql -U postgres ${DIRECTOR_TESTDB} -q -c "$@"
}
if [ "$DB" = mysql ]; then
mysql -u root -e "CREATE DATABASE ${DIRECTOR_TESTDB};"
elif [ "$DB" = pgsql ]; then
psql -U postgres postgres -q -c "CREATE DATABASE ${DIRECTOR_TESTDB} WITH ENCODING 'UTF8';"
psql_cmd "CREATE USER ${DIRECTOR_TESTDB_USER} WITH PASSWORD 'testing';"
psql_cmd "GRANT ALL PRIVILEGES ON DATABASE ${DIRECTOR_TESTDB} TO ${DIRECTOR_TESTDB_USER};"
psql_cmd "CREATE EXTENSION pgcrypto;"
else
echo "Unknown database set in environment!" >&2
env
exit 1
fi