From 7c7654a4e46399d0e71bf317acb555174acdd004 Mon Sep 17 00:00:00 2001 From: SzymonKostrubiec Date: Fri, 5 Jul 2024 14:45:26 +0200 Subject: [PATCH 1/9] OP-351 - Update builds --- .github/workflows/build.yml | 93 +++++++++------------------ .github/workflows/coding_standard.yml | 58 ++++++++--------- 2 files changed, 60 insertions(+), 91 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc3c3a502..3499dd7ce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,4 @@ name: Build - on: push: branches-ignore: @@ -8,8 +7,7 @@ on: release: types: [created] schedule: - - - cron: "0 1 * * 6" # Run at 1am every Saturday + - cron: "0 1 * * 6" workflow_dispatch: ~ jobs: @@ -23,7 +21,7 @@ jobs: matrix: php: ["8.1", "8.2", "8.3"] symfony: ["^5.4", "^6.4"] - sylius: ["~1.12.0", "~1.13.0"] + sylius: ["^1.12", "^1.13"] node: ["18.x", "20.x"] mysql: ["8.0"] @@ -32,11 +30,9 @@ jobs: DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" steps: - - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - - name: Setup PHP + - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: "${{ matrix.php }}" @@ -44,45 +40,37 @@ jobs: tools: flex, symfony coverage: none - - - name: Setup Node + - name: Setup Node uses: actions/setup-node@v4 with: node-version: "${{ matrix.node }}" - - - name: Shutdown default MySQL + - name: Shutdown default MySQL run: sudo service mysql stop - - - name: Setup MySQL + - name: Setup MySQL uses: mirromutth/mysql-action@v1.1 with: mysql version: "${{ matrix.mysql }}" mysql root password: "root" - - - name: Output PHP version for Symfony CLI + - name: Output PHP version for Symfony CLI run: php -v | head -n 1 | awk '{ print $2 }' > .php-version - - - name: Install certificates + - 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 + - name: Run webserver run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) - - - name: Get Composer cache directory + - name: Get Composer cache directory id: composer-cache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache Composer + - name: Cache Composer uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} @@ -90,28 +78,23 @@ jobs: restore-keys: | ${{ runner.os }}-php-${{ matrix.php }}-composer- - - - name: Restrict Sylius version + - name: Restrict Sylius version if: matrix.sylius != '' run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction - - - name: Install PHP dependencies + - name: Install PHP dependencies run: composer install --no-interaction env: - SYMFONY_REQUIRE: ${{ matrix.symfony }} + SYMFONY_REQUIRE: ${{ matrix.symfony }} - - - name: Install Behat driver + - name: Install Behat driver run: vendor/bin/bdi browser:google-chrome drivers - - - name: Get Yarn cache directory + - name: Get Yarn cache directory id: yarn-cache run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - name: Cache Yarn + - name: Cache Yarn uses: actions/cache@v4 with: path: ${{ steps.yarn-cache.outputs.dir }} @@ -119,53 +102,42 @@ jobs: restore-keys: | ${{ runner.os }}-node-${{ matrix.node }}-yarn- - - - name: Install JS dependencies + - name: Install JS dependencies run: | (cd tests/Application && yarn install) - - - name: Prepare test application database + - name: Prepare test application database run: | (cd tests/Application && bin/console doctrine:database:create -vvv) (cd tests/Application && bin/console doctrine:migrations:migrate -n -vvv -q) - - - name: Prepare test application assets + - name: Prepare test application assets run: | (cd tests/Application && bin/console assets:install public -vvv) (cd tests/Application && yarn build:prod) - - - name: Prepare test application cache + - name: Prepare test application cache run: (cd tests/Application && bin/console cache:warmup -vvv) - - - name: Load fixtures in test application + - name: Load fixtures in test application run: (cd tests/Application && bin/console sylius:fixtures:load -n) - - - name: Validate composer.json + - name: Validate composer.json run: composer validate --ansi --strict - - - name: Validate database schema + - name: Validate database schema run: (cd tests/Application && bin/console doctrine:schema:validate) - - - name: Run PHPSpec + - name: Run PHPSpec run: vendor/bin/phpspec run --ansi -f progress --no-interaction - - - name: Run PHPUnit + - name: Run PHPUnit run: vendor/bin/phpunit --colors=always - - - name: Run Behat - run: vendor/bin/behat --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun + - name: Run Behat + run: vendor/bin/behat --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun - - - name: Upload Behat logs + - name: Upload Behat logs uses: actions/upload-artifact@v3 if: failure() with: @@ -173,8 +145,7 @@ jobs: path: etc/build/ if-no-files-found: ignore - - - name: Failed build Slack notification + - name: Failed build Slack notification uses: rtCamp/action-slack-notify@v2 if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} env: @@ -184,4 +155,4 @@ jobs: 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 }} + SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} \ No newline at end of file diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index dff8e5644..2bdc2a3a1 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -1,58 +1,56 @@ name: Coding standard on: - push: - branches-ignore: - - 'dependabot/**' pull_request: ~ release: types: [created] - schedule: - - - cron: "0 1 * * 6" # Run at 1am every Saturday workflow_dispatch: ~ jobs: tests: runs-on: ubuntu-latest - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" strategy: - fail-fast: false - matrix: - php: ["8.1"] - symfony: ["^5.4", "^6.4"] - sylius: ["~1.13.0"] - node: ["20.x"] - - env: - APP_ENV: test + fail-fast: false + matrix: + php: ["8.1", "8.2", "8.3"] + symfony: ["^5.4", "^6.4"] + sylius: ["^1.12", "^1.13"] + node: ["18.x", "20.x"] steps: - - uses: actions/checkout@v3 + uses: actions/checkout@v2 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "${{ matrix.php }}" - extensions: intl - tools: flex, symfony - coverage: none + php-version: "${{ matrix.php }}" + extensions: intl + tools: symfony + coverage: none - name: Get Composer cache directory id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache Composer - uses: actions/cache@v4 + uses: actions/cache@v2 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: 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: Restrict Sylius version if: matrix.sylius != '' @@ -61,17 +59,17 @@ jobs: - name: Install PHP dependencies run: composer install --no-interaction - env: - SYMFONY_REQUIRE: ${{ matrix.symfony }} - name: Run PHPStan - run: vendor/bin/phpstan analyse + run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ - - name: Run ECS - run: vendor/bin/ecs + - + name: Run ECS + run: vendor/bin/ecs check src/ - - name: Failed build Slack notification + - + name: Failed build Slack notification uses: rtCamp/action-slack-notify@v2 if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} env: @@ -81,4 +79,4 @@ jobs: 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 }} + SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} \ No newline at end of file From ed4230ce8523c053f257f15a3d746e15d0592d4b Mon Sep 17 00:00:00 2001 From: SzymonKostrubiec Date: Fri, 5 Jul 2024 14:52:29 +0200 Subject: [PATCH 2/9] OP-351 - Update conding standard build, add on push event --- .github/workflows/coding_standard.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index 2bdc2a3a1..646f019cd 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -1,6 +1,9 @@ name: Coding standard on: + push: + branches-ignore: + - 'dependabot/**' pull_request: ~ release: types: [created] From 3d94229f4dd8042eb7995b2a891535b7f241e8ad Mon Sep 17 00:00:00 2001 From: SzymonKostrubiec Date: Fri, 5 Jul 2024 14:56:31 +0200 Subject: [PATCH 3/9] OP-351 - Rename phpstan configuration file --- phpstan.neon.dist => phpstan.neon | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename phpstan.neon.dist => phpstan.neon (100%) diff --git a/phpstan.neon.dist b/phpstan.neon similarity index 100% rename from phpstan.neon.dist rename to phpstan.neon From f49ba9d594cbd8c3e132133ae20074a2dc182f37 Mon Sep 17 00:00:00 2001 From: SzymonKostrubiec Date: Mon, 8 Jul 2024 07:44:50 +0200 Subject: [PATCH 4/9] OP-351 - Update coding standards build file --- .github/workflows/coding_standard.yml | 139 +++++++++++++------------- 1 file changed, 67 insertions(+), 72 deletions(-) diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index 646f019cd..b19ad661c 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -1,85 +1,80 @@ name: Coding standard on: - push: - branches-ignore: - - 'dependabot/**' - pull_request: ~ - release: - types: [created] - workflow_dispatch: ~ + pull_request: ~ + release: + types: [created] + workflow_dispatch: ~ jobs: - tests: - runs-on: ubuntu-latest + tests: + runs-on: ubuntu-latest - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" - strategy: - fail-fast: false - matrix: - php: ["8.1", "8.2", "8.3"] - symfony: ["^5.4", "^6.4"] - sylius: ["^1.12", "^1.13"] - node: ["18.x", "20.x"] + strategy: + fail-fast: false + matrix: + php: ["8.1", "8.2", "8.3"] + symfony: ["^5.4", "^6.4"] + sylius: ["^1.12", "^1.13"] + node: ["18.x", "20.x"] - steps: - - - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - extensions: intl - tools: symfony - coverage: none - - - name: Get Composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + steps: + - uses: actions/checkout@v3 - - - name: Cache Composer - uses: actions/cache@v2 - 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: 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: Restrict Sylius version - if: matrix.sylius != '' - run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + extensions: intl + tools: symfony + coverage: none + - name: Get Composer cache directory + id: composer-cache + run: echo echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Install PHP dependencies - run: composer install --no-interaction + - 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 8 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/ + - 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 }} \ No newline at end of file + - name: Install PHP dependencies + run: composer install --no-interaction + env: + SYMFONY_REQUIRE: ${{ matrix.symfony }} + + - name: Run PHPStan src dir + run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ + + - name: Run PHPStan spec dir + run: vendor/bin/phpstan analyse -c phpstan.neon -l 6 spec/ + + - name: Run ECS + run: vendor/bin/ecs + + - 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 }} \ No newline at end of file From cb7969e445287f0cfcb6b55c2430602ba5c3a55a Mon Sep 17 00:00:00 2001 From: Szymon Kostrubiec Date: Mon, 8 Jul 2024 07:59:47 +0200 Subject: [PATCH 5/9] OP-351 - Enable coding standard on push --- .github/workflows/coding_standard.yml | 130 +++++++++++++------------- 1 file changed, 67 insertions(+), 63 deletions(-) diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index b19ad661c..daad2b19a 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -1,80 +1,84 @@ name: Coding standard on: - pull_request: ~ - release: - types: [created] - workflow_dispatch: ~ + push: + branches-ignore: + - 'dependabot/**' + pull_request: ~ + release: + types: [created] + workflow_dispatch: ~ jobs: - tests: - runs-on: ubuntu-latest + tests: + runs-on: ubuntu-latest - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" - strategy: - fail-fast: false - matrix: - php: ["8.1", "8.2", "8.3"] - symfony: ["^5.4", "^6.4"] - sylius: ["^1.12", "^1.13"] - node: ["18.x", "20.x"] + strategy: + fail-fast: false + matrix: + php: ["8.1", "8.2", "8.3"] + symfony: ["^5.4", "^6.4"] + sylius: ["^1.12", "^1.13"] + node: ["18.x", "20.x"] - steps: - - uses: actions/checkout@v3 + steps: + - uses: actions/checkout@v3 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - extensions: intl - tools: symfony - coverage: none - - name: Get Composer cache directory - id: composer-cache - run: echo echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + extensions: intl + tools: symfony + coverage: none - - 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: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - 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: 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: Restrict Sylius version - if: matrix.sylius != '' - run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction + - 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: Install PHP dependencies - run: composer install --no-interaction - env: - SYMFONY_REQUIRE: ${{ matrix.symfony }} + - name: Restrict Sylius version + if: matrix.sylius != '' + run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction - - name: Run PHPStan src dir - run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ + - name: Install PHP dependencies + run: composer install --no-interaction + env: + SYMFONY_REQUIRE: ${{ matrix.symfony }} - - name: Run PHPStan spec dir - run: vendor/bin/phpstan analyse -c phpstan.neon -l 6 spec/ + - name: Run PHPStan src dir + run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ - - name: Run ECS - run: vendor/bin/ecs + - name: Run PHPStan spec dir + run: vendor/bin/phpstan analyse -c phpstan.neon -l 6 spec/ - - 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 }} \ No newline at end of file + - name: Run ECS + run: vendor/bin/ecs + + - 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 }} From 657f0c0c3a167fdf06303e96bfec37c7ac026a74 Mon Sep 17 00:00:00 2001 From: Szymon Kostrubiec Date: Mon, 8 Jul 2024 08:24:52 +0200 Subject: [PATCH 6/9] OP-351 - Apply changes from bitbag bible --- .github/workflows/build.yml | 12 +-- .github/workflows/coding_standard.yml | 131 +++++++++++++------------- 2 files changed, 70 insertions(+), 73 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3499dd7ce..19b73657e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: - 'dependabot/**' pull_request: ~ release: - types: [created] + types: [ created ] schedule: - cron: "0 1 * * 6" workflow_dispatch: ~ @@ -19,11 +19,11 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.1", "8.2", "8.3"] - symfony: ["^5.4", "^6.4"] - sylius: ["^1.12", "^1.13"] - node: ["18.x", "20.x"] - mysql: ["8.0"] + php: [ "8.1", "8.2", "8.3" ] + symfony: [ "^5.4", "^6.4" ] + sylius: [ "^1.12", "^1.13" ] + node: [ "18.x", "20.x" ] + mysql: [ "8.0" ] env: APP_ENV: test diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index daad2b19a..8f49a540c 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -1,84 +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 + tests: + runs-on: ubuntu-latest - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" - strategy: - fail-fast: false - matrix: - php: ["8.1", "8.2", "8.3"] - symfony: ["^5.4", "^6.4"] - sylius: ["^1.12", "^1.13"] - node: ["18.x", "20.x"] + strategy: + fail-fast: false + matrix: + php: [ "8.1", "8.2", "8.3" ] + symfony: [ "^5.4", "^6.4" ] + sylius: [ "^1.12", "^1.13" ] + node: [ "18.x", "20.x" ] - steps: - - uses: actions/checkout@v3 + steps: + - uses: actions/checkout@v3 - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - extensions: intl - tools: symfony - coverage: none + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + extensions: intl + tools: symfony + coverage: none - - name: Get Composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - 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: 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: 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: 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: Restrict Sylius version - if: matrix.sylius != '' - run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction + - name: Restrict Sylius version + if: matrix.sylius != '' + run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction - - name: Install PHP dependencies - run: composer install --no-interaction - env: - SYMFONY_REQUIRE: ${{ matrix.symfony }} + - name: Install PHP dependencies + run: composer install --no-interaction + env: + SYMFONY_REQUIRE: ${{ matrix.symfony }} - - name: Run PHPStan src dir - run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ + - name: Run PHPStan + run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ - - name: Run PHPStan spec dir - run: vendor/bin/phpstan analyse -c phpstan.neon -l 6 spec/ + - name: Run ECS + run: vendor/bin/ecs - - name: Run ECS - run: vendor/bin/ecs - - - 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: 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 }} From 37f5ea76ce2a622fd279bbe6485d6f993c995324 Mon Sep 17 00:00:00 2001 From: Szymon Kostrubiec Date: Mon, 15 Jul 2024 13:32:33 +0200 Subject: [PATCH 7/9] OP-351 - CR fixes, add PHP 8.0 check rule for Sylius 1.12 on symfony 5.4 --- .github/workflows/build.yml | 9 ++++++++- .github/workflows/coding_standard.yml | 11 +++++++++-- phpstan.neon => phpstan.neon.dist | 0 3 files changed, 17 insertions(+), 3 deletions(-) rename phpstan.neon => phpstan.neon.dist (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 19b73657e..799f5927a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,12 +19,19 @@ jobs: strategy: fail-fast: false matrix: - php: [ "8.1", "8.2", "8.3" ] + php: [ "8.0", "8.1", "8.2", "8.3" ] symfony: [ "^5.4", "^6.4" ] sylius: [ "^1.12", "^1.13" ] node: [ "18.x", "20.x" ] mysql: [ "8.0" ] + exclude: + - sylius: ^1.13 + php: 8.0 + - sylius: ^1.12 + php: 8.0 + symfony: ^6.4 + env: APP_ENV: test DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index 8f49a540c..a1d76639f 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -18,11 +18,18 @@ jobs: strategy: fail-fast: false matrix: - php: [ "8.1", "8.2", "8.3" ] + php: [ "8.0", "8.1", "8.2", "8.3" ] symfony: [ "^5.4", "^6.4" ] sylius: [ "^1.12", "^1.13" ] node: [ "18.x", "20.x" ] + exclude: + - sylius: ^1.13 + php: 8.0 + - sylius: ^1.12 + php: 8.0 + symfony: ^6.4 + steps: - uses: actions/checkout@v3 @@ -63,7 +70,7 @@ jobs: SYMFONY_REQUIRE: ${{ matrix.symfony }} - name: Run PHPStan - run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/ + run: vendor/bin/phpstan analyse -c phpstan.neon.dist -l 8 src/ - name: Run ECS run: vendor/bin/ecs diff --git a/phpstan.neon b/phpstan.neon.dist similarity index 100% rename from phpstan.neon rename to phpstan.neon.dist From 40ac776349afb1ef86383c2eb645d94f34216d03 Mon Sep 17 00:00:00 2001 From: Szymon Kostrubiec Date: Mon, 15 Jul 2024 13:41:28 +0200 Subject: [PATCH 8/9] OP-351 - Add phpUnit dependency to fix builds on Sylius 1.12 with PHP 8.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6f32f2416..e3bdf7c11 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "phpstan/phpstan-doctrine": "^1.3", "phpstan/phpstan-strict-rules": "^1.3.0", "phpstan/phpstan-webmozart-assert": "^1.2.0", - "phpunit/phpunit": "^10.5", + "phpunit/phpunit": "^9.5 || ^10.5", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "robertfausk/behat-panther-extension": "^1.1", "sylius-labs/coding-standard": "^4.2", From 5051cf2048af7e631e5511a8ba30f382fac68da7 Mon Sep 17 00:00:00 2001 From: Szymon Kostrubiec Date: Mon, 15 Jul 2024 13:45:29 +0200 Subject: [PATCH 9/9] OP-351 - Add matthiasnoback dependency to fix builds on Sylius 1.12 with PHP 8.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e3bdf7c11..57323587f 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "friends-of-behat/symfony-extension": "^2.1", "friends-of-behat/variadic-extension": "^1.3", "lchrusciel/api-test-case": "^4.1 || ^5.0", - "matthiasnoback/symfony-config-test": "^5.1", + "matthiasnoback/symfony-config-test": "^4.0 || ^5.1", "phpspec/phpspec": "^7.2", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.8.1",