Unverified Commit f089a938 authored by Grégoire Paris's avatar Grégoire Paris Committed by GitHub

Merge pull request #3884 from greg0ire/use-docker-for-all-rdbms

Use Docker consistently
parents 514dddd8 6e505dec
......@@ -21,7 +21,7 @@ before_commands:
tools:
external_code_coverage:
timeout: 3600
runs: 30 # 25x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP
runs: 28 # 23x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP
filter:
excluded_paths:
......
......@@ -14,7 +14,11 @@ before_install:
fi
before_script:
- if [[ "$DB" == "mysql" || "$DB" == "mysqli" || "$DB" == *"mariadb"* ]]; then mysql < tests/travis/create-mysql-schema.sql; fi;
- |
if [[ -n "$IMAGE" ]]
then
bash ./tests/travis/docker-run-mysql-or-mariadb.sh
fi
install:
- travis_retry composer -n install --prefer-dist
......@@ -53,36 +57,20 @@ jobs:
- stage: Test
php: 7.2
env: DB=mysql.docker MYSQL_VERSION=8.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
env: DB=mysql.docker IMAGE=mysql:8.0
- stage: Test
php: 7.2
env: DB=mysqli.docker MYSQL_VERSION=8.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
env: DB=mysqli.docker IMAGE=mysql:8.0
- stage: Test
php: 7.2
env: DB=mariadb MARIADB_VERSION=10.3
addons:
mariadb: 10.3
env: DB=mariadb.docker IMAGE=mariadb:10.3
- stage: Test
php: 7.2
env: DB=mariadb.mysqli MARIADB_VERSION=10.3
addons:
mariadb: 10.3
env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3
- stage: Test
php: 7.2
env: DB=pgsql POSTGRESQL_VERSION=11.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-postgres-11.sh
- stage: Test
......@@ -92,8 +80,6 @@ jobs:
php: 7.2
env: DB=sqlsrv
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-sqlsrv-dependencies.sh
- bash ./tests/travis/install-mssql-sqlsrv.sh
......@@ -102,84 +88,62 @@ jobs:
php: 7.2
env: DB=pdo_sqlsrv
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-sqlsrv-dependencies.sh
- bash ./tests/travis/install-mssql-pdo_sqlsrv.sh
- bash ./tests/travis/install-mssql.sh
- stage: Test
php: 7.3
env: DB=mysql COVERAGE=yes
services:
- mysql
env: DB=mysql.docker IMAGE=mysql:5.7 COVERAGE=yes
- stage: Test
php: 7.3
env: DB=mysql.docker MYSQL_VERSION=5.7 COVERAGE=yes
sudo: required
before_script:
- bash ./tests/travis/install-mysql-5.7.sh
env: DB=mysql.docker IMAGE=mysql:8.0 COVERAGE=yes
- stage: Test
php: 7.3
env: DB=mysql.docker MYSQL_VERSION=8.0 COVERAGE=yes
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
env: DB=mysqli.docker IMAGE=mysql:5.7 COVERAGE=yes
- stage: Test
php: 7.3
env: DB=mysqli COVERAGE=yes
services:
- mysql
env: DB=mysqli.docker IMAGE=mysql:8.0 COVERAGE=yes
- stage: Test
php: 7.3
env: DB=mysqli.docker MYSQL_VERSION=5.7 COVERAGE=yes
sudo: required
before_script:
- bash ./tests/travis/install-mysql-5.7.sh
env: DB=mariadb.docker IMAGE=mariadb:10.0 COVERAGE=yes
- stage: Test
php: 7.3
env: DB=mysqli.docker MYSQL_VERSION=8.0 COVERAGE=yes
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
env: DB=mariadb.docker IMAGE=mariadb:10.1 COVERAGE=yes
- stage: Test
php: 7.3
env: DB=mariadb.docker MARIADB_VERSION=10.1 COVERAGE=yes
services:
- docker
before_script:
- bash ./tests/travis/install-mariadb.sh
env: DB=mariadb.docker IMAGE=mariadb:10.2 COVERAGE=yes
- stage: Test
php: 7.3
env: DB=mariadb MARIADB_VERSION=10.2 COVERAGE=yes
addons:
mariadb: 10.2
env: DB=mariadb.docker IMAGE=mariadb:10.3 COVERAGE=yes
- stage: Test
php: 7.3
env: DB=mariadb MARIADB_VERSION=10.3 COVERAGE=yes
addons:
mariadb: 10.3
env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.0 COVERAGE=yes
- stage: Test
php: 7.3
env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.1 COVERAGE=yes
services:
- docker
before_script:
- bash ./tests/travis/install-mariadb.sh
env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.1 COVERAGE=yes
- stage: Test
php: 7.3
env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.2 COVERAGE=yes
- stage: Test
php: 7.3
env: DB=mariadb.mysqli MARIADB_VERSION=10.2 COVERAGE=yes
env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 COVERAGE=yes
- stage: Test
dist: trusty
php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=9.2 COVERAGE=yes
services:
- postgresql
addons:
mariadb: 10.2
postgresql: "9.2"
- stage: Test
dist: trusty
php: 7.3
env: DB=mariadb.mysqli MARIADB_VERSION=10.3 COVERAGE=yes
env: DB=pgsql POSTGRESQL_VERSION=9.3 COVERAGE=yes
services:
- postgresql
addons:
mariadb: 10.3
postgresql: "9.3"
- stage: Test
php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=9.4 COVERAGE=yes
......@@ -207,16 +171,12 @@ jobs:
php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=11.0 COVERAGE=yes
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-postgres-11.sh
- stage: Test
php: 7.3
env: DB=sqlsrv COVERAGE=yes
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-sqlsrv-dependencies.sh
- bash ./tests/travis/install-mssql-sqlsrv.sh
......@@ -225,8 +185,6 @@ jobs:
php: 7.3
env: DB=pdo_sqlsrv COVERAGE=yes
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-sqlsrv-dependencies.sh
- bash ./tests/travis/install-mssql-pdo_sqlsrv.sh
......@@ -235,8 +193,6 @@ jobs:
php: 7.3
env: DB=ibm_db2 COVERAGE=yes
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-db2.sh
- bash ./tests/travis/install-db2-ibm_db2.sh
......@@ -246,58 +202,38 @@ jobs:
install:
- travis_retry composer update --prefer-dist --prefer-lowest
- stage: Test
php: 7.4snapshot
env: DB=mysql.docker MYSQL_VERSION=8.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
php: 7.4
env: DB=mysql.docker IMAGE=mysql:8.0
- stage: Test
php: 7.4snapshot
env: DB=mysqli.docker MYSQL_VERSION=8.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
php: 7.4
env: DB=mysqli.docker IMAGE=mysql:8.0
- stage: Test
php: 7.4snapshot
env: DB=mariadb MARIADB_VERSION=10.3
addons:
mariadb: 10.3
php: 7.4
env: DB=mariadb.docker IMAGE=mariadb:10.3
- stage: Test
php: 7.4snapshot
env: DB=mariadb.mysqli MARIADB_VERSION=10.3
addons:
mariadb: 10.3
php: 7.4
env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3
- stage: Test
php: 7.4snapshot
php: 7.4
env: DB=pgsql POSTGRESQL_VERSION=11.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-postgres-11.sh
- stage: Test
php: 7.4snapshot
php: 7.4
env: DB=sqlite
- stage: Test
php: 7.4snapshot
php: 7.4
env: DB=sqlsrv
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-sqlsrv-dependencies.sh
- bash ./tests/travis/install-mssql-sqlsrv.sh
- bash ./tests/travis/install-mssql.sh
- stage: Test
php: 7.4snapshot
php: 7.4
env: DB=pdo_sqlsrv
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-sqlsrv-dependencies.sh
- bash ./tests/travis/install-mssql-pdo_sqlsrv.sh
......
DROP USER IF EXISTS 'travis'@'%';
CREATE USER 'travis'@'%';
CREATE SCHEMA doctrine_tests;
CREATE SCHEMA test_create_database;
CREATE SCHEMA test_drop_database;
GRANT ALL PRIVILEGES ON doctrine_tests.* to travis@'%';
GRANT ALL PRIVILEGES ON test_create_database.* to travis@'%';
GRANT ALL PRIVILEGES ON test_drop_database.* to travis@'%';
#!/usr/bin/env bash
set -ex
echo "Starting RDBMS…">&2
if [[ "$IMAGE" == "mysql:8.0" ]]
then
CMD_OPTIONS="--default-authentication-plugin=mysql_native_password"
else
CMD_OPTIONS=""
fi
docker run \
--health-cmd='mysqladmin ping --silent' \
--detach \
--env MYSQL_ALLOW_EMPTY_PASSWORD=yes \
--env MYSQL_DATABASE=doctrine_tests \
--publish 33306:3306 \
--name rdbms \
"$IMAGE" $CMD_OPTIONS
while true; do
healthStatus=$(docker inspect --format "{{json .State.Health.Status }}" rdbms)
case $healthStatus in
'"starting"')
echo "Waiting for RDBMS to become ready…">&2
sleep 1
;;
'"healthy"')
echo "Container is healthy">&2
break
;;
'"unhealthy"')
echo "Container is unhealthy">&2
exit 1
;;
*)
echo "Unexpected health status $healthStatus">&2
;;
esac
done
#!/usr/bin/env bash
set -ex
sudo docker run \
-d \
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
-e MYSQL_DATABASE=doctrine_tests \
-p 33306:3306 \
--name mariadb \
mariadb:${MARIADB_VERSION}
sudo docker exec -i mariadb bash <<< 'until echo \\q | mysql doctrine_tests > /dev/null 2>&1 ; do sleep 1; done'
#!/usr/bin/env bash
set -ex
echo "Starting MySQL 5.7..."
sudo docker run \
-d \
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
-e MYSQL_DATABASE=doctrine_tests \
-p 33306:3306 \
--name mysql57 \
mysql:5.7
sudo docker exec -i mysql57 bash <<< 'until echo \\q | mysql doctrine_tests > /dev/null 2>&1 ; do sleep 1; done'
#!/usr/bin/env bash
set -ex
echo "Starting MySQL 8.0..."
sudo docker pull mysql:8.0
sudo docker run \
-d \
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
-e MYSQL_DATABASE=doctrine_tests \
-p 33306:3306 \
--name mysql80 \
mysql:8.0 \
--default-authentication-plugin=mysql_native_password
sudo docker exec -i mysql80 bash <<< 'until echo \\q | mysql doctrine_tests > /dev/null 2>&1 ; do sleep 1; done'
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1" />
<var name="db_type" value="mysqli"/>
<var name="db_host" value="localhost" />
<var name="db_username" value="travis" />
<var name="db_password" value="" />
<var name="db_name" value="doctrine_tests" />
<var name="db_port" value="3306"/>
<var name="tmpdb_type" value="mysqli"/>
<var name="tmpdb_host" value="localhost" />
<var name="tmpdb_username" value="travis" />
<var name="tmpdb_password" value="" />
<var name="tmpdb_port" value="3306"/>
</php>
<testsuites>
<testsuite name="Doctrine DBAL Test Suite">
<directory>../Doctrine/Tests/DBAL</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1" />
<var name="db_type" value="pdo_mysql"/>
<var name="db_host" value="localhost" />
<var name="db_username" value="travis" />
<var name="db_password" value="" />
<var name="db_name" value="doctrine_tests" />
<var name="db_port" value="3306"/>
<var name="tmpdb_type" value="pdo_mysql"/>
<var name="tmpdb_host" value="localhost" />
<var name="tmpdb_username" value="travis" />
<var name="tmpdb_password" value="" />
<var name="tmpdb_port" value="3306"/>
</php>
<testsuites>
<testsuite name="Doctrine DBAL Test Suite">
<directory>../Doctrine/Tests/DBAL</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1" />
<var name="db_type" value="pdo_mysql"/>
<var name="db_host" value="localhost" />
<var name="db_username" value="travis" />
<var name="db_password" value="" />
<var name="db_name" value="doctrine_tests" />
<var name="db_port" value="3306"/>
<var name="tmpdb_type" value="pdo_mysql"/>
<var name="tmpdb_host" value="localhost" />
<var name="tmpdb_username" value="travis" />
<var name="tmpdb_password" value="" />
<var name="tmpdb_port" value="3306"/>
</php>
<testsuites>
<testsuite name="Doctrine DBAL Test Suite">
<directory>../Doctrine/Tests/DBAL</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1" />
<var name="db_type" value="mysqli"/>
<var name="db_host" value="localhost" />
<var name="db_username" value="travis" />
<var name="db_password" value="" />
<var name="db_name" value="doctrine_tests" />
<var name="db_port" value="3306"/>
<var name="tmpdb_type" value="mysqli"/>
<var name="tmpdb_host" value="localhost" />
<var name="tmpdb_username" value="travis" />
<var name="tmpdb_password" value="" />
<var name="tmpdb_port" value="3306"/>
</php>
<testsuites>
<testsuite name="Doctrine DBAL Test Suite">
<directory>../Doctrine/Tests/DBAL</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment