👷Extend Travis, add PostgreSQL10.

Add PostgreSQL10 to TravisCI through Docker container.
Use PHP7.2 instead of PHP7.1 as default test environment.
Update to current stable MariaDB 10.2 from stable (GA) 10.1.
This commit is contained in:
Klaus Weidenbach 2018-03-17 21:47:02 +01:00
parent b5cc26fe76
commit a732b2bca1
2 changed files with 28 additions and 15 deletions

View file

@ -62,28 +62,34 @@ matrix:
fast_finish: true fast_finish: true
# Additional check combinations # Additional check combinations
include: include:
# PHP7.1, mariadb 10.1 # PHP7.2, mariadb 10.2
- php: '7.1' - php: '7.2'
env: DB=mariadb MARIADB_VERSION=10.1 CODECOV=1 env: DB=mariadb MARIADB_VERSION=10.2 CODECOV=1
# use mariadb instead of MySQL # use mariadb instead of MySQL
addons: addons:
mariadb: '10.1' mariadb: '10.2'
# PHP7.1, PostgreSQL 9.6 # PHP7.2, PostgreSQL 9.6
- php: '7.1' - php: '7.2'
env: DB=pgsql POSTGRESQL_VERSION=9.6 PHPUNITFILE=phpunit-pgsql.xml env: DB=pgsql POSTGRESQL_VERSION=9.6 PHPUNITFILE=phpunit-pgsql.xml
# Use newer postgres than 9.2 default # Use newer postgres than 9.2 default
addons: addons:
postgresql: '9.6' postgresql: '9.6'
services: services:
- postgresql - postgresql
# PHP7.1, old precise distribution with MySQL 5.5 # PostgreSQL 10 with Docker container
- php: '7.1' - php: '7.2'
env: DB=pgsql POSTGRESQL_VERSION=10 PHPUNITFILE=phpunit-pgsql.xml
sudo: required
services:
- docker
# PHP7.2, old precise distribution with MySQL 5.5
- php: '7.2'
env: DB=mysql MYSQL_VERSION=5.5 env: DB=mysql MYSQL_VERSION=5.5
dist: precise dist: precise
services: services:
- mysql - mysql
# MySQL 5.7 with Docker container # MySQL 5.7 with Docker container
- php: '7.1' - php: '7.2'
env: DB=mysql MYSQL_VERSION=5.7 env: DB=mysql MYSQL_VERSION=5.7
sudo: required sudo: required
services: services:
@ -109,6 +115,8 @@ before_install:
- travis_retry composer self-update - travis_retry composer self-update
# Start MySQL 5.7 Docker container, needs some time to come up # Start MySQL 5.7 Docker container, needs some time to come up
- if [[ "$MYSQL_VERSION" == "5.7" ]]; then sudo service mysql stop; docker run -d -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:5.7 && sleep 25 && docker ps; fi - if [[ "$MYSQL_VERSION" == "5.7" ]]; then sudo service mysql stop; docker run -d -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:5.7 && sleep 25 && docker ps; fi
# Start PostgreSQL 10 Docker container, needs some time to come up
- if [[ "$POSTGRESQL_VERSION" == "10" ]]; then sudo service postgresql stop; docker run -d -p 5432:5432 postgres:10-alpine && sleep 35 && docker ps; fi
# Install composer dev libs # Install composer dev libs
install: install:

View file

@ -27,14 +27,19 @@ set -e
echo "Preparing for PostgreSQL ..." echo "Preparing for PostgreSQL ..."
if [[ "$POSTGRESQL_VERSION" == "10" ]]; then
echo "Using PostgreSQL in Docker container, need to use TCP"
export PROTO="-h localhost"
fi
# Print out some PostgreSQL information # Print out some PostgreSQL information
psql --version psql --version
# Why does this hang further execution of the job? # Why does this hang further execution of the job?
psql -U postgres -c "SELECT VERSION();" psql $PROTO -U postgres -c "SELECT VERSION();"
# Create Hubzilla database # Create Hubzilla database
psql -U postgres -c "DROP DATABASE IF EXISTS travis_hubzilla;" psql $PROTO -U postgres -c "DROP DATABASE IF EXISTS travis_hubzilla;"
psql -U postgres -v ON_ERROR_STOP=1 <<-EOSQL psql $PROTO -U postgres -v ON_ERROR_STOP=1 <<-EOSQL
CREATE USER travis_hz WITH PASSWORD 'hubzilla'; CREATE USER travis_hz WITH PASSWORD 'hubzilla';
CREATE DATABASE travis_hubzilla; CREATE DATABASE travis_hubzilla;
ALTER DATABASE travis_hubzilla OWNER TO travis_hz; ALTER DATABASE travis_hubzilla OWNER TO travis_hz;
@ -42,8 +47,8 @@ psql -U postgres -v ON_ERROR_STOP=1 <<-EOSQL
EOSQL EOSQL
# Import table structure # Import table structure
psql -U travis_hz -v ON_ERROR_STOP=1 travis_hubzilla < ./install/schema_postgres.sql psql $PROTO -U travis_hz -v ON_ERROR_STOP=1 travis_hubzilla < ./install/schema_postgres.sql
# Show databases and tables # Show databases and tables
psql -U postgres -l psql $PROTO -U postgres -l
psql -U postgres -d travis_hubzilla -c "\dt;" psql $PROTO -U postgres -d travis_hubzilla -c "\dt;"