11name : Unit
22
33on :
4- pull_request :
54 push :
65 schedule :
76 - cron : ' 0 0/2 * * *'
@@ -78,35 +77,12 @@ jobs:
7877 fail-fast : false
7978 matrix :
8079 php : ['7.4', '8.0', '8.1']
81- type : ['Phpunit', 'Phpunit Lowest' ]
80+ type : ['Phpunit']
8281 include :
8382 - php : ' 8.1' # TODO replace with 'latest' once it represents at least PHP 8.1
8483 type : ' Phpunit Burn'
8584 env :
86- LOG_COVERAGE : " ${{ fromJSON('{true: \" 1\" , false: \"\" }')[matrix.php == '8.0' && matrix.type == 'Phpunit' && (github.event_name == 'pull_request' || (github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')))] }}"
87- services :
88- mysql :
89- image : mysql:8
90- 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"
91- mariadb :
92- image : mariadb
93- 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
94- postgres :
95- image : postgres:12-alpine
96- env :
97- POSTGRES_USER : atk4_test_user
98- POSTGRES_PASSWORD : atk4_pass
99- POSTGRES_DB : atk4_test
100- options : --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
101- mssql :
102- image : mcr.microsoft.com/mssql/server
103- env :
104- ACCEPT_EULA : Y
105- SA_PASSWORD : atk4_pass
106- oracle :
107- image : gvenzl/oracle-xe:18
108- env :
109- ORACLE_PASSWORD : atk4_pass
85+ LOG_COVERAGE : " "
11086 steps :
11187 - name : Checkout
11288 uses : actions/checkout@v2
@@ -141,10 +117,6 @@ jobs:
141117
142118 - name : Init
143119 run : |
144- php -r '(new PDO("mysql:host=mysql", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");'
145- php -r '(new PDO("mysql:host=mariadb", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");'
146- php -r '(new PDO("pgsql:host=postgres;dbname=atk4_test", "atk4_test_user", "atk4_pass"))->exec("ALTER ROLE atk4_test_user CONNECTION LIMIT 1");'
147- /usr/lib/oracle/setup.sh
148120 if [ -n "$LOG_COVERAGE" ]; then mkdir coverage && cp tools/CoverageUtil.php demos; fi
149121
150122 - name : " Run tests: SQLite"
@@ -153,62 +125,6 @@ jobs:
153125 php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
154126 if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-sqlite.cov; fi
155127
156- - name : " Run tests: MySQL"
157- env :
158- DB_DSN : " mysql:host=mysql;dbname=atk4_test"
159- DB_USER : atk4_test_user
160- DB_PASSWORD : atk4_pass
161- run : |
162- sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php
163- php demos/_demo-data/create-db.php
164- php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
165- if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-mysql.cov; fi
166-
167- - name : " Run tests: MariaDB"
168- env :
169- DB_DSN : " mysql:host=mariadb;dbname=atk4_test"
170- DB_USER : atk4_test_user
171- DB_PASSWORD : atk4_pass
172- run : |
173- sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php
174- php demos/_demo-data/create-db.php
175- php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
176- if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-mariadb.cov; fi
177-
178- - name : " Run tests: PostgreSQL"
179- env :
180- DB_DSN : " pgsql:host=postgres;dbname=atk4_test"
181- DB_USER : atk4_test_user
182- DB_PASSWORD : atk4_pass
183- run : |
184- sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php
185- php demos/_demo-data/create-db.php
186- php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
187- if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-postgres.cov; fi
188-
189- - name : " Run tests: MSSQL"
190- env :
191- DB_DSN : " sqlsrv:host=mssql;dbname=master;driverOptions[TrustServerCertificate]=1"
192- DB_USER : sa
193- DB_PASSWORD : atk4_pass
194- run : |
195- sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php
196- php demos/_demo-data/create-db.php
197- php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
198- if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-mssql.cov; fi
199-
200- - name : " Run tests: Oracle"
201- env :
202- DB_DSN : " oci:dbname=oracle/xe"
203- DB_USER : system
204- DB_PASSWORD : atk4_pass
205- NLS_LANG : AMERICAN_AMERICA.AL32UTF8
206- run : |
207- sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php
208- php demos/_demo-data/create-db.php
209- php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
210- if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-oracle.cov; fi
211-
212128 - name : Upload coverage logs 1/2 (only for latest Phpunit)
213129 if : env.LOG_COVERAGE
214130 run : |
@@ -231,37 +147,12 @@ jobs:
231147 fail-fast : false
232148 matrix :
233149 php : ['7.4', '8.0', '8.1']
234- type : ['Chrome', 'Chrome Lowest' ]
150+ type : ['Chrome']
235151 include :
236- - php : ' latest'
237- type : ' Firefox'
238152 - php : ' latest'
239153 type : ' Chrome Slow'
240154 env :
241- 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')))] }}"
242- 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 : gvenzl/oracle-xe:18
263- env :
264- ORACLE_PASSWORD : atk4_pass
155+ LOG_COVERAGE : " "
265156 steps :
266157 - name : Checkout
267158 uses : actions/checkout@v2
@@ -321,6 +212,7 @@ jobs:
321212 run : |
322213 cp -r public public.orig && rm public/*.js
323214 (cd js && npm run build)
215+ rm public/*.js.map
324216 diff -qr public.orig public
325217 rm -r public.orig
326218
@@ -335,10 +227,6 @@ jobs:
335227
336228 - name : Init
337229 run : |
338- php -r '(new PDO("mysql:host=mysql", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");'
339- php -r '(new PDO("mysql:host=mariadb", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");'
340- php -r '(new PDO("pgsql:host=postgres;dbname=atk4_test", "atk4_test_user", "atk4_pass"))->exec("ALTER ROLE atk4_test_user CONNECTION LIMIT 1");'
341- /usr/lib/oracle/setup.sh
342230 if [ -n "$LOG_COVERAGE" ]; then mkdir coverage && cp tools/CoverageUtil.php demos; fi
343231 sed -i "s~'https://raw.githack.com/atk4/ui/develop/public.*~'/public',~" src/App.php
344232 ci_wait_until () { timeout 30 sh -c "until { $1 2> /dev/null; }; do sleep 0.02; done" || timeout 15 sh -c "$1" || { echo "health timeout: $1"; exit 1; }; }
@@ -357,62 +245,6 @@ jobs:
357245 php demos/_demo-data/create-db.php
358246 vendor/bin/behat -vv --config behat.yml.dist
359247
360- - name : " Run tests: MySQL (only for coverage or cron)"
361- if : env.LOG_COVERAGE || github.event_name == 'schedule'
362- env :
363- DB_DSN : " mysql:host=mysql;dbname=atk4_test"
364- DB_USER : atk4_test_user
365- DB_PASSWORD : atk4_pass
366- run : |
367- sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php
368- php demos/_demo-data/create-db.php
369- vendor/bin/behat -vv --config behat.yml.dist
370-
371- - name : " Run tests: MariaDB (only for coverage or cron)"
372- if : env.LOG_COVERAGE || github.event_name == 'schedule'
373- env :
374- DB_DSN : " mysql:host=mariadb;dbname=atk4_test"
375- DB_USER : atk4_test_user
376- DB_PASSWORD : atk4_pass
377- run : |
378- sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php
379- php demos/_demo-data/create-db.php
380- vendor/bin/behat -vv --config behat.yml.dist
381-
382- - name : " Run tests: PostgreSQL (only for coverage or cron)"
383- if : env.LOG_COVERAGE || github.event_name == 'schedule'
384- env :
385- DB_DSN : " pgsql:host=postgres;dbname=atk4_test"
386- DB_USER : atk4_test_user
387- DB_PASSWORD : atk4_pass
388- run : |
389- sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php
390- php demos/_demo-data/create-db.php
391- vendor/bin/behat -vv --config behat.yml.dist
392-
393- - name : " Run tests: MSSQL (only for coverage or cron)"
394- if : env.LOG_COVERAGE || github.event_name == 'schedule'
395- env :
396- DB_DSN : " sqlsrv:host=mssql;dbname=master;driverOptions[TrustServerCertificate]=1"
397- DB_USER : sa
398- DB_PASSWORD : atk4_pass
399- run : |
400- sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php
401- php demos/_demo-data/create-db.php
402- vendor/bin/behat -vv --config behat.yml.dist
403-
404- - name : " Run tests: Oracle (only for coverage or cron)"
405- if : env.LOG_COVERAGE || github.event_name == 'schedule'
406- env :
407- DB_DSN : " oci:dbname=oracle/xe"
408- DB_USER : system
409- DB_PASSWORD : atk4_pass
410- NLS_LANG : AMERICAN_AMERICA.AL32UTF8
411- run : |
412- sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php
413- php demos/_demo-data/create-db.php
414- vendor/bin/behat -vv --config behat.yml.dist
415-
416248 - name : Upload coverage logs 1/2 (only for latest Chrome)
417249 if : env.LOG_COVERAGE
418250 run : |
0 commit comments