Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Commit

Permalink
Merge pull request #192 from adrianb93/feature/ci-for-postgres
Browse files Browse the repository at this point in the history
CI Tests on Postgres and MySQL
  • Loading branch information
freekmurze committed Sep 5, 2019
2 parents 4248f18 + 115ad6b commit 30d13ae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
10 changes: 7 additions & 3 deletions .travis.yml
Expand Up @@ -7,9 +7,13 @@ matrix:
fast_finish: true
include:
- php: 7.3
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-lowest'
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-lowest' DB_CONNECTION='mysql' DB_PORT='3306' DB_USERNAME='username' DB_PASSWORD='password'
- php: 7.3
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-stable'
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-lowest' DB_CONNECTION='pgsql' DB_PORT='5432' DB_USERNAME='username' DB_PASSWORD='password'
- php: 7.3
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-stable' DB_CONNECTION='mysql' DB_PORT='3306' DB_USERNAME='username' DB_PASSWORD='password'
- php: 7.3
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-stable' DB_CONNECTION='pgsql' DB_PORT='5432' DB_USERNAME='username' DB_PASSWORD='password'

sudo: false

Expand All @@ -24,7 +28,7 @@ install:
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction --no-suggest

script:
- vendor/bin/phpunit
- DB_CONNECTION=${DB_CONNECTION} DB_PORT=${DB_PORT} DB_USERNAME=${DB_USERNAME} DB_PASSWORD=${DB_PASSWORD} vendor/bin/phpunit

after_script:
- docker-compose -f ./tests/docker-compose.yml down
11 changes: 10 additions & 1 deletion tests/docker-compose.yml
Expand Up @@ -11,4 +11,13 @@ services:
MYSQL_ROOT_HOST: "0.0.0.0"
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
ports:
- "3306:3306"
- "3306:3306"
postgres:
restart: always
image: postgres:11
environment:
POSTGRES_DB: "laravel_event_projector"
POSTGRES_USER: "username"
POSTGRES_PASSWORD: "password"
ports:
- "5432:5432"
1 change: 1 addition & 0 deletions tests/wait.php
Expand Up @@ -5,6 +5,7 @@
while (true) {
try {
new PDO('mysql:host=127.0.0.1;dbname=laravel_event_projector', 'username', 'password');
new PDO('pgsql:host=127.0.0.1;dbname=laravel_event_projector', 'username', 'password');
fwrite(STDOUT, 'Docker container started!'.PHP_EOL);
exit(0);
} catch (PDOException $exception) {
Expand Down

0 comments on commit 30d13ae

Please sign in to comment.