From 70eb924de6cc0f408f89d474c10139bbd8e2e745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 10 Oct 2022 12:29:38 +0200 Subject: [PATCH] DEBUG no DB testing --- .github/workflows/test-unit.yml | 179 +------------------------------- 1 file changed, 4 insertions(+), 175 deletions(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 803fce9b4c..736c49eb70 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -79,36 +79,13 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.4', '8.0', '8.1', '8.2'] - type: ['Phpunit', 'Phpunit Lowest'] + php: ['8.0', '8.2'] + type: ['Phpunit'] include: - php: '8.1' # TODO replace with 'latest' once it represents at least PHP 8.1 type: 'Phpunit Burn' env: 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')))] }}" - services: - mysql: - image: mysql:8 - 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" - mariadb: - image: mariadb - 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 - postgres: - image: postgres:12-alpine - env: - POSTGRES_USER: atk4_test_user - POSTGRES_PASSWORD: atk4_pass - POSTGRES_DB: atk4_test - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - mssql: - image: mcr.microsoft.com/mssql/server - env: - ACCEPT_EULA: Y - SA_PASSWORD: atk4_pass - oracle: - image: gvenzl/oracle-xe:18-slim-faststart - env: - ORACLE_PASSWORD: atk4_pass steps: - name: Checkout uses: actions/checkout@v3 @@ -143,10 +120,6 @@ jobs: - name: Init run: | - php -r '(new PDO("mysql:host=mysql", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");' - php -r '(new PDO("mysql:host=mariadb", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");' - php -r '(new PDO("pgsql:host=postgres;dbname=atk4_test", "atk4_test_user", "atk4_pass"))->exec("ALTER ROLE atk4_test_user CONNECTION LIMIT 1");' - /usr/lib/oracle/setup.sh if [ -n "$LOG_COVERAGE" ]; then mkdir coverage; fi - name: "Run tests: SQLite" @@ -155,67 +128,6 @@ jobs: 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 if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-sqlite.cov; fi - - name: "Run tests: MySQL" - if: success() || failure() - env: - DB_DSN: "mysql:host=mysql;dbname=atk4_test" - DB_USER: atk4_test_user - DB_PASSWORD: atk4_pass - run: | - sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php - php demos/_demo-data/create-db.php - 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 - if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-mysql.cov; fi - - - name: "Run tests: MariaDB (only for cron)" - if: (success() || failure()) && github.event_name == 'schedule' - env: - DB_DSN: "mysql:host=mariadb;dbname=atk4_test" - DB_USER: atk4_test_user - DB_PASSWORD: atk4_pass - run: | - sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php - php demos/_demo-data/create-db.php - 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 - if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-mariadb.cov; fi - - - name: "Run tests: PostgreSQL (only for cron)" - if: (success() || failure()) && github.event_name == 'schedule' - env: - DB_DSN: "pgsql:host=postgres;dbname=atk4_test" - DB_USER: atk4_test_user - DB_PASSWORD: atk4_pass - run: | - sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php - php demos/_demo-data/create-db.php - 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 - if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-postgres.cov; fi - - - name: "Run tests: MSSQL (only for cron)" - if: (success() || failure()) && github.event_name == 'schedule' - env: - DB_DSN: "sqlsrv:host=mssql;dbname=master;driverOptions[TrustServerCertificate]=1" - DB_USER: sa - DB_PASSWORD: atk4_pass - run: | - sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php - php demos/_demo-data/create-db.php - 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 - if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-mssql.cov; fi - - - name: "Run tests: Oracle (only for cron)" - if: (success() || failure()) && github.event_name == 'schedule' - env: - DB_DSN: "oci:dbname=oracle/xe" - DB_USER: system - DB_PASSWORD: atk4_pass - NLS_LANG: AMERICAN_AMERICA.AL32UTF8 - run: | - sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php - php demos/_demo-data/create-db.php - 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 - if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-oracle.cov; fi - - name: Upload coverage logs 1/2 (only for latest Phpunit) if: env.LOG_COVERAGE run: | @@ -238,8 +150,8 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.4', '8.0', '8.1', '8.2'] - type: ['Chrome', 'Chrome Lowest'] + php: ['8.0', '8.2'] + type: ['Chrome'] include: - php: 'latest' type: 'Firefox' @@ -247,29 +159,6 @@ jobs: type: 'Chrome Slow' env: 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')))] }}" - services: - mysql: - image: mysql:8 - 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" - mariadb: - image: mariadb - 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 - postgres: - image: postgres:12-alpine - env: - POSTGRES_USER: atk4_test_user - POSTGRES_PASSWORD: atk4_pass - POSTGRES_DB: atk4_test - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - mssql: - image: mcr.microsoft.com/mssql/server - env: - ACCEPT_EULA: Y - SA_PASSWORD: atk4_pass - oracle: - image: gvenzl/oracle-xe:18-slim-faststart - env: - ORACLE_PASSWORD: atk4_pass steps: - name: Checkout uses: actions/checkout@v3 @@ -363,10 +252,6 @@ jobs: - name: Init run: | - php -r '(new PDO("mysql:host=mysql", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");' - php -r '(new PDO("mysql:host=mariadb", "root", "atk4_pass_root"))->exec("ALTER USER '"'"'atk4_test_user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 5");' - php -r '(new PDO("pgsql:host=postgres;dbname=atk4_test", "atk4_test_user", "atk4_pass"))->exec("ALTER ROLE atk4_test_user CONNECTION LIMIT 1");' - /usr/lib/oracle/setup.sh if [ -n "$LOG_COVERAGE" ]; then mkdir coverage coverage/js; fi 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; }; } php -d opcache.enable_cli=1 -S 127.0.0.1:8888 > /dev/null 2>&1 & @@ -384,62 +269,6 @@ jobs: php demos/_demo-data/create-db.php vendor/bin/behat -vv --config behat.yml.dist - - name: "Run tests: MySQL (only for coverage or cron)" - if: (success() || failure()) && (env.LOG_COVERAGE || github.event_name == 'schedule') - env: - DB_DSN: "mysql:host=mysql;dbname=atk4_test" - DB_USER: atk4_test_user - DB_PASSWORD: atk4_pass - run: | - sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php - php demos/_demo-data/create-db.php - vendor/bin/behat -vv --config behat.yml.dist - - - name: "Run tests: MariaDB (only for cron)" - if: (success() || failure()) && github.event_name == 'schedule' - env: - DB_DSN: "mysql:host=mariadb;dbname=atk4_test" - DB_USER: atk4_test_user - DB_PASSWORD: atk4_pass - run: | - sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php - php demos/_demo-data/create-db.php - vendor/bin/behat -vv --config behat.yml.dist - - - name: "Run tests: PostgreSQL (only for cron)" - if: (success() || failure()) && github.event_name == 'schedule' - env: - DB_DSN: "pgsql:host=postgres;dbname=atk4_test" - DB_USER: atk4_test_user - DB_PASSWORD: atk4_pass - run: | - sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php - php demos/_demo-data/create-db.php - vendor/bin/behat -vv --config behat.yml.dist - - - name: "Run tests: MSSQL (only for cron)" - if: (success() || failure()) && github.event_name == 'schedule' - env: - DB_DSN: "sqlsrv:host=mssql;dbname=master;driverOptions[TrustServerCertificate]=1" - DB_USER: sa - DB_PASSWORD: atk4_pass - run: | - sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php - php demos/_demo-data/create-db.php - vendor/bin/behat -vv --config behat.yml.dist - - - name: "Run tests: Oracle (only for cron)" - if: (success() || failure()) && github.event_name == 'schedule' - env: - DB_DSN: "oci:dbname=oracle/xe" - DB_USER: system - DB_PASSWORD: atk4_pass - NLS_LANG: AMERICAN_AMERICA.AL32UTF8 - run: | - sed -E "s~(\\\$db = new.+Persistence\\\\Sql)\(.+\);~\\1('$DB_DSN', '$DB_USER', '$DB_PASSWORD');~g" -i demos/db.default.php - php demos/_demo-data/create-db.php - vendor/bin/behat -vv --config behat.yml.dist - - name: Upload coverage logs 1/2 (only for coverage) if: env.LOG_COVERAGE run: |