Skip to content

Commit 972981e

Browse files
authored
Tests with PostgreSQL SQlite (#5)
* Update run-tests.yml * Added multiple database drivers to tests
1 parent fcb8da8 commit 972981e

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

.github/workflows/run-tests.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,37 @@ jobs:
1010
matrix:
1111
php: [8.0, 7.4]
1212
laravel: [8.*, 7.*]
13+
db: [mysql, postgres, sqlite]
1314
dependency-version: [prefer-lowest, prefer-stable]
1415
include:
1516
- laravel: 8.*
1617
testbench: 6.*
1718
- laravel: 7.*
1819
testbench: 5.*
1920

20-
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
21+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - DB ${{ matrix.db }} - ${{ matrix.dependency-version }}
2122

2223
services:
2324
mysql:
2425
image: mysql:5.7
2526
env:
2627
MYSQL_ALLOW_EMPTY_PASSWORD: no
2728
MYSQL_USER: protone_media_db_test
28-
MYSQL_DATABASE: protone_media_db_test
29+
MYSQL_DATABASE: protone_media_db_test_mysql
2930
MYSQL_PASSWORD: secret
3031
MYSQL_ROOT_PASSWORD: secret
3132
ports:
3233
- 3306
3334
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
34-
35+
postgres:
36+
image: postgres:10.8
37+
env:
38+
POSTGRES_USER: protone_media_db_test
39+
POSTGRES_PASSWORD: secret
40+
POSTGRES_DB: protone_media_db_test_postgres
41+
ports:
42+
- 5432:5432
43+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
3544

3645
steps:
3746
- name: Checkout code
@@ -55,10 +64,28 @@ jobs:
5564
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
5665
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
5766
58-
- name: Execute tests
67+
- name: Execute tests (MySQL)
5968
run: vendor/bin/phpunit
69+
if: ${{ matrix.db == 'mysql' }}
6070
env:
61-
DB_DATABASE: protone_media_db_test
71+
DB_DATABASE: protone_media_db_test_mysql
6272
DB_USERNAME: protone_media_db_test
6373
DB_PASSWORD: secret
64-
DB_PORT: ${{ job.services.mysql.ports[3306] }}
74+
DB_PORT: ${{ job.services.mysql.ports[3306] }}
75+
76+
- name: Execute tests (PostgreSQL)
77+
run: vendor/bin/phpunit
78+
if: ${{ matrix.db == 'postgres' }}
79+
env:
80+
DB_CONNECTION: pgsql
81+
DB_DATABASE: protone_media_db_test_postgres
82+
DB_USERNAME: protone_media_db_test
83+
DB_PASSWORD: secret
84+
DB_PORT: ${{ job.services.postgres.ports[5432] }}
85+
86+
- name: Execute tests (SQLite)
87+
run: vendor/bin/phpunit
88+
if: ${{ matrix.db == 'sqlite' }}
89+
env:
90+
DB_CONNECTION: sqlite
91+
DB_DATABASE: ':memory:'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Stop duplicating your Eloquent query scopes and constraints in PHP. This package
1515
* PHP 7.4+
1616
* Laravel 7.0 and higher
1717

18-
This package has been tested with MySQL 5.7+ but others drivers should work as well.
18+
This package is tested with GitHub Actions using MySQL 5.7, PostgreSQL 10.8 and SQLite.
1919

2020
## Features
2121

0 commit comments

Comments
 (0)