Skip to content

Commit 764be36

Browse files
committed
run behat on all DBs
1 parent 19340a4 commit 764be36

File tree

2 files changed

+74
-4
lines changed

2 files changed

+74
-4
lines changed

.github/workflows/test-unit.yml

+73-3
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,28 @@ jobs:
240240
env:
241241
LOG_COVERAGE: "${{ fromJSON('{true: \"1\", false: \"\"}')[matrix.php == '8.0' && matrix.type == 'Chrome' && (github.event_name == 'pull_request' || (github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')))] }}"
242242
services:
243+
mysql:
244+
image: mysql:8
245+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 -e MYSQL_ROOT_PASSWORD=atk4_pass_root -e MYSQL_USER=atk4_test_user -e MYSQL_PASSWORD=atk4_pass -e MYSQL_DATABASE=atk4_test --entrypoint sh mysql:8 -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
246+
mariadb:
247+
image: mariadb
248+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 -e MYSQL_ROOT_PASSWORD=atk4_pass_root -e MYSQL_USER=atk4_test_user -e MYSQL_PASSWORD=atk4_pass -e MYSQL_DATABASE=atk4_test
249+
postgres:
250+
image: postgres:12-alpine
251+
env:
252+
POSTGRES_USER: atk4_test_user
253+
POSTGRES_PASSWORD: atk4_pass
254+
POSTGRES_DB: atk4_test
255+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
256+
mssql:
257+
image: mcr.microsoft.com/mssql/server
258+
env:
259+
ACCEPT_EULA: Y
260+
SA_PASSWORD: atk4_pass
261+
oracle:
262+
image: wnameless/oracle-xe-11g-r2
263+
env:
264+
ORACLE_ALLOW_REMOTE: true
243265
selenium-chrome:
244266
image: selenium/standalone-chrome:latest
245267
options: --health-cmd "/opt/bin/check-grid.sh"
@@ -318,11 +340,12 @@ jobs:
318340
319341
- name: Init
320342
run: |
343+
php -r '(new PDO("mysql:host=mysql", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");'
344+
php -r '(new PDO("mysql:host=mariadb", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");'
345+
php -r '(new PDO("pgsql:host=postgres;dbname=atk4_test", "atk4_test_user", "atk4_pass"))->exec("ALTER ROLE atk4_test_user CONNECTION LIMIT 1");'
321346
if [ -n "$LOG_COVERAGE" ]; then mkdir coverage && cp tools/CoverageUtil.php demos; fi
347+
sed -E "s/\(('sqlite:.+)\);/(\$_ENV['DB_DSN'] ?? \\1, \$_ENV['DB_USER'] ?? null, \$_ENV['DB_PASSWD'] ?? null);/g" -i demos/db.default.php
322348
sed -i "s~'https://raw.githack.com/atk4/ui/develop/public.*~'/public',~" src/App.php
323-
324-
- name: "Run tests: Behat"
325-
run: |
326349
php -S 172.18.0.2:8888 > /dev/null 2>&1 &
327350
sleep 0.2
328351
if [ "${{ matrix.type }}" == "Firefox" ]; then sed -i "s~chrome~firefox~" behat.yml.dist; fi
@@ -333,6 +356,53 @@ jobs:
333356
sed -i 's/usleep(100000)/usleep(5000)/' vendor/behat/mink/src/Element/Element.php
334357
sed -i 's/usleep(100000)/usleep(5000)/' vendor/behat/mink-selenium2-driver/src/Selenium2Driver.php
335358
359+
- name: "Run tests: SQLite"
360+
run: |
361+
php demos/_demo-data/create-db.php
362+
vendor/bin/behat -vv --config behat.yml.dist
363+
364+
- name: "Run tests: MySQL"
365+
env:
366+
DB_DSN: "mysql:host=mysql;dbname=atk4_test"
367+
DB_USER: atk4_test_user
368+
DB_PASSWD: atk4_pass
369+
run: |
370+
php demos/_demo-data/create-db.php
371+
vendor/bin/behat -vv --config behat.yml.dist
372+
373+
- name: "Run tests: MariaDB"
374+
env:
375+
DB_DSN: "mysql:host=mariadb;dbname=atk4_test"
376+
DB_USER: atk4_test_user
377+
DB_PASSWD: atk4_pass
378+
run: |
379+
php demos/_demo-data/create-db.php
380+
vendor/bin/behat -vv --config behat.yml.dist
381+
382+
- name: "Run tests: PostgreSQL"
383+
env:
384+
DB_DSN: "pgsql:host=postgres;dbname=atk4_test"
385+
DB_USER: atk4_test_user
386+
DB_PASSWD: atk4_pass
387+
run: |
388+
php demos/_demo-data/create-db.php
389+
vendor/bin/behat -vv --config behat.yml.dist
390+
391+
- name: "Run tests: MSSQL"
392+
env:
393+
DB_DSN: "sqlsrv:Server=mssql;Database=master"
394+
DB_USER: sa
395+
DB_PASSWD: atk4_pass
396+
run: |
397+
php demos/_demo-data/create-db.php
398+
vendor/bin/behat -vv --config behat.yml.dist
399+
400+
- name: "Run tests: Oracle"
401+
env:
402+
DB_DSN: "oci:dbname=oracle/xe;charset=UTF8"
403+
DB_USER: system
404+
DB_PASSWD: oracle
405+
run: |
336406
php demos/_demo-data/create-db.php
337407
vendor/bin/behat -vv --config behat.yml.dist
338408

demos/_demo-data/create-db.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -493,4 +493,4 @@ public function import(array $rowsMulti)
493493
['id' => 7, 'name' => 'Ice Cream', 'brand' => 'Milk Corp.', 'product_category_id' => 3, 'product_sub_category_id' => 8],
494494
]);
495495

496-
echo 'import complete!' . "\n";
496+
echo 'import complete!' . "\n\n";

0 commit comments

Comments
 (0)