Skip to content

Commit f76ca88

Browse files
Add tests all dbms (#8)
Add tests all dbms (#8) Co-authored-by: Wilmer Arambula <terabytesoftw@users.noreply.github.com> Co-authored-by: Valerii Gorbachev <darkdef@gmail.com>
1 parent 3c7cef5 commit f76ca88

24 files changed

Lines changed: 878 additions & 207 deletions

.github/workflows/mssql.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
on:
2+
pull_request:
3+
push:
4+
5+
name: mssql
6+
7+
jobs:
8+
tests:
9+
name: PHP ${{ matrix.php }}-mssql-${{ matrix.mssql }}
10+
11+
env:
12+
extensions: pdo, pdo_sqlsrv
13+
key: cache
14+
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
matrix:
19+
os:
20+
- ubuntu-latest
21+
22+
php:
23+
- 7.4
24+
- 8.0
25+
26+
mssql:
27+
- server:2017-latest
28+
- server:2019-latest
29+
30+
exclude:
31+
- php: 8.0
32+
mssql: server:2017-latest
33+
34+
services:
35+
mssql:
36+
image: mcr.microsoft.com/mssql/${{ matrix.mssql }}
37+
env:
38+
SA_PASSWORD: YourStrong!Passw0rd
39+
ACCEPT_EULA: Y
40+
MSSQL_PID: Developer
41+
ports:
42+
- 1433:1433
43+
options: --name=mssql --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v2.3.4
48+
49+
- name: Create MS SQL Database
50+
run: docker exec -i mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE yiitest'
51+
52+
- name: Install PHP with extensions
53+
uses: shivammathur/setup-php@v2
54+
with:
55+
php-version: ${{ matrix.php }}
56+
extensions: ${{ env.extensions }}
57+
ini-values: date.timezone='UTC'
58+
coverage: pcov
59+
tools: composer:v2, pecl
60+
61+
- name: Determine composer cache directory on Linux
62+
if: matrix.os == 'ubuntu-latest'
63+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
64+
65+
- name: Determine composer cache directory on Windows
66+
if: matrix.os == 'windows-latest'
67+
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
68+
69+
- name: Cache dependencies installed with composer
70+
uses: actions/cache@v2
71+
with:
72+
path: ${{ env.COMPOSER_CACHE_DIR }}
73+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
74+
restore-keys: |
75+
php${{ matrix.php }}-composer-
76+
77+
- name: Update composer
78+
run: composer self-update
79+
80+
- name: Install db-mssql
81+
run: composer require yiisoft/db-mssql --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
82+
83+
- name: Run tests with phpunit
84+
run: vendor/bin/phpunit --testsuite Mssql --colors=always

.github/workflows/mutation.yml

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ jobs:
1010
mutation:
1111
name: PHP ${{ matrix.php }}-${{ matrix.os }}
1212

13+
env:
14+
extensions: pdo, pdo_mysql, pdo_oci, pdo_pgsql, pdo_sqlsrv, oci8
15+
1316
runs-on: ${{ matrix.os }}
1417

1518
strategy:
@@ -20,14 +23,55 @@ jobs:
2023
php:
2124
- 7.4
2225

26+
services:
27+
mssql:
28+
image: mcr.microsoft.com/mssql/server:2017-latest
29+
env:
30+
SA_PASSWORD: YourStrong!Passw0rd
31+
ACCEPT_EULA: Y
32+
MSSQL_PID: Developer
33+
ports:
34+
- 1433:1433
35+
options: --name=mssql --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1'" --health-interval=10s --health-timeout=5s --health-retries=3
36+
37+
mysql:
38+
image: mysql:latest
39+
env:
40+
MYSQL_ALLOW_EMPTY_PASSWORD: true
41+
MYSQL_PASSWORD: ''
42+
MYSQL_DATABASE: yiitest
43+
ports:
44+
- 3306:3306
45+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
46+
47+
postgres:
48+
image: postgres:14
49+
env:
50+
POSTGRES_USER: scrutinizer
51+
POSTGRES_PASSWORD: scrutinizer
52+
POSTGRES_DB: scrutinizer
53+
ports:
54+
- 5432:5432
55+
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
56+
57+
oci:
58+
image: wnameless/oracle-xe-11g-r2:latest
59+
ports:
60+
- 1521:1521
61+
options: --name=oci
62+
2363
steps:
2464
- name: Checkout
2565
uses: actions/checkout@v2.3.4
2666

67+
- name: Create MS SQL Database
68+
run: docker exec -i mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'CREATE DATABASE yiitest'
69+
2770
- name: Install PHP
2871
uses: shivammathur/setup-php@v2
2972
with:
3073
php-version: "${{ matrix.php }}"
74+
extensions: ${{ env.extensions }}
3175
ini-values: memory_limit=-1
3276
coverage: "pcov"
3377
tools: composer:v2
@@ -46,8 +90,20 @@ jobs:
4690
- name: Update composer
4791
run: composer self-update
4892

49-
- name: Install dependencies with composer
50-
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
93+
- name: Install db-mssql
94+
run: composer require yiisoft/db-mssql --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
95+
96+
- name: Install db-mysql
97+
run: composer require yiisoft/db-mysql --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
98+
99+
- name: Install db-oracle
100+
run: composer require yiisoft/db-oracle --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
101+
102+
- name: Install db-pgsql
103+
run: composer require yiisoft/db-pgsql --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
104+
105+
- name: Install db-sqlite
106+
run: composer require yiisoft/db-sqlite --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
51107

52108
- name: Run infection
53109
run: |

.github/workflows/mysql.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
on:
2+
pull_request:
3+
push:
4+
5+
name: mysql
6+
7+
jobs:
8+
tests:
9+
name: PHP ${{ matrix.php }}-mysql-${{ matrix.mysql }}
10+
11+
env:
12+
extensions: pdo, pdo_mysql
13+
key: cache-v1
14+
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
matrix:
19+
os:
20+
- ubuntu-latest
21+
22+
php:
23+
- 7.4
24+
- 8.0
25+
26+
mysql:
27+
- 5.7
28+
- latest
29+
30+
services:
31+
mysql:
32+
image: mysql:${{ matrix.mysql }}
33+
env:
34+
MYSQL_ALLOW_EMPTY_PASSWORD: true
35+
MYSQL_PASSWORD: ''
36+
MYSQL_DATABASE: yiitest
37+
ports:
38+
- 3306:3306
39+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
40+
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v2
44+
45+
- name: Install PHP with extensions
46+
uses: shivammathur/setup-php@v2
47+
with:
48+
php-version: ${{ matrix.php }}
49+
extensions: ${{ env.extensions }}
50+
ini-values: date.timezone='UTC'
51+
coverage: pcov
52+
53+
- name: Determine composer cache directory on Linux
54+
if: matrix.os == 'ubuntu-latest'
55+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
56+
57+
- name: Determine composer cache directory on Windows
58+
if: matrix.os == 'windows-latest'
59+
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
60+
61+
- name: Cache dependencies installed with composer
62+
uses: actions/cache@v2
63+
with:
64+
path: ${{ env.COMPOSER_CACHE_DIR }}
65+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
66+
restore-keys: |
67+
php${{ matrix.php }}-composer-
68+
69+
- name: Update composer
70+
run: composer self-update
71+
72+
- name: Install db-mysql
73+
run: composer require yiisoft/db-mysql --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
74+
75+
- name: Run tests with phpunit
76+
run: vendor/bin/phpunit --testsuite Mysql --colors=always
77+

.github/workflows/oracle.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
on:
2+
pull_request:
3+
push:
4+
5+
name: oracle
6+
7+
jobs:
8+
tests:
9+
name: PHP ${{ matrix.php }}-${{ matrix.os }}
10+
11+
env:
12+
extensions: pdo, pdo_oci, oci8
13+
key: cache-v1
14+
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
matrix:
19+
os:
20+
- ubuntu-latest
21+
22+
php:
23+
- 7.4
24+
- 8.0
25+
26+
services:
27+
oci:
28+
image: wnameless/oracle-xe-11g-r2:latest
29+
ports:
30+
- 1521:1521
31+
options: --name=oci
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
37+
- name: Install PHP with extensions
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: ${{ matrix.php }}
41+
extensions: ${{ env.extensions }}
42+
ini-values: date.timezone='UTC'
43+
coverage: pcov
44+
tools: composer:v2
45+
46+
- name: Determine composer cache directory
47+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
48+
49+
- name: Cache dependencies installed with composer
50+
uses: actions/cache@v2.1.4
51+
with:
52+
path: ${{ env.COMPOSER_CACHE_DIR }}
53+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
54+
restore-keys: |
55+
php${{ matrix.php }}-composer-
56+
57+
- name: Update composer
58+
run: composer self-update
59+
60+
- name: Install db-oracle
61+
run: composer require yiisoft/db-oracle --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
62+
63+
- name: Run tests with phpunit
64+
run: vendor/bin/phpunit --testsuite Oracle --colors=always

.github/workflows/pgsql.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
on:
2+
pull_request:
3+
push:
4+
5+
name: pgsql
6+
7+
jobs:
8+
tests:
9+
name: PHP ${{ matrix.php }}-pgsql-${{ matrix.pgsql }}
10+
11+
env:
12+
extensions: pdo, pdo_pgsql
13+
key: cache-v1
14+
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
matrix:
19+
os:
20+
- ubuntu-latest
21+
22+
php:
23+
- 7.4
24+
- 8.0
25+
26+
pgsql:
27+
- 9
28+
- 10
29+
- 11
30+
- 12
31+
- 13
32+
- 14
33+
34+
services:
35+
postgres:
36+
image: postgres:${{ matrix.pgsql }}
37+
env:
38+
POSTGRES_USER: scrutinizer
39+
POSTGRES_PASSWORD: scrutinizer
40+
POSTGRES_DB: scrutinizer
41+
ports:
42+
- 5432:5432
43+
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v2.3.4
48+
49+
- name: Install PHP with extensions
50+
uses: shivammathur/setup-php@v2
51+
with:
52+
php-version: ${{ matrix.php }}
53+
extensions: ${{ env.extensions }}
54+
ini-values: date.timezone='UTC'
55+
coverage: pcov
56+
tools: composer:v2
57+
58+
- name: Determine composer cache directory on Linux
59+
if: matrix.os == 'ubuntu-latest'
60+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
61+
62+
- name: Determine composer cache directory on Windows
63+
if: matrix.os == 'windows-latest'
64+
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
65+
66+
- name: Cache dependencies installed with composer
67+
uses: actions/cache@v2
68+
with:
69+
path: ${{ env.COMPOSER_CACHE_DIR }}
70+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
71+
restore-keys: |
72+
php${{ matrix.php }}-composer-
73+
74+
- name: Update composer
75+
run: composer self-update
76+
77+
- name: Install db-pgsql
78+
run: composer require yiisoft/db-pgsql --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
79+
80+
- name: Run tests with phpunit
81+
run: vendor/bin/phpunit --testsuite Pgsql --colors=always

0 commit comments

Comments
 (0)