Skip to content

Commit

Permalink
Merge pull request #3407 from morozov/mysql8-docker
Browse files Browse the repository at this point in the history
CI: Test against MySQL 8.0 on Travis
  • Loading branch information
Ocramius authored Dec 14, 2018
2 parents 4997f10 + 314529f commit 3ad6b79
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 22 deletions.
30 changes: 18 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ jobs:
- bash ./tests/travis/install-mysql-5.7.sh
- stage: Test
php: 7.2
env: DB=mysql MYSQL_VERSION=8.0 COVERAGE=yes
dist: xenial
env: DB=mysql.docker MYSQL_VERSION=8.0 COVERAGE=yes
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
- stage: Test
Expand All @@ -72,9 +73,10 @@ jobs:
- bash ./tests/travis/install-mysql-5.7.sh
- stage: Test
php: 7.2
env: DB=mysqli MYSQL_VERSION=8.0 COVERAGE=yes
dist: xenial
env: DB=mysqli.docker MYSQL_VERSION=8.0 COVERAGE=yes
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
- stage: Test
Expand Down Expand Up @@ -207,16 +209,18 @@ jobs:
- travis_retry composer update --prefer-dist --prefer-lowest
- stage: Test
php: 7.3
env: DB=mysql MYSQL_VERSION=8.0
dist: xenial
env: DB=mysql.docker MYSQL_VERSION=8.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
- stage: Test
php: 7.3
env: DB=mysqli MYSQL_VERSION=8.0
dist: xenial
env: DB=mysqli.docker MYSQL_VERSION=8.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
- stage: Test
Expand Down Expand Up @@ -260,16 +264,18 @@ jobs:
- bash ./tests/travis/install-mssql.sh
- stage: Test
php: nightly
env: DB=mysql MYSQL_VERSION=8.0
dist: xenial
env: DB=mysql.docker MYSQL_VERSION=8.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
- stage: Test
php: nightly
env: DB=mysqli MYSQL_VERSION=8.0
dist: xenial
env: DB=mysqli.docker MYSQL_VERSION=8.0
sudo: required
services:
- docker
before_script:
- bash ./tests/travis/install-mysql-8.0.sh
- stage: Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ private function getConnection(array $driverOptions)
[
'host' => $GLOBALS['db_host'],
'dbname' => $GLOBALS['db_name'],
'port' => $GLOBALS['db_port'],
],
$GLOBALS['db_username'],
$GLOBALS['db_password'],
Expand Down
23 changes: 13 additions & 10 deletions tests/travis/install-mysql-8.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

set -ex

echo "Installing MySQL 8.0..."
echo "Starting MySQL 8.0..."

echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections
wget https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.deb
sudo dpkg --install mysql-apt-config_0.8.10-1_all.deb
sudo apt-get update -q
sudo apt-get install -q -y --force-yes -o Dpkg::Options::=--force-confnew mysql-server
echo -e "[mysqld]\ndefault_authentication_plugin=mysql_native_password" | sudo tee --append /etc/mysql/my.cnf
sudo /etc/init.d/mysql start
sudo mysql_upgrade
echo -e "[mysqld]\ndefault_authentication_plugin=mysql_native_password" > /tmp/mysql-auth.cnf

mysql --version
sudo docker pull mysql:8.0
sudo docker run \
-d \
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
-e MYSQL_DATABASE=doctrine_tests \
-v /tmp/mysql-auth.cnf:/etc/mysql/conf.d/auth.cnf:ro \
-p 33306:3306 \
--name mysql80 \
mysql:8.0

sudo docker exec -i mysql80 bash <<< 'until echo \\q | mysql doctrine_tests > /dev/null 2>&1 ; do sleep 1; done'
49 changes: 49 additions & 0 deletions tests/travis/mysql.docker.travis.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?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="127.0.0.1" />
<var name="db_username" value="root" />
<var name="db_password" value="" />
<var name="db_name" value="doctrine_tests" />
<var name="db_port" value="33306"/>

<var name="tmpdb_type" value="pdo_mysql"/>
<var name="tmpdb_host" value="127.0.0.1" />
<var name="tmpdb_username" value="root" />
<var name="tmpdb_password" value="" />
<var name="tmpdb_port" value="33306"/>
</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>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>
49 changes: 49 additions & 0 deletions tests/travis/mysqli.docker.travis.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?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="127.0.0.1" />
<var name="db_username" value="root" />
<var name="db_password" value="" />
<var name="db_name" value="doctrine_tests" />
<var name="db_port" value="33306"/>

<var name="tmpdb_type" value="mysqli"/>
<var name="tmpdb_host" value="127.0.0.1" />
<var name="tmpdb_username" value="root" />
<var name="tmpdb_password" value="" />
<var name="tmpdb_port" value="33306"/>
</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>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

<groups>
<exclude>
<group>performance</group>
<group>locking_functional</group>
</exclude>
</groups>
</phpunit>

0 comments on commit 3ad6b79

Please sign in to comment.