simplify repro #33934
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit | |
on: | |
pull_request: | |
push: | |
schedule: | |
- cron: '0 0/2 * * *' | |
jobs: | |
smoke-test: | |
name: Smoke | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/mvorisek/image-php:${{ matrix.php }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['latest'] | |
type: ['Phpunit'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure PHP | |
run: | | |
rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | |
php --version | |
- name: Setup cache 1/2 | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Setup cache 2/2 | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-smoke-${{ matrix.php }}-${{ matrix.type }}-${{ hashFiles('composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install PHP dependencies | |
run: | | |
if [ "${{ matrix.type }}" != "Phpunit" ] && [ "${{ matrix.type }}" != "StaticAnalysis" ]; then composer remove --no-interaction --no-update phpunit/phpunit ergebnis/phpunit-slow-test-detector --dev; fi | |
if [ "${{ matrix.type }}" != "CodingStyle" ]; then composer remove --no-interaction --no-update friendsofphp/php-cs-fixer ergebnis/composer-normalize --dev; fi | |
if [ "${{ matrix.type }}" != "StaticAnalysis" ]; then composer remove --no-interaction --no-update phpstan/\* behat/\* --dev; fi | |
composer update --ansi --prefer-dist --no-interaction --no-progress --optimize-autoloader | |
- name: "Run tests: SQLite (only for Phpunit)" | |
if: startsWith(matrix.type, 'Phpunit') | |
run: | | |
php demos/_demo-data/create-db.php | |
vendor/bin/phpunit --exclude-group none --no-coverage --fail-on-warning --fail-on-risky $(if vendor/bin/phpunit --version | grep -q '^PHPUnit 9\.'; then echo -v; else echo --fail-on-notice --fail-on-deprecation --display-notices --display-deprecations --display-warnings --display-errors --display-incomplete --display-skipped; fi) | |
- name: Check Coding Style (only for CodingStyle) | |
if: matrix.type == 'CodingStyle' | |
run: | | |
if [ "$(find demos/ -name '*.php' -print0 | xargs -0 grep -L "namespace Atk4\\\\Ui\\\\Demos[;\\\\]" | tee /dev/fd/2)" ]; then echo 'All demos/ files must have namespace declared' && (exit 1); fi | |
vendor/bin/php-cs-fixer fix --dry-run --using-cache=no --diff --verbose | |
composer config --unset version && composer config --unset require-release | |
composer validate --strict --no-check-lock && composer normalize --dry-run --no-check-lock | |
- name: Run Static Analysis (only for StaticAnalysis) | |
if: matrix.type == 'StaticAnalysis' | |
run: | | |
echo "memory_limit = 2G" > /usr/local/etc/php/conf.d/custom-memory-limit.ini | |
vendor/bin/phpstan analyse -v | |
behat-test: | |
name: Behat | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/mvorisek/image-php:${{ matrix.php }}-selenium | |
strategy: | |
fail-fast: false | |
matrix: | |
# Selenium with PHP 7.4 and 8.0 was failing too often on initial/create session request, probably because of older (Alpine 3.16) base image | |
php: ['8.1', '8.2', '8.3'] | |
type: ['Chrome', 'Firefox', 'Firefox Slow', 'Firefox Slow', 'Firefox Slow', 'Firefox Slow', 'Firefox Slow', 'Firefox Slow', 'Firefox Slow', 'Firefox Slow'] | |
i: [1, 2] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure PHP | |
run: | | |
if [ -n "$LOG_COVERAGE" ]; then echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; else rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; fi | |
php --version | |
- name: Setup cache 1/2 | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Setup cache 2/2 | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-behat-${{ matrix.php }}-${{ matrix.type }}-${{ hashFiles('composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install PHP dependencies | |
run: | | |
composer remove --no-interaction --no-update phpunit/phpunit ergebnis/phpunit-slow-test-detector --dev | |
composer remove --no-interaction --no-update friendsofphp/php-cs-fixer ergebnis/composer-normalize --dev | |
composer remove --no-interaction --no-update phpstan/\* --dev | |
composer update --ansi --prefer-dist --no-interaction --no-progress --optimize-autoloader | |
if [ "${{ matrix.type }}" = "Chrome Lowest" ]; then composer update --ansi --prefer-dist --prefer-lowest --prefer-stable --no-interaction --no-progress --optimize-autoloader; fi | |
- name: Init | |
run: | | |
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 & | |
ci_wait_until 'nc -w 1 127.0.0.1 8888' | |
if [ -f /etc/alpine-release ]; then addgroup browser && adduser browser -G browser -D -s /bin/sh; else adduser browser --gecos "" --disabled-login -shell /bin/sh > /dev/null; fi | |
{ Xvfb -ac :99 -screen 0 1920x1200x24 2> /dev/null & } && export DISPLAY=:99 | |
ci_wait_until '[ -e /tmp/.X11-unix/X99 ]' | |
su browser -c 'java -Dwebdriver.chrome.whitelistedIps=127.0.0.1 -jar /opt/selenium-server-standalone.jar -role standalone -host 127.0.0.1 -port 4444 -sessionTimeout 15 -browserTimeout 12 > /dev/null 2>&1 &' | |
ci_wait_until 'nc -w 1 127.0.0.1 4444' | |
if [ "${{ matrix.type }}" = "Firefox" ] || [ "${{ matrix.type }}" = "Firefox Slow" ]; then sed -i "s~chrome~firefox~" behat.yml.dist; fi | |
if [ "${{ matrix.type }}" = "Chrome Slow" ] || [ "${{ matrix.type }}" = "Firefox Slow" ]; then echo 'usleep(490_000);' >> demos/init-app.php; fi | |
- name: "Create test DB" | |
run: | | |
php demos/_demo-data/create-db.php | |
- name: "Run tests: 1" | |
run: | | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
- name: "Run tests: 2" | |
run: | | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
- name: "Run tests: 3" | |
run: | | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
- name: "Run tests: 4" | |
run: | | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
- name: "Run tests: 5" | |
run: | | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
- name: "Run tests: 6" | |
run: | | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
- name: "Run tests: 7" | |
run: | | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
- name: "Run tests: 8" | |
run: | | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
- name: "Run tests: 9" | |
run: | | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
- name: "Run tests: 10" | |
run: | | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist | |
vendor/bin/behat -vv --config behat.yml.dist |