diff --git a/.github/workflows/application.yml b/.github/workflows/application.yml deleted file mode 100644 index 8d525216f61..00000000000 --- a/.github/workflows/application.yml +++ /dev/null @@ -1,1256 +0,0 @@ -name: Application - -on: - push: - tags: - - v1.* - branches-ignore: - - 'dependabot/**' - paths-ignore: - - "adr/**" - - "docs/**" - - "*.md" - pull_request: - paths-ignore: - - "adr/**" - - "docs/**" - - "*.md" - schedule: - - - cron: "0 1 * * 6" # Run at 1am every Saturday - workflow_dispatch: ~ - -jobs: - static-checks: - runs-on: ubuntu-latest - - name: "Static checks (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, API Platform ${{ matrix.api-platform }})" - - timeout-minutes: 10 - - strategy: - fail-fast: false - matrix: - php: ["8.0", "8.1"] - symfony: ["^5.4", "^6.0"] - api-platform: ["^2.7"] - - include: - - - php: "8.1" - symfony: "~6.0.0" - api-platform: "^2.7" - - - php: "8.1" - symfony: "^6.0" - api-platform: "~2.6.0" - - steps: - - - uses: actions/checkout@v3 - - - - name: Get branch name - uses: tj-actions/branch-names@v6.2 - id: branch-name - - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - ini-values: date.timezone=Europe/Warsaw, opcache.enable=1, opcache.enable_cli=0, opcache.memory_consumption=512, opcache.max_accelerated_files=65407, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0 - extensions: intl, gd, opcache, mysql, pdo_mysql - tools: symfony, composer-require-checker - coverage: none - - - - 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.18.5" - composer config extra.symfony.require "${{ matrix.symfony }}" - - - - name: Restrict API Platform version for global composer - if: matrix.api-platform != '^2.7' - run: composer require "api-platform/core:${{ matrix.api-platform }}" --no-update --no-scripts --no-interaction - - - - name: Restrict API Platform version for ApiBundle - if: matrix.api-platform != '^2.7' - run: composer require "api-platform/core:${{ matrix.api-platform }}" --no-update --no-scripts --no-interaction - working-directory: "src/Sylius/Bundle/ApiBundle" - - - - name: Get Composer cache directory - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - id: composer-cache - - - - name: Cache Composer - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- - - - - name: Cache composer.lock - uses: actions/cache@v3 - with: - path: composer.lock - key: ${{ steps.branch-name.outputs.base_ref_branch }}-${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-lock - restore-keys: | - ${{ steps.branch-name.outputs.base_ref_branch }}-${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-lock - - - name: Check existence of composer.lock - uses: andstor/file-existence-action@v2 - id: check-old-composer-lock-existence - with: - files: composer.lock - - - name: Move cached composer.lock (if exists) - run: mv composer.lock old-composer.lock - if: steps.check-old-composer-lock-existence.outputs.files_exists == 'true' - - - - name: Install PHP dependencies - run: composer update --no-interaction --no-scripts - id: end-of-setup - - - - name: Validate composer.json - run: composer validate --strict --no-check-version - if: always() && steps.end-of-setup.outcome == 'success' - - - - name: Check for security vulnerabilities - run: symfony security:check - if: always() && steps.end-of-setup.outcome == 'success' - - - - name: Validate Twig templates - run: bin/console lint:twig src - if: always() && steps.end-of-setup.outcome == 'success' - - - - name: Validate Container - run: bin/console lint:container - if: always() && steps.end-of-setup.outcome == 'success' - - - - name: Validate Yaml files - run: bin/console lint:yaml src - if: always() && steps.end-of-setup.outcome == 'success' - - - - name: Validate Package versions - run: vendor/bin/monorepo-builder validate - if: always() && steps.end-of-setup.outcome == 'success' - - - - name: Run Psalm - run: vendor/bin/psalm --show-info=false --output-format=github --php-version=${{ matrix.php }} - if: always() && steps.end-of-setup.outcome == 'success' - - - - name: Run PHPStan - run: vendor/bin/phpstan analyse - if: always() && steps.end-of-setup.outcome == 'success' - - - - name: Run ComposerRequireChecker - run: | - (cat composer.json | jq '.["autoload-dev"]["psr-4"] |= . + {"Sylius\\Behat\\": "src/Sylius/Behat/"}' | jq 'del(.autoload["psr-4"]["Sylius\\Behat\\"])') > _composer.json - mv _composer.json composer.json - composer dump-autoload - composer-require-checker check --config-file=composer-require-checker.json - if: always() && steps.end-of-setup.outcome == 'success' - - architecture-tests: - runs-on: ubuntu-latest - - name: "Architecture tests (PHPArkitect)" - - timeout-minutes: 10 - - strategy: - fail-fast: false - matrix: - php: ["8.0", "8.1"] - - steps: - - - uses: actions/checkout@v3 - - - - name: Run PHPArkitect - uses: docker://phparkitect/arkitect-github-actions - env: - PHP_VERSION: "${{ matrix.php }}" - with: - args: check - if: always() && steps.end-of-setup.outcome == 'success' - - classes-specifications: - runs-on: ubuntu-latest - - name: "Classes specifications (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, API Platform ${{ matrix.api-platform }})" - strategy: - fail-fast: false - matrix: - php: ["8.0", "8.1"] - symfony: ["^5.4", "^6.0"] - api-platform: ["^2.7"] - - include: - - - php: "8.1" - symfony: "~6.0.0" - api-platform: "^2.7" - - - php: "8.1" - symfony: "^5.4" - api-platform: "~2.6.0" - - steps: - - uses: actions/checkout@v3 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - ini-values: date.timezone=Europe/Warsaw, opcache.enable=1, opcache.enable_cli=0, opcache.memory_consumption=512, opcache.max_accelerated_files=65407, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0 - extensions: intl, gd, opcache, mysql, pdo_mysql - tools: symfony - coverage: none - - - 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.18.5" - composer config extra.symfony.require "${{ matrix.symfony }}" - - - - name: Restrict API Platform version - if: matrix.api-platform != '' - run: composer require "api-platform/core:${{ matrix.api-platform }}" --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: Cache Composer - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- - - name: Install PHP dependencies - run: composer update --no-interaction --no-scripts - id: end-of-setup - - - name: Run PHPSpec - run: vendor/bin/phpspec run --ansi --no-interaction -f dot - - test-application-without-frontend-postgres: - runs-on: ubuntu-latest - - name: "Test non-JS application (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, PostgreSQL ${{ matrix.postgres }})" - strategy: - matrix: - php: ["8.0"] - symfony: ["^5.4", "^6.0"] - postgres: ["13.9", "14.6"] - node: ["16.x"] - - env: - APP_ENV: test_cached - DATABASE_URL: "pgsql://postgres:postgres@127.0.0.1/sylius?charset=utf8&serverVersion=${{ matrix.postgres }}" - - steps: - - - uses: actions/checkout@v3 - - - name: Shutdown default MySQL - run: sudo service mysql stop - - - uses: harmon758/postgresql-action@v1 - with: - postgresql version: "${{ matrix.postgres }}" - postgresql password: "postgres" - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - ini-values: date.timezone=Europe/Warsaw, opcache.enable=1, opcache.enable_cli=0, opcache.memory_consumption=256, opcache.max_accelerated_files=32531, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0 - extensions: intl, gd, opcache, pgsql, pdo_pgsql - tools: symfony - coverage: none - - - - 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.18.5" - composer config extra.symfony.require "${{ matrix.symfony }}" - - - - name: Get Composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - - name: Cache Composer - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- - - - - name: Install PHP dependencies - run: composer update --no-interaction --no-scripts - - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: "${{ matrix.node }}" - - - - name: Get Yarn cache directory - id: yarn-cache - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - - name: Cache Yarn - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache.outputs.dir }} - 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: yarn install - - - - name: Validate Yarn packages - run: yarn check - - - - name: Build assets - run: | - bin/console assets:install public -vvv - yarn encore production - - - - name: Dump the environment - run: | - echo "DATABASE_URL=$DATABASE_URL" >> .env.$APP_ENV - composer dump-env $APP_ENV - - - - name: Warmup cache - run: bin/console cache:warmup - - - - name: Make filesystem readonly - run: chmod -R 555 app bin config docs features src templates tests translations vendor - - - - name: Prepare application database - run: | - APP_DEBUG=1 bin/console doctrine:database:create -vvv - bin/console doctrine:schema:up --force -vvv - bin/console doctrine:schema:validate - bin/console doctrine:migrations:sync-metadata-storage - - - - name: Test installer - run: bin/console sylius:install --no-interaction -vvv - - - - name: Load fixtures - run: bin/console sylius:fixtures:load default --no-interaction - - - - name: Run PHPUnit - run: vendor/bin/phpunit --colors=always - - - - name: Run CLI Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --rerun - - - - name: Run non-JS Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli&&~@no-postgres" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli&&~@no-postgres" --rerun - - - - name: Upload Behat logs - uses: actions/upload-artifact@v2 - if: failure() - with: - name: "Behat logs (non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }})" - path: etc/build/ - if-no-files-found: ignore - - test-application-without-frontend-mariadb: - runs-on: ubuntu-latest - - name: "Test non-JS application (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MariaDB ${{ matrix.mariadb }}, DBAL ${{ matrix.dbal }}.x)" - strategy: - matrix: - php: ["8.0"] - symfony: ["^5.4", "^6.0"] - mariadb: ["10.4.10"] - dbal: ["2", "3"] - node: ["16.x"] - - env: - APP_ENV: test_cached - DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=mariadb-${{ matrix.mariadb }}" - - steps: - - - uses: actions/checkout@v3 - - - name: Shutdown default MySQL - run: sudo service mysql stop - - - uses: getong/mariadb-action@v1.1 - with: - mariadb version: "${{ matrix.mariadb }}" - mysql root password: root - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - ini-values: date.timezone=Europe/Warsaw, opcache.enable=1, opcache.enable_cli=0, opcache.memory_consumption=256, opcache.max_accelerated_files=32531, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0 - extensions: intl, gd, opcache, mysql, pdo_mysql - tools: symfony - coverage: none - - - - 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.18.5" - composer config extra.symfony.require "${{ matrix.symfony }}" - - - - name: Restrict doctrine/dbal version - if: matrix.dbal == '2' - run: | - composer require "doctrine/dbal:^2.0" --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: Cache Composer - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- - - - - name: Install PHP dependencies - run: composer update --no-interaction --no-scripts - - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: "${{ matrix.node }}" - - - - name: Get Yarn cache directory - id: yarn-cache - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - - name: Cache Yarn - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache.outputs.dir }} - 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: yarn install - - - - name: Validate Yarn packages - run: yarn check - - - - name: Build assets - run: | - bin/console assets:install public -vvv - yarn encore production - - - - name: Dump the environment - run: | - echo "DATABASE_URL=$DATABASE_URL" >> .env.$APP_ENV - composer dump-env $APP_ENV - - - - name: Warmup cache - run: bin/console cache:warmup - - - - name: Make filesystem readonly - run: chmod -R 555 app bin config docs features src templates tests translations vendor - - - - name: Prepare application database - run: | - APP_DEBUG=1 bin/console doctrine:database:create -vvv - bin/console doctrine:migrations:migrate -n -vvv - - - - name: Test provided migrations - run: | - bin/console doctrine:migrations:migrate first --no-interaction - bin/console doctrine:migrations:migrate latest --no-interaction - - - - name: Validate Database Schema - run: bin/console doctrine:schema:validate -vvv - - - - name: Test installer - run: bin/console sylius:install --no-interaction -vvv - - - - name: Load fixtures - run: bin/console sylius:fixtures:load default --no-interaction - - - - name: Run PHPUnit - run: vendor/bin/phpunit --colors=always - - - - name: Run CLI Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --rerun - - - - name: Run non-JS Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" --rerun - - - - name: Upload Behat logs - uses: actions/upload-artifact@v3 - if: failure() - with: - name: "Behat logs (non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }})" - path: etc/build/ - if-no-files-found: ignore - continue-on-error: true - - test-application-without-frontend-mysql: - runs-on: ubuntu-latest - - name: "Test non-JS application (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}), Twig ${{ matrix.twig }}, DBAL ${{ matrix.dbal }}.x), API Platform ${{ matrix.api-platform }})" - - timeout-minutes: 35 - - strategy: - fail-fast: false - matrix: - php: ["8.0", "8.1"] - symfony: ["^5.4", "^6.0"] - api-platform: ["^2.7"] - mysql: ["5.7", "8.0"] - twig: ["3.x"] - dbal: ["3"] - node: ["16.x"] - include: - - - php: "8.0" - symfony: "^5.4" - api-platform: "^2.7" - twig: "2.x" - mysql: "5.7" - dbal: "3" - - - php: "8.0" - symfony: "^5.4" - api-platform: "^2.7" - twig: "2.x" - mysql: "5.7" - dbal: "2" - - - - php: "8.1" - symfony: "^5.4" - api-platform: "~2.6.0" - twig: "3.x" - mysql: "8.0" - dbal: "3" - - - - php: "8.1" - symfony: "^6.0" - api-platform: "~2.6.0" - twig: "3.x" - mysql: "8.0" - dbal: "3" - - - - php: "8.1" - symfony: "~6.0.0" - api-platform: "^2.7" - twig: "3.x" - mysql: "8.0" - dbal: "3" - - env: - APP_ENV: test_cached - DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}" - - steps: - - - uses: actions/checkout@v3 - - - - name: Shutdown default MySQL - run: sudo service mysql stop - - - - name: Setup MySQL - uses: mirromutth/mysql-action@v1.1 - with: - mysql version: "${{ matrix.mysql }}" - mysql root password: "root" - - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - ini-values: date.timezone=Europe/Warsaw, opcache.enable=1, opcache.enable_cli=0, opcache.memory_consumption=512, opcache.max_accelerated_files=65407, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0 - extensions: intl, gd, opcache, mysql, pdo_mysql - tools: symfony - coverage: none - - - - 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.18.5" - composer config extra.symfony.require "${{ matrix.symfony }}" - - - - name: Restrict doctrine/dbal version - if: matrix.dbal == '2' - run: | - composer require "doctrine/dbal:^2.0" --no-update --no-scripts --no-interaction - - - - name: Restrict API Platform version - if: matrix.api-platform != '' - run: composer require "api-platform/core:${{ matrix.api-platform }}" --no-update --no-scripts --no-interaction - - - - name: Restrict Twig version - if: matrix.twig != '' - run: | - composer require "twig/twig:${{ matrix.twig }}" --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: Cache Composer - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- - - - - name: Install PHP dependencies - run: composer update --no-interaction --no-scripts - - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: "${{ matrix.node }}" - - - - name: Get Yarn cache directory - id: yarn-cache - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - - name: Cache Yarn - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache.outputs.dir }} - 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: yarn install - - - - name: Validate Yarn packages - run: yarn check - - - - name: Build assets - run: | - bin/console assets:install public -vvv - yarn encore production - - - - name: Dump the environment - run: | - echo "DATABASE_URL=$DATABASE_URL" >> .env.$APP_ENV - composer dump-env $APP_ENV - - - - name: Warmup cache - run: bin/console cache:warmup - - - - name: Make filesystem readonly - run: chmod -R 555 app bin config docs features src templates tests translations vendor - - - - name: Prepare application database - run: | - APP_DEBUG=1 bin/console doctrine:database:create -vvv - bin/console doctrine:migrations:migrate -n -vvv - - - - name: Test provided migrations - run: | - bin/console doctrine:migrations:migrate first --no-interaction - bin/console doctrine:migrations:migrate latest --no-interaction - - - - name: Validate Database Schema - run: bin/console doctrine:schema:validate -vvv - - - - name: Test installer - run: bin/console sylius:install --no-interaction -vvv - - - - name: Load fixtures - run: bin/console sylius:fixtures:load default --no-interaction - - - - name: Run PHPUnit - run: | - bin/console cache:pool:clear cache.global_clearer - vendor/bin/phpunit - - - - name: Run CLI Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --rerun - - - - name: Run non-JS Behat - run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" --rerun - - - - name: Upload Behat logs - uses: actions/upload-artifact@v3 - if: failure() - with: - name: "Behat logs (non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }})" - path: etc/build/ - if-no-files-found: ignore - - test-application-with-frontend: - runs-on: ubuntu-latest - - name: "Test JS application (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}, Node ${{ matrix.node }})" - - timeout-minutes: 25 - - strategy: - fail-fast: false - matrix: - php: ["8.0", "8.1"] - symfony: ["^5.4", "^6.0"] - node: ["16.x", "18.x"] - mysql: ["5.7", "8.0"] - - include: - - - php: "8.1" - symfony: "~6.0.0" - node: "18.x" - mysql: "8.0" - - env: - APP_ENV: test_cached - DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}" - - steps: - - - uses: actions/checkout@v3 - - - - name: Shutdown default MySQL - run: sudo service mysql stop - - - - name: Setup MySQL - uses: mirromutth/mysql-action@v1.1 - with: - mysql version: "${{ matrix.mysql }}" - mysql root password: "root" - - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - ini-values: date.timezone=Europe/Warsaw, opcache.enable=1, opcache.enable_cli=0, opcache.memory_consumption=512, opcache.max_accelerated_files=65407, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0 - extensions: intl, gd, opcache, mysql, pdo_mysql - tools: symfony - coverage: none - - - - 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.18.5" - composer config extra.symfony.require "${{ matrix.symfony }}" - - - - 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 --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' https://127.0.0.1 > /dev/null 2>&1 & - - - - name: Get Composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - - name: Cache Composer - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- - - - - name: Install PHP dependencies - run: composer update --no-interaction --no-scripts - - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: "${{ matrix.node }}" - - - - name: Get Yarn cache directory - id: yarn-cache - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - - name: Cache Yarn - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache.outputs.dir }} - 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: yarn install - - - - name: Validate Yarn packages - run: yarn check - - - - name: Dump the environment - run: | - echo "DATABASE_URL=$DATABASE_URL" >> .env.$APP_ENV - composer dump-env $APP_ENV - - - - name: Warmup cache - run: bin/console cache:warmup - - - - name: Run webserver - run: symfony server:start --port=8080 --dir=public --daemon - - - - name: Prepare application database - run: | - APP_DEBUG=1 bin/console doctrine:database:create -vvv - bin/console doctrine:migrations:migrate -n -vvv - - - - name: Validate Database Schema - run: bin/console doctrine:schema:validate -vvv - - - - name: Build assets - run: | - bin/console assets:install public -vvv - yarn encore production - - - - name: Make filesystem readonly - run: chmod -R 555 app bin config docs features src templates tests translations vendor - - - - name: Run JS Behat - run: | - bin/console cache:pool:clear cache.global_clearer - vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" || vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@javascript&&~@todo&&~@cli" --rerun - - - - name: Upload Behat logs - uses: actions/upload-artifact@v3 - if: failure() - with: - name: "Behat logs (JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }})" - path: etc/build/ - if-no-files-found: ignore - - test-application-without-frontend-unstable-symfony: - runs-on: ubuntu-latest - - name: "Test non-JS application with the unstable Symfony version" - - timeout-minutes: 35 - - strategy: - fail-fast: false - matrix: - php: [ "8.1" ] - symfony: [ "^6.2" ] - api-platform: [ "^2.7" ] - mysql: [ "8.0" ] - twig: [ "3.x" ] - dbal: [ "3" ] - node: [ "16.x" ] - - env: - APP_ENV: test_cached - DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}" - - steps: - - uses: actions/checkout@v3 - - - name: Shutdown default MySQL - run: sudo service mysql stop - - - name: Setup MySQL - uses: mirromutth/mysql-action@v1.1 - with: - mysql version: "${{ matrix.mysql }}" - mysql root password: "root" - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - ini-values: date.timezone=Europe/Warsaw, opcache.enable=1, opcache.enable_cli=0, opcache.memory_consumption=512, opcache.max_accelerated_files=65407, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0 - extensions: intl, gd, opcache, mysql, pdo_mysql - tools: symfony - coverage: none - - - 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.18.5" - composer config minimum-stability beta - composer config extra.symfony.require "${{ matrix.symfony }}" - - - name: Get Composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache Composer - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- - - - name: Install PHP dependencies - run: composer update --no-interaction --no-scripts - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: "${{ matrix.node }}" - - - name: Get Yarn cache directory - id: yarn-cache - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - name: Cache Yarn - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache.outputs.dir }} - 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: yarn install - - - name: Validate Yarn packages - run: yarn check - - - name: Build assets - run: | - bin/console assets:install public -vvv - yarn encore production - - - name: Dump the environment - run: | - echo "DATABASE_URL=$DATABASE_URL" >> .env.$APP_ENV - composer dump-env $APP_ENV - - - name: Warmup cache - run: bin/console cache:warmup - - - name: Make filesystem readonly - run: chmod -R 555 app bin config docs features src templates tests translations vendor - - - name: Prepare application database - run: | - APP_DEBUG=1 bin/console doctrine:database:create -vvv - bin/console doctrine:migrations:migrate -n -vvv - - - name: Test provided migrations - run: | - bin/console doctrine:migrations:migrate first --no-interaction - bin/console doctrine:migrations:migrate latest --no-interaction - - - name: Validate Database Schema - run: bin/console doctrine:schema:validate -vvv - - - name: Run PHPUnit - run: | - bin/console cache:pool:clear cache.global_clearer - vendor/bin/phpunit - - - name: Run non-JS Behat - run: | - vendor/bin/behat features/account/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/addressing/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/admin/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/channel/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/checkout/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/contact/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/currency/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/customer/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/homepage/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/inventory/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/locale/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/order/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/payment/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/product/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/promotion/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/shipping/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/taxation/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/taxonomy/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - vendor/bin/behat features/user/ --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli" - continue-on-error: true - - - name: Upload Behat logs - uses: actions/upload-artifact@v2 - if: failure() - with: - name: "Behat logs (non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }})" - path: etc/build/ - if-no-files-found: ignore - - test-gulp-build: - runs-on: ubuntu-latest - - name: "Test Gulp build (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}, Node ${{ matrix.node }})" - - timeout-minutes: 25 - - strategy: - fail-fast: false - matrix: - php: ["8.0", "8.1"] - symfony: ["^5.4"] - node: ["16.x", "18.x"] - mysql: [ "5.7", "8.0" ] - - env: - APP_ENV: test_cached - DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" - - steps: - - - uses: actions/checkout@v3 - - - - name: Shutdown default MySQL - run: sudo service mysql stop - - - - name: Setup MySQL - uses: mirromutth/mysql-action@v1.1 - with: - mysql version: "${{ matrix.mysql }}" - mysql root password: "root" - - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - ini-values: date.timezone=Europe/Warsaw, opcache.enable=1, opcache.enable_cli=0, opcache.memory_consumption=512, opcache.max_accelerated_files=65407, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0 - extensions: intl, gd, opcache, mysql, pdo_mysql - tools: symfony - coverage: none - - - - 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.18.5" - composer config extra.symfony.require "${{ matrix.symfony }}" - - - - name: Get Composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - - name: Cache Composer - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer- - - - - name: Install PHP dependencies - run: composer update --no-interaction --no-scripts - - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: "${{ matrix.node }}" - - - - name: Get Yarn cache directory - id: yarn-cache - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - - name: Cache Yarn - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache.outputs.dir }} - 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: yarn install - - - - name: Build assets - run: | - bin/console assets:install public -vvv - yarn run encore production - - notify-about-build-failure: - runs-on: ubuntu-latest - - if: failure() && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') - - needs: [static-checks, test-application-without-frontend-mysql, test-application-without-frontend-postgres, test-application-without-frontend-mariadb, test-application-with-frontend] - - name: "Notify about build failure" - - timeout-minutes: 5 - - steps: - - - name: "Process data" - id: process-data - shell: bash - run: | - echo "branch=$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" >> $GITHUB_OUTPUT - echo "sha=$(echo ${{ github.sha }} | cut -c 1-12)" >> $GITHUB_OUTPUT - - - - name: "Notify on Slack" - uses: edge/simple-slack-notify@master - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - if: env.SLACK_WEBHOOK_URL != null - with: - channel: "#builds" - username: "GitHub Actions" - text: | - ** - - ${{ needs.static-checks.result == 'success' && ':+1:' || ':x:' }} Static checks - ${{ needs.test-application-without-frontend.result == 'success' && ':+1:' || ':x:' }} Test non-JS application - ${{ needs.test-application-with-frontend.result == 'success' && ':+1:' || ':x:' }} Test JS application - - _ _ _ _ _ _ _ - color: "danger" - fields: | - [ - { "title": "Repository", "value": "", "short": true }, - { "title": "Action", "value": "", "short": true }, - { "title": "Reference", "value": "", "short": true }, - { "title": "Commit", "value": "", "short": true }, - { "title": "Event", "value": "${{ github.event_name }}", "short": true } - ] diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000000..653a1c5da7b --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,84 @@ +name: Continuous Integration + +on: + pull_request: + paths-ignore: + - "adr/**" + - "docs/**" + - "*.md" + schedule: + - + cron: "0 1 * * 6" # Run at 1am every Saturday + workflow_dispatch: ~ + push: ~ + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + static-checks: + name: Static checks + uses: ./.github/workflows/ci_static-checks.yml + e2e-mariadb: + name: End-to-end tests (MariaDB) + needs: static-checks + uses: ./.github/workflows/ci_e2e-mariadb.yml + e2e-mysql: + name: End-to-end tests (MySQL) + needs: static-checks + uses: ./.github/workflows/ci_e2e-mysql.yml + e2e-pgsql: + name: End-to-end tests (PostgreSQL) + needs: static-checks + uses: ./.github/workflows/ci_e2e-pgsql.yml + e2e-customs: + name: End-to-end tests (Customs) + needs: static-checks + uses: ./.github/workflows/ci_e2e-customs.yml + packages: + name: Packages + needs: static-checks + uses: ./.github/workflows/ci_packages.yml + notify-about-build-failure: + name: "Notify about build failure" + needs: [static-checks, e2e-mariadb, e2e-mysql, e2e-pgsql, e2e-customs] + if: failure() && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - name: "Process data" + id: process-data + shell: bash + run: | + echo "branch=$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" >> $GITHUB_OUTPUT + echo "sha=$(echo ${{ github.sha }} | cut -c 1-12)" >> $GITHUB_OUTPUT + + - name: "Notify on Slack" + uses: edge/simple-slack-notify@master + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: env.SLACK_WEBHOOK_URL != null + with: + channel: "#builds" + username: "GitHub Actions" + text: | + ** + + ${{ needs.static-checks.result == 'success' && ':+1:' || ':x:' }} Static Checks + ${{ needs.e2e-mariadb.result == 'success' && ':+1:' || ':x:' }} End-to-End (MariaDB) + ${{ needs.e2e-mysql.result == 'success' && ':+1:' || ':x:' }} End-to-End (MySQL) + ${{ needs.e2e-pgsql.result == 'success' && ':+1:' || ':x:' }} End-to-End (PostgreSQL) + ${{ needs.e2e-customs.result == 'success' && ':+1:' || ':x:' }} End-to-End (Customs) + + _ _ _ _ _ _ _ + color: "danger" + fields: | + [ + { "title": "Repository", "value": "", "short": true }, + { "title": "Action", "value": "", "short": true }, + { "title": "Reference", "value": "", "short": true }, + { "title": "Commit", "value": "", "short": true }, + { "title": "Event", "value": "${{ github.event_name }}", "short": true } + ] diff --git a/.github/workflows/ci_e2e-customs.yml b/.github/workflows/ci_e2e-customs.yml new file mode 100644 index 00000000000..bb1d17ec9f4 --- /dev/null +++ b/.github/workflows/ci_e2e-customs.yml @@ -0,0 +1,64 @@ +name: End-to-End (Customs) + +on: + workflow_dispatch: ~ + workflow_call: ~ + +jobs: + behat-no-js-unstable-symfony: + runs-on: ubuntu-latest + name: "Test Application without JS (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }} [Unstable], MySQL ${{ matrix.mysql }}, Twig ${{ matrix.twig }}, DBAL ${{ matrix.dbal }}.x, API Platform ${{ matrix.api-platform }})" + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + php: [ "8.1" ] + symfony: [ "^6.2" ] + mysql: [ "8.0" ] + + env: + APP_ENV: test_cached + DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}" + + steps: + - + uses: actions/checkout@v3 + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: "Restore dependencies" + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + restore-keys: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + + - name: Change minimum-stability to beta + run: composer config minimum-stability beta + + - name: Build application + uses: jakubtobiasz/SyliusBuildTestAppAction@v2.0 + with: + build_type: "sylius" + cache_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + cache_restore_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + e2e: "yes" + database_version: ${{ matrix.mysql }} + php_version: ${{ matrix.php }} + symfony_version: ${{ matrix.symfony }} + + - name: Run PHPUnit + run: vendor/bin/phpunit --colors=always + + - name: Run non-JS Behat + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli&&~@no-postgres" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli&&~@no-postgres" --rerun + + - name: Upload Behat logs + uses: actions/upload-artifact@v3 + if: failure() + with: + name: "Behat logs (non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}) [Unstable], MySQL ${{ matrix.mysql }})" + path: etc/build/ + if-no-files-found: ignore diff --git a/.github/workflows/ci_e2e-mariadb.yml b/.github/workflows/ci_e2e-mariadb.yml new file mode 100644 index 00000000000..7535150eb8a --- /dev/null +++ b/.github/workflows/ci_e2e-mariadb.yml @@ -0,0 +1,70 @@ +name: End-to-End (MariaDB) + +on: + workflow_dispatch: ~ + workflow_call: ~ + +jobs: + behat-no-js: + runs-on: ubuntu-latest + name: "Test Application without JS (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}), Twig ${{ matrix.twig }}, DBAL ${{ matrix.dbal }}.x, API Platform ${{ matrix.api-platform }})" + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + php: ["8.0"] + symfony: ["^5.4", "^6.0"] + mariadb: ["10.4.10"] + dbal: ["^2.7", "^3.0"] + + env: + APP_ENV: test_cached + DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=mariadb-${{ matrix.mariadb }}" + + steps: + - + uses: actions/checkout@v3 + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: "Restore dependencies" + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + restore-keys: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + + - name: Restrict packages + if: matrix.dbal == '^2.7' + run: composer require --no-update --no-scripts --no-interaction "doctrine/dbal:${{ matrix.dbal }}" + + - name: Build application + uses: jakubtobiasz/SyliusBuildTestAppAction@v2.0 + with: + build_type: "sylius" + cache_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + cache_restore_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + e2e: "yes" + database: "mariadb" + database_version: ${{ matrix.mariadb }} + php_version: ${{ matrix.php }} + symfony_version: ${{ matrix.symfony }} + + - name: Run PHPUnit + run: vendor/bin/phpunit --colors=always + + - name: Run CLI Behat + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --rerun + + - name: Run non-JS Behat + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli&&~@no-postgres" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli&&~@no-postgres" --rerun + + - name: Upload Behat logs + uses: actions/upload-artifact@v3 + if: failure() + with: + name: "Behat logs (non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MariaDB ${{ matrix.mariadb }}), DBAL ${{ matrix.dbal }}" + path: etc/build/ + if-no-files-found: ignore diff --git a/.github/workflows/ci_e2e-mysql.yml b/.github/workflows/ci_e2e-mysql.yml new file mode 100644 index 00000000000..b0c16a41264 --- /dev/null +++ b/.github/workflows/ci_e2e-mysql.yml @@ -0,0 +1,194 @@ +name: End-to-End (MySQL) + +on: + workflow_dispatch: ~ + workflow_call: ~ + +jobs: + behat-no-js: + runs-on: ubuntu-latest + name: "Test Application without JS (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}, Twig ${{ matrix.twig }}, DBAL ${{ matrix.dbal }}.x, API Platform ${{ matrix.api-platform }})" + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + php: [ "8.0", "8.1" ] + symfony: [ "^5.4", "^6.0" ] + api-platform: [ "^2.7" ] + mysql: [ "5.7", "8.0" ] + twig: [ "^3.3" ] + dbal: [ "^3.0" ] + include: + - php: "8.0" + symfony: "^5.4" + api-platform: "^2.7" + twig: "^2.12" + mysql: "5.7" + dbal: "^3.0" + - php: "8.0" + symfony: "^5.4" + api-platform: "^2.7" + twig: "^2.12" + mysql: "5.7" + dbal: "^2.7" + - php: "8.1" + symfony: "^5.4" + api-platform: "~2.6.0" + twig: "^3.3" + mysql: "8.0" + dbal: "^3.0" + - php: "8.1" + symfony: "^6.0" + api-platform: "~2.6.0" + twig: "^3.3" + mysql: "8.0" + dbal: "^3.0" + + env: + APP_ENV: test_cached + DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}" + + steps: + - + uses: actions/checkout@v3 + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: "Restore dependencies" + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-api-platform-${{ matrix.api-platform }}" + restore-keys: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-api-platform-${{ matrix.api-platform }}" + + - name: Restrict Twig + if: matrix.twig == '^2.12' + run: composer require --no-update --no-scripts --no-interaction "twig/twig:${{ matrix.twig }}" + + - name: Restrict DBAL + if: matrix.dbal == '^2.7' + run: composer require --no-update --no-scripts --no-interaction "doctrine/dbal:${{ matrix.dbal }}" + + - name: Build application + uses: jakubtobiasz/SyliusBuildTestAppAction@v2.0 + with: + build_type: "sylius" + cache_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-api-platform-${{ matrix.api-platform }}" + cache_restore_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-api-platform-${{ matrix.api-platform }}" + e2e: "yes" + database_version: ${{ matrix.mysql }} + php_version: ${{ matrix.php }} + symfony_version: ${{ matrix.symfony }} + + - name: Test installer + run: bin/console sylius:install --no-interaction -vvv + + - name: Run PHPUnit + run: vendor/bin/phpunit --colors=always + + - name: Run CLI Behat + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --rerun + + - name: Run non-JS Behat + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli&&~@no-postgres" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli&&~@no-postgres" --rerun + + - name: Upload Behat logs + uses: actions/upload-artifact@v3 + if: failure() + with: + name: "Behat logs (non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}), ApiPlatform ${{ matrix.api-platform }}, Twig ${{ matrix.twig }}, MySQL ${{ matrix.mysql }}, DBAL ${{ matrix.dbal }}" + path: etc/build/ + if-no-files-found: ignore + + behat-ui-js: + runs-on: ubuntu-latest + name: "Test UI Application with JS (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}, Twig ${{ matrix.twig }}, DBAL ${{ matrix.dbal }}.x, API Platform ${{ matrix.api-platform }})" + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + php: [ "8.0", "8.1" ] + symfony: [ "^5.4", "^6.0" ] + api-platform: [ "^2.7" ] + mysql: [ "5.7", "8.0" ] + twig: [ "3.x" ] + dbal: [ "3" ] + include: + - php: "8.0" + symfony: "^5.4" + api-platform: "^2.7" + twig: "2.x" + mysql: "5.7" + dbal: "3" + - php: "8.0" + symfony: "^5.4" + api-platform: "^2.7" + twig: "2.x" + mysql: "5.7" + dbal: "2" + + - php: "8.1" + symfony: "^5.4" + api-platform: "~2.6.0" + twig: "3.x" + mysql: "8.0" + dbal: "3" + + - php: "8.1" + symfony: "^6.0" + api-platform: "~2.6.0" + twig: "3.x" + mysql: "8.0" + dbal: "3" + + env: + APP_ENV: test_cached + DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}" + + steps: + - + uses: actions/checkout@v3 + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: "Restore dependencies" + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-api-platform-${{ matrix.api-platform }}" + restore-keys: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-api-platform-${{ matrix.api-platform }}" + + - name: Restrict Twig + if: matrix.twig == '^2.12' + run: composer require --no-update --no-scripts --no-interaction "twig/twig:${{ matrix.twig }}" + + - name: Restrict DBAL + if: matrix.dbal == '^2.7' + run: composer require --no-update --no-scripts --no-interaction "doctrine/dbal:${{ matrix.dbal }}" + + - name: Build application + uses: jakubtobiasz/SyliusBuildTestAppAction@v2.0 + with: + build_type: "sylius" + cache_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-api-platform-${{ matrix.api-platform }}" + cache_restore_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-api-platform-${{ matrix.api-platform }}" + e2e: "yes" + e2e_js: "yes" + database_version: ${{ matrix.mysql }} + php_version: ${{ matrix.php }} + symfony_version: ${{ matrix.symfony }} + + - name: Run Behat + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli&&~@api" ||vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@todo&&~@cli&&~@api" --rerun + + - name: Upload Behat logs + uses: actions/upload-artifact@v3 + if: failure() + with: + name: "Behat logs (JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, ApiPlatform ${{ matrix.api-platform }}, Twig ${{ matrix.twig }}, MySQL ${{ matrix.mysql }}, DBAL ${{ matrix.dbal }})" + path: etc/build/ + if-no-files-found: ignore diff --git a/.github/workflows/ci_e2e-pgsql.yml b/.github/workflows/ci_e2e-pgsql.yml new file mode 100644 index 00000000000..cb5d44bad2d --- /dev/null +++ b/.github/workflows/ci_e2e-pgsql.yml @@ -0,0 +1,65 @@ +name: End-to-End (PostgreSQL) + +on: + workflow_dispatch: ~ + workflow_call: ~ + +jobs: + behat-no-js: + runs-on: ubuntu-latest + name: "Test Application without JS (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}), Twig ${{ matrix.twig }}, DBAL ${{ matrix.dbal }}.x, API Platform ${{ matrix.api-platform }})" + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + php: ["8.0"] + symfony: ["^5.4", "^6.0"] + postgres: ["13.9", "14.6"] + + env: + APP_ENV: test_cached + DATABASE_URL: "pgsql://postgres:postgres@127.0.0.1/sylius?charset=utf8&serverVersion=${{ matrix.postgres }}" + + steps: + - + uses: actions/checkout@v3 + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: "Restore dependencies" + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + restore-keys: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + + - name: Build application + uses: jakubtobiasz/SyliusBuildTestAppAction@v2.0 + with: + build_type: "sylius" + cache_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + cache_restore_key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-" + e2e: "yes" + database: "postgresql" + database_version: ${{ matrix.postgres }} + php_version: ${{ matrix.php }} + symfony_version: ${{ matrix.symfony }} + + - name: Run PHPUnit + run: vendor/bin/phpunit --colors=always + + - name: Run CLI Behat + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="@cli&&~@todo" --rerun + + - name: Run non-JS Behat + run: vendor/bin/behat --colors --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli&&~@no-postgres" || vendor/bin/behat --strict --no-interaction -vvv -f progress --tags="~@javascript&&~@todo&&~@cli&&~@no-postgres" --rerun + + - name: Upload Behat logs + uses: actions/upload-artifact@v3 + if: failure() + with: + name: "Behat logs (non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, PostgreSQL ${{ matrix.postgres }})" + path: etc/build/ + if-no-files-found: ignore diff --git a/.github/workflows/ci_packages.yml b/.github/workflows/ci_packages.yml new file mode 100644 index 00000000000..48969393a0c --- /dev/null +++ b/.github/workflows/ci_packages.yml @@ -0,0 +1,146 @@ +name: Packages + +on: + workflow_dispatch: ~ + workflow_call: ~ + +jobs: + test: + runs-on: ubuntu-latest + name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" + timeout-minutes: 25 + + strategy: + fail-fast: false + matrix: + php: ["8.0", "8.1"] + symfony: ["^5.4", "^6.0"] + + env: + COMPOSER_ROOT_VERSION: "dev-master" + SYMFONY_VERSION: "${{ matrix.symfony }}" + + steps: + - + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + coverage: none + + - 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.18.5" + composer config extra.symfony.require "${{ matrix.symfony }}" + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache Composer + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-" + restore-keys: | + "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-" + + - name: Install dependencies + run: composer update --no-interaction --no-scripts + + - name: "Run pipeline" + run: find src/Sylius -mindepth 3 -maxdepth 3 -type f -name composer.json -exec dirname '{}' \; | sed -e 's/src\/Sylius\///g' | sort | jq --raw-input . | jq --slurp . | jq -c . | xargs -0 vendor/bin/robo ci:packages + + test_with_swiftmailer: + runs-on: ubuntu-latest + name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, Swiftmailer" + timeout-minutes: 25 + + strategy: + fail-fast: false + matrix: + php: ["8.0", "8.1"] + symfony: ["^5.4"] + + env: + APP_ENV: "test_with_swiftmailer" + COMPOSER_ROOT_VERSION: "dev-master" + SYMFONY_VERSION: "${{ matrix.symfony }}" + USE_SWIFTMAILER: "yes" + PACKAGES: '["Bundle/CoreBundle", "Bundle/ApiBundle", "Bundle/AdminBundle"]' + + steps: + - + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + coverage: none + + - 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.18.5" + composer config extra.symfony.require "${{ matrix.symfony }}" + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache Composer + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-" + restore-keys: | + "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-" + + - name: Install dependencies + run: composer update --no-interaction --no-scripts + + - name: "Run pipeline" + run: vendor/bin/robo ci:packages '${{ env.PACKAGES }}' + + notify-about-build-failure: + needs: [test] + if: failure() && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') + runs-on: ubuntu-latest + name: "Notify about build failure" + timeout-minutes: 5 + + steps: + - name: "Process data" + id: process-data + shell: bash + run: | + echo "branch=$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" >> $GITHUB_OUTPUT + echo "sha=$(echo ${{ github.sha }} | cut -c 1-12)" >> $GITHUB_OUTPUT + + - name: "Notify on Slack" + uses: edge/simple-slack-notify@master + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: env.SLACK_WEBHOOK_URL != null + with: + channel: "#builds" + username: "GitHub Actions" + text: | + ** + + _ _ _ _ _ _ _ + color: "danger" + fields: | + [ + { "title": "Repository", "value": "", "short": true }, + { "title": "Action", "value": "", "short": true }, + { "title": "Reference", "value": "", "short": true }, + { "title": "Commit", "value": "", "short": true }, + { "title": "Event", "value": "${{ github.event_name }}", "short": true } + ] diff --git a/.github/workflows/ci_static-checks.yml b/.github/workflows/ci_static-checks.yml new file mode 100644 index 00000000000..00d0af25c8b --- /dev/null +++ b/.github/workflows/ci_static-checks.yml @@ -0,0 +1,95 @@ +name: Static Analysis + +on: + workflow_dispatch: ~ + workflow_call: ~ + +jobs: + static-checks: + runs-on: ubuntu-latest + name: "Static checks" + strategy: + fail-fast: false + matrix: + php: [ "8.0", "8.1" ] + symfony: [ "^5.4", "^6.0" ] + api-platform: [ "^2.7" ] + + include: + - php: "8.1" + symfony: "^6.0" + api-platform: "~2.6.0" + steps: + - + uses: actions/checkout@v3 + + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php }}" + ini-values: date.timezone=Europe/Warsaw, opcache.enable=1, opcache.enable_cli=0, opcache.memory_consumption=512, opcache.max_accelerated_files=65407, opcache.interned_strings_buffer=8, opcache.validate_timestamps=0, opcache.save_comments=1, opcache.fast_shutdown=0 + extensions: intl, gd, opcache, mysql, pdo_mysql + tools: symfony, composer-require-checker + coverage: none + + - name: "Restrict packages' versions" + run: | + composer global config --no-plugins allow-plugins.symfony/flex true + composer global require --no-progress --no-scripts --no-plugins "symfony/flex:1.18.5" + composer config extra.symfony.require "${{ matrix.symfony }}" + composer require "api-platform/core:${{ matrix.api-platform }}" --no-update --no-scripts --no-interaction + + - name: Restrict API Platform version for ApiBundle + run: composer require "api-platform/core:${{ matrix.api-platform }}" --no-update --no-scripts --no-interaction + working-directory: "src/Sylius/Bundle/ApiBundle" + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: "Setup cache" + uses: actions/cache@v3 + with: + path: | + ${{ steps.composer-cache.outputs.dir }} + key: ${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-api-platform-${{ matrix.api-platform }} + + - name: "Install dependencies" + run: composer update --no-interaction --no-scripts + + - name: "Validate composer.json" + run: composer validate --strict --no-check-version + + - name: "Check for security vulnerabilities" + run: symfony security:check + + - name: "Validate Twig templates" + run: bin/console lint:twig src + + - name: "Validate Container" + run: bin/console lint:container + + - name: Validate Yaml files + run: bin/console lint:yaml src + + - name: Validate Package versions + run: vendor/bin/monorepo-builder validate + + - name: Run PHPArkitect + run: vendor/bin/phparkitect check + + - name: Run Psalm + run: vendor/bin/psalm --show-info=false --output-format=github --php-version=${{ matrix.php }} + + - name: Run PHPStan + run: vendor/bin/phpstan analyse + + - name: Run PHPSpec + run: vendor/bin/phpspec run --ansi --no-interaction -f dot + + - name: Run ComposerRequireChecker + run: | + (cat composer.json | jq '.["autoload-dev"]["psr-4"] |= . + {"Sylius\\Behat\\": "src/Sylius/Behat/"}' | jq 'del(.autoload["psr-4"]["Sylius\\Behat\\"])') > _composer.json + mv _composer.json composer.json + composer dump-autoload + composer-require-checker check --config-file=composer-require-checker.json diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml deleted file mode 100644 index a6f91bef216..00000000000 --- a/.github/workflows/packages.yml +++ /dev/null @@ -1,230 +0,0 @@ -name: Packages - -on: - push: - branches-ignore: - - 'dependabot/**' - paths: - - "src/Sylius/Bundle/**" - - "src/Sylius/Component/**" - - ".github/workflows/packages.yml" - pull_request: - paths: - - "src/Sylius/Bundle/**" - - "src/Sylius/Component/**" - - ".github/workflows/packages.yml" - release: - types: [created] - schedule: - - - cron: "0 1 * * 6" # Run at 1am every Saturday - workflow_dispatch: ~ - -jobs: - list: - runs-on: ubuntu-latest - - name: "Create a list of packages" - - steps: - - - uses: actions/checkout@v3 - - - - name: "Provide the list" - id: create-list - run: echo "packages=$(find src/Sylius -mindepth 3 -maxdepth 3 -type f -name composer.json -exec dirname '{}' \; | sed -e 's/src\/Sylius\///g' | sort | jq --raw-input . | jq --slurp . | jq -c .)" >> $GITHUB_OUTPUT - - outputs: - packages: "${{ steps.create-list.outputs.packages }}" - - test: - needs: list - - runs-on: ubuntu-latest - - name: "${{ matrix.package }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" - - timeout-minutes: 10 - - strategy: - fail-fast: false - matrix: - php: ["8.0", "8.1"] - symfony: ["^5.4", "^6.0"] - package: "${{ fromJson(needs.list.outputs.packages) }}" - swiftmailer: [false] - include: - - - php: "8.0" - symfony: "^5.4" - package: "Bundle/CoreBundle" - swiftmailer: true - - - php: "8.1" - symfony: "^5.4" - package: "Bundle/CoreBundle" - swiftmailer: true - - - php: "8.1" - symfony: "^5.4" - package: "Bundle/ApiBundle" - swiftmailer: true - - - php: "8.1" - symfony: "^5.4" - package: "Bundle/AdminBundle" - swiftmailer: true - - steps: - - - uses: actions/checkout@v3 - - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: "${{ matrix.php }}" - coverage: none - - - - name: Get Composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - - name: Cache Composer - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php-${{ matrix.php }}-package-${{ matrix.package }}-composer-${{ hashFiles(format('src/Sylius/{0}/composer.json', matrix.package)) }} - restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-package-${{ matrix.package }}-composer- - ${{ runner.os }}-php-${{ matrix.php }}-package- - - - - 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.18.5" - composer config extra.symfony.require "${{ matrix.symfony }}" - working-directory: "src/Sylius/${{ matrix.package }}" - - - - name: Configure Swiftmailer (if needed) - working-directory: "src/Sylius/${{ matrix.package }}" - run: | - composer require --no-progress --no-update --no-scripts --no-plugins "sylius/mailer-bundle:^1.8" - composer require --no-progress --no-update --no-scripts --no-plugins "symfony/swiftmailer-bundle:^3.4" - echo "APP_ENV=test_with_swiftmailer" >> $GITHUB_ENV - if: matrix.swiftmailer == true - - - - name: Validate composer.json - run: composer validate --ansi --strict - working-directory: "src/Sylius/${{ matrix.package }}" - - - - name: Install dependencies - run: composer update --no-interaction --no-scripts - env: - COMPOSER_ROOT_VERSION: dev-master - working-directory: "src/Sylius/${{ matrix.package }}" - id: end-of-setup - - - - name: Create empty manifest.json files (AdminBundle, CoreBundle) - working-directory: "src/Sylius/${{ matrix.package }}" - if: matrix.package == 'Bundle/AdminBundle' || matrix.package == 'Bundle/CoreBundle' || matrix.package == 'Bundle/ApiBundle' - run: | - mkdir -p test/public/build/admin test/public/build/shop - echo "{}" >> test/public/build/shop/manifest.json - echo "{}" >> test/public/build/admin/manifest.json - - - - name: Run PHPArkitect - working-directory: "src/Sylius/${{ matrix.package }}" - run: vendor/phparkitect/phparkitect/bin-stub/phparkitect check - if: always() && steps.end-of-setup.outcome == 'success' && matrix.package == 'Bundle/ApiBundle' - - - - name: Setup Database (for ApiBundle) - working-directory: "src/Sylius/${{ matrix.package }}" - run: test/bin/console doctrine:schema:update --force - if: matrix.package == 'Bundle/ApiBundle' - - - - name: Remove Specifications not supported on Symfony >= 6.0 - working-directory: "src/Sylius/${{ matrix.package }}" - if: ${{ true != contains( matrix.symfony, '^5.4' ) && matrix.package == 'Bundle/UserBundle' }} - run: | - rm spec/Security/UserPasswordEncoderSpec.php - - - - name: Run PHPSpec - working-directory: "src/Sylius/${{ matrix.package }}" - run: vendor/bin/phpspec run --ansi --no-interaction -f dot - - - - name: Check the existence of phpunit.xml.dist - id: phpunit_xml_dist_existence_check - uses: andstor/file-existence-action@v2 - with: - files: "src/Sylius/${{ matrix.package }}/phpunit.xml.dist" - - - - name: Check the existence of phpunit.xml - id: phpunit_xml_existence_check - uses: andstor/file-existence-action@v2 - with: - files: "src/Sylius/${{ matrix.package }}/phpunit.xml" - - - - name: Run PHPUnit - working-directory: "src/Sylius/${{ matrix.package }}" - if: steps.phpunit_xml_dist_existence_check.outputs.files_exists == 'true' || steps.phpunit_xml_existence_check.outputs.files_exists == 'true' - run: vendor/bin/phpunit --colors=always - - notify-about-build-failure: - runs-on: ubuntu-latest - - if: failure() && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') - - needs: [test] - - name: "Notify about build failure" - - timeout-minutes: 5 - - steps: - - - name: "Process data" - id: process-data - shell: bash - run: | - echo "branch=$(echo ${{ github.ref }} | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" >> $GITHUB_OUTPUT - echo "sha=$(echo ${{ github.sha }} | cut -c 1-12)" >> $GITHUB_OUTPUT - - - - name: "Notify on Slack" - uses: edge/simple-slack-notify@master - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - if: env.SLACK_WEBHOOK_URL != null - with: - channel: "#builds" - username: "GitHub Actions" - text: | - ** - - _ _ _ _ _ _ _ - color: "danger" - fields: | - [ - { "title": "Repository", "value": "", "short": true }, - { "title": "Action", "value": "", "short": true }, - { "title": "Reference", "value": "", "short": true }, - { "title": "Commit", "value": "", "short": true }, - { "title": "Event", "value": "${{ github.event_name }}", "short": true } - ] diff --git a/RoboFile.php b/RoboFile.php new file mode 100644 index 00000000000..9a8493724b7 --- /dev/null +++ b/RoboFile.php @@ -0,0 +1,109 @@ +startGroup($package); + + try { + $processResult = $this->processPackagePipeline($package); + $result[$package] = null !== $processResult && $processResult->wasSuccessful() ? self::SUCCESS : self::FAILED; + } catch (TaskException) { + $result[$package] = self::FAILED; + } + } + + $this->endGroup(); + + foreach ($result as $packageName => $value) { + printf("%s %s%s", $value === self::SUCCESS ? '✅' : '❌', $packageName, PHP_EOL); + $failed = $failed || $value === self::FAILED; + } + + exit(false === $failed ? 0 : 1); + } + + /** + * @throws TaskException + */ + private function processPackagePipeline(string $package): ?Result + { + $symfonyVersion = getenv('SYMFONY_VERSION'); + $useSwiftmailer = getenv('USE_SWIFTMAILER'); + $packagePath = sprintf('%s/src/Sylius/%s', self::ROOT_DIR, $package); + + if (false === $symfonyVersion) { + throw new RuntimeException('SYMFONY_VERSION environment variable is not set.'); + } + + $task = $this->taskExecStack() + ->dir($packagePath) + ->stopOnFail() + ->exec(sprintf('composer config extra.symfony.require "%s"', $symfonyVersion)) + ; + + if (self::YES === $useSwiftmailer) { + $task + ->exec('composer require --no-progress --no-update --no-scripts --no-plugins "sylius/mailer-bundle:^1.8"') + ->exec('composer require --no-progress --no-update --no-scripts --no-plugins "symfony/swiftmailer-bundle:^3.4"') + ; + } + + $task + ->exec('composer validate --ansi --strict') + ->exec('composer update --no-scripts --no-interaction') + ; + + if (in_array($package, ['Bundle/AdminBundle', 'Bundle/ApiBundle', 'Bundle/CoreBundle'])) { + mkdir(sprintf('%s/test/public/build/admin', $packagePath), 0777, true); + mkdir(sprintf('%s/test/public/build/shop', $packagePath), 0777, true); + file_put_contents(sprintf('%s/test/public/build/admin/manifest.json', $packagePath), '{}'); + file_put_contents(sprintf('%s/test/public/build/shop/manifest.json', $packagePath), '{}'); + } + + if ('Bundle/ApiBundle' === $package) { + $task->exec('test/bin/console doctrine:schema:update --force'); + } + + if (false === str_starts_with($symfonyVersion, '^5.4') && 'Bundle/UserBundle' === $package) { + $task->exec('rm spec/Security/UserPasswordEncoderSpec.php'); + } + + $task->exec('vendor/bin/phpspec run --ansi --no-interaction -f dot'); + + if (file_exists(sprintf('%s/phpunit.xml', $packagePath)) || file_exists(sprintf('%s/phpunit.xml.dist', $packagePath))) { + $task->exec('vendor/bin/phpunit --colors=always'); + } + + return $task->run(); + } + + private function startGroup(string $groupName): void + { + printf("::group::%s\n", $groupName); + } + + private function endGroup(): void + { + echo "\n::endgroup::\n\n"; + } +} diff --git a/composer.json b/composer.json index 3acddf1c364..0d1fb764f41 100644 --- a/composer.json +++ b/composer.json @@ -189,10 +189,11 @@ "require-dev": { "behat/behat": "^3.6.1", "behat/mink-selenium2-driver": "^1.4", + "consolidation/robo": "^3.0|^4.0", "dmore/behat-chrome-extension": "^1.3", "dmore/chrome-mink-driver": "^2.7", - "doctrine/data-fixtures": "^1.4", "doctrine/cache": "^1.10", + "doctrine/data-fixtures": "^1.4", "friends-of-behat/mink": "^1.8", "friends-of-behat/mink-browserkit-driver": "^1.4", "friends-of-behat/mink-debug-extension": "^2.0", diff --git a/config/packages/test/webpack_encore.yaml b/config/packages/test/webpack_encore.yaml new file mode 100644 index 00000000000..9ad967357bb --- /dev/null +++ b/config/packages/test/webpack_encore.yaml @@ -0,0 +1,2 @@ +webpack_encore: + strict_mode: false diff --git a/config/packages/test_cached/webpack_encore.yaml b/config/packages/test_cached/webpack_encore.yaml new file mode 100644 index 00000000000..9ad967357bb --- /dev/null +++ b/config/packages/test_cached/webpack_encore.yaml @@ -0,0 +1,2 @@ +webpack_encore: + strict_mode: false diff --git a/src/Sylius/Bundle/AddressingBundle/composer.json b/src/Sylius/Bundle/AddressingBundle/composer.json index a975c8724aa..c6691fe0ed2 100644 --- a/src/Sylius/Bundle/AddressingBundle/composer.json +++ b/src/Sylius/Bundle/AddressingBundle/composer.json @@ -55,6 +55,9 @@ "extra": { "branch-alias": { "dev-master": "1.12-dev" + }, + "symfony": { + "require": "^5.4" } }, "autoload": { diff --git a/src/Sylius/Bundle/CoreBundle/composer.json b/src/Sylius/Bundle/CoreBundle/composer.json index a1ce8be118f..d2ac1055ae8 100644 --- a/src/Sylius/Bundle/CoreBundle/composer.json +++ b/src/Sylius/Bundle/CoreBundle/composer.json @@ -94,6 +94,9 @@ "extra": { "branch-alias": { "dev-master": "1.12-dev" + }, + "symfony": { + "require": "^5.4" } }, "autoload": {