diff --git a/.travis.yml b/.travis.yml index df61d4a44eb..f7012823dc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,12 @@ before_install: fi before_script: - - if [[ "$DB" == "mysql" || "$DB" == "mysqli" || "$DB" == *"mariadb"* ]]; then mysql < tests/travis/create-mysql-schema.sql; fi; + - | + if [[ "$DB" == "mysql" || "$DB" == "mysqli" || "$DB" == *"mariadb"* ]] + then + bash ./tests/travis/docker-run-mysql-or-mariadb.sh + mysql < tests/travis/create-mysql-schema.sql + fi install: - travis_retry composer -n install --prefer-dist @@ -53,42 +58,32 @@ jobs: - stage: Test php: 7.2 - env: DB=mysql.docker MYSQL_VERSION=8.0 + env: DB=mysql.docker IMAGE=mysql:8.0 sudo: required services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.2 - env: DB=mysqli.docker MYSQL_VERSION=8.0 + env: DB=mysqli.docker IMAGE=mysql:8.0 sudo: required services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.2 - env: DB=mariadb.docker MARIADB_VERSION=10.3 + env: DB=mariadb.docker IMAGE=mariadb:10.3 services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.2 - env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.3 + env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - 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 php: 7.2 env: DB=sqlite @@ -114,74 +109,54 @@ jobs: - bash ./tests/travis/install-mssql.sh - stage: Test php: 7.3 - env: DB=mysql.docker MYSQL_VERSION=5.7 COVERAGE=yes + env: DB=mysql.docker IMAGE=mysql:5.7 COVERAGE=yes sudo: required - before_script: - - bash ./tests/travis/install-mysql-5.7.sh - stage: Test php: 7.3 - env: DB=mysql.docker MYSQL_VERSION=8.0 COVERAGE=yes + env: DB=mysql.docker IMAGE=mysql:8.0 COVERAGE=yes sudo: required services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.3 - env: DB=mysqli.docker MYSQL_VERSION=5.7 COVERAGE=yes + env: DB=mysqli.docker IMAGE=mysql:5.7 COVERAGE=yes sudo: required - before_script: - - bash ./tests/travis/install-mysql-5.7.sh - stage: Test php: 7.3 - env: DB=mysqli.docker MYSQL_VERSION=8.0 COVERAGE=yes + env: DB=mysqli.docker IMAGE=mysql:8.0 COVERAGE=yes sudo: required services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.3 - env: DB=mariadb.docker MARIADB_VERSION=10.1 COVERAGE=yes + env: DB=mariadb.docker IMAGE=mariadb:10.1 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.docker MARIADB_VERSION=10.2 COVERAGE=yes + env: DB=mariadb.docker IMAGE=mariadb:10.2 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.docker MARIADB_VERSION=10.3 COVERAGE=yes + env: DB=mariadb.docker IMAGE=mariadb:10.3 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.1 COVERAGE=yes + env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.1 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.2 COVERAGE=yes + env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.2 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 - env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.3 COVERAGE=yes + env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 COVERAGE=yes services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.3 env: DB=pgsql POSTGRESQL_VERSION=9.4 COVERAGE=yes @@ -203,16 +178,12 @@ jobs: sudo: required addons: postgresql: "10" - before_script: - - bash ./tests/travis/install-postgres-10.sh - stage: Test 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 @@ -249,42 +220,32 @@ jobs: - travis_retry composer update --prefer-dist --prefer-lowest - stage: Test php: 7.4 - env: DB=mysql.docker MYSQL_VERSION=8.0 + env: DB=mysql.docker IMAGE=mysql:8.0 sudo: required services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.4 - env: DB=mysqli.docker MYSQL_VERSION=8.0 + env: DB=mysqli.docker IMAGE=mysql:8.0 sudo: required services: - docker - before_script: - - bash ./tests/travis/install-mysql-8.0.sh - stage: Test php: 7.4 - env: DB=mariadb.docker MARIADB_VERSION=10.3 + env: DB=mariadb.docker IMAGE=mariadb:10.3 services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test php: 7.4 - env: DB=mariadb.mysqli.docker MARIADB_VERSION=10.3 + env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 services: - docker - before_script: - - bash ./tests/travis/install-mariadb.sh - stage: Test 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.4 env: DB=sqlite diff --git a/tests/travis/docker-run-mysql-or-mariadb.sh b/tests/travis/docker-run-mysql-or-mariadb.sh new file mode 100644 index 00000000000..e38325f62d9 --- /dev/null +++ b/tests/travis/docker-run-mysql-or-mariadb.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -ex + +echo "Starting RDBMS…" + +sudo 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}" + +until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" rdbms)" == "\"healthy\"" ] +do + echo "Waiting for RDBMS to become ready…" + sleep 1 +done diff --git a/tests/travis/install-mariadb.sh b/tests/travis/install-mariadb.sh deleted file mode 100644 index b089c3b25fb..00000000000 --- a/tests/travis/install-mariadb.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -sudo docker run \ - --health-cmd='mysqladmin ping --silent' \ - -d \ - -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ - -e MYSQL_DATABASE=doctrine_tests \ - -p 33306:3306 \ - --name mariadb \ - mariadb:${MARIADB_VERSION} - -until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mariadb)" == "\"healthy\"" ] -do - echo "Waiting for MariaDB to become ready…" - sleep 1 -done diff --git a/tests/travis/install-mysql-5.7.sh b/tests/travis/install-mysql-5.7.sh deleted file mode 100644 index 8967166635a..00000000000 --- a/tests/travis/install-mysql-5.7.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo "Starting MySQL 5.7..." - -sudo docker run \ - --health-cmd='mysqladmin ping --silent' \ - -d \ - -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ - -e MYSQL_DATABASE=doctrine_tests \ - -p 33306:3306 \ - --name mysql57 \ - mysql:5.7 - -until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mysql57)" == "\"healthy\"" ] -do - echo "Waiting for MySQL to become ready…" - sleep 1 -done diff --git a/tests/travis/install-mysql-8.0.sh b/tests/travis/install-mysql-8.0.sh deleted file mode 100644 index 79d72a263c8..00000000000 --- a/tests/travis/install-mysql-8.0.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo "Starting MySQL 8.0..." - -sudo docker pull mysql:8.0 -sudo docker run \ - --health-cmd='mysqladmin ping --silent' \ - -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 - -until [ "$(sudo docker inspect --format "{{json .State.Health.Status }}" mysql80)" == "\"healthy\"" ] -do - echo "Waiting for MySQL to become ready…" - sleep 1 -done