diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 13227fd..fbbe967 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,8 @@ on: release: types: [created] schedule: - - cron: "0 1 * * 6" # Run at 1am every Saturday + - + cron: "0 1 * * 6" # Run at 1am every Saturday workflow_dispatch: ~ jobs: @@ -22,9 +23,10 @@ jobs: matrix: php: [ "8.2", "8.3" ] symfony: [ "^6.4", "^7.1" ] - sylius: [ "^2.0.4" ] - node: [ "20.x", "22.x" ] - mysql: [ "5.7", "8.0" ] + sylius: [ "~2.0" ] + node: [ "20.x" ] + mysql: ["8.4"] + state_machine_adapter: ["symfony_workflow"] env: APP_ENV: test @@ -60,6 +62,14 @@ jobs: mysql version: "${{ matrix.mysql }}" mysql root password: "root" + - + name: Configure sysctl limits + run: | + sudo swapoff -a + sudo sysctl -w vm.swappiness=1 + sudo sysctl -w fs.file-max=262144 + sudo sysctl -w vm.max_map_count=262144 + - name: Output PHP version for Symfony CLI run: php -v | head -n 1 | awk '{ print $2 }' > .php-version @@ -68,6 +78,14 @@ jobs: name: Install certificates run: symfony server:ca:install + - + name: Run Chrome Headless + run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & + + - + name: Run webserver + run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) + - name: Get Composer cache directory id: composer-cache @@ -81,6 +99,7 @@ jobs: key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} restore-keys: | ${{ runner.os }}-php-${{ matrix.php }}-composer- + - name: Restrict Symfony version if: matrix.symfony != '' @@ -88,6 +107,7 @@ jobs: composer global config --no-plugins allow-plugins.symfony/flex true composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" composer config extra.symfony.require "${{ matrix.symfony }}" + - name: Restrict Sylius version if: matrix.sylius != '' @@ -95,14 +115,12 @@ jobs: - name: Install PHP dependencies - run: composer install --no-interaction - env: - SYMFONY_REQUIRE: ${{ matrix.symfony }} + run: composer install --no-interaction --no-scripts - name: Get Yarn cache directory id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache Yarn @@ -112,6 +130,7 @@ jobs: key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} restore-keys: | ${{ runner.os }}-node-${{ matrix.node }}-yarn- + - name: Install JS dependencies run: (cd tests/Application && yarn install) @@ -121,11 +140,13 @@ jobs: run: | (cd tests/Application && bin/console doctrine:database:create -vvv) (cd tests/Application && bin/console doctrine:schema:create -vvv) + - name: Prepare test application assets run: | - (cd tests/Application && bin/console assets:install public -vvv) (cd tests/Application && yarn encore dev) + (cd tests/Application && bin/console assets:install public -vvv) + - name: Prepare test application cache run: (cd tests/Application && bin/console cache:warmup -vvv) @@ -142,10 +163,26 @@ jobs: name: Validate database schema run: (cd tests/Application && bin/console doctrine:schema:validate) + - + name: Create behat logs directory + run: (mkdir -p etc/build && chmod a+rw etc/build ) - name: Run PHPUnit run: vendor/bin/phpunit --colors=always + - + name: Run Behat + run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun + + - + name: Upload Behat logs + uses: actions/upload-artifact@v4 + if: failure() + with: + name: Behat logs + path: etc/build/ + if-no-files-found: ignore + - name: Failed build Slack notification uses: rtCamp/action-slack-notify@v2 diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index 6866c60..b629a1d 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -1,81 +1,81 @@ name: Coding standard on: - push: - branches-ignore: - - 'dependabot/**' - pull_request: ~ - release: - types: [ created ] - workflow_dispatch: ~ + push: + branches-ignore: + - 'dependabot/**' + pull_request: ~ + release: + types: [ created ] + workflow_dispatch: ~ jobs: - tests: - runs-on: ubuntu-latest - - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" - - strategy: - fail-fast: false - matrix: - php: [ "8.2", "8.3" ] - symfony: [ "^6.4", "^7.1" ] - sylius: [ "^2.0.4" ] - node: [ "20.x", "22.x" ] - - steps: - - uses: actions/checkout@v3 + tests: + runs-on: ubuntu-latest - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - extensions: intl - tools: symfony - coverage: none + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" - - name: Get Composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + strategy: + fail-fast: false + matrix: + php: [ "8.2", "8.3" ] + symfony: [ "^6.4", "^7.1" ] + sylius: [ "~2.0.0" ] + node: [ "20.x" ] - - name: Cache Composer - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json', '**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-composer- + steps: + - uses: actions/checkout@v3 - - name: Restrict Symfony version - if: matrix.symfony != '' - run: | - composer global config --no-plugins allow-plugins.symfony/flex true - composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" - composer config extra.symfony.require "${{ matrix.symfony }}" + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + extensions: intl + tools: symfony + coverage: none - - name: Restrict Sylius version - if: matrix.sylius != '' - run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - name: Install PHP dependencies - run: composer install --no-interaction - env: - SYMFONY_REQUIRE: ${{ matrix.symfony }} + - name: Cache Composer + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json', '**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-composer- - - name: Run PHPStan - run: vendor/bin/phpstan analyse -c phpstan.neon -l 7 src/ + - name: Restrict Symfony version + if: matrix.symfony != '' + run: | + composer global config --no-plugins allow-plugins.symfony/flex true + composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" + composer config extra.symfony.require "${{ matrix.symfony }}" - - name: Run ECS - run: vendor/bin/ecs check src --debug + - name: Restrict Sylius version + if: matrix.sylius != '' + run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction - - name: Failed build Slack notification - uses: rtCamp/action-slack-notify@v2 - if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} - env: - SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} - SLACK_COLOR: ${{ job.status }} - SLACK_ICON: https://github.com/rtCamp.png?size=48 - SLACK_MESSAGE: ':x:' - SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository - SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} - SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} + - name: Install PHP dependencies + run: composer install --no-interaction + env: + SYMFONY_REQUIRE: ${{ matrix.symfony }} + + - name: Run PHPStan + run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src + + - name: Run ECS + run: vendor/bin/ecs check src + + - name: Failed build Slack notification + uses: rtCamp/action-slack-notify@v2 + if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} + env: + SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} + SLACK_COLOR: ${{ job.status }} + SLACK_ICON: https://github.com/rtCamp.png?size=48 + SLACK_MESSAGE: ':x:' + SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository + SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} + SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} diff --git a/behat.yml.dist b/behat.yml.dist index e967482..27012e3 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -15,32 +15,14 @@ default: files_path: "%paths.base%/vendor/sylius/sylius/src/Sylius/Behat/Resources/fixtures/" base_url: "https://127.0.0.1:8080/" default_session: symfony - javascript_session: chrome_headless + javascript_session: chrome sessions: symfony: symfony: ~ - chrome_headless: + chrome: chrome: api_url: http://127.0.0.1:9222 validate_certificate: false - chrome: - selenium2: - browser: chrome - capabilities: - browserName: chrome - browser: chrome - version: "" - marionette: null # https://github.com/Behat/MinkExtension/pull/311 - chrome: - switches: - - "start-fullscreen" - - "start-maximized" - - "no-sandbox" - extra_capabilities: - unexpectedAlertBehaviour: accept - firefox: - selenium2: - browser: firefox show_auto: false FriendsOfBehat\SymfonyExtension: diff --git a/composer.json b/composer.json index 9d57651..603d23d 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,6 @@ }, "require-dev": { "behat/behat": "^3.14", - "behat/mink-selenium2-driver": "^1.6", "bitbag/coding-standard": "^3.0", "dmore/behat-chrome-extension": "^1.4", "dmore/chrome-mink-driver": "^2.9",