Skip to content

Commit

Permalink
Merge pull request #20 from odiseoteam/1.8
Browse files Browse the repository at this point in the history
Update sylius 1.12 and symfony 6
  • Loading branch information
bigboss86 committed Apr 25, 2023
2 parents 99b7c87 + cb4fc16 commit 3f297d5
Show file tree
Hide file tree
Showing 72 changed files with 420 additions and 585 deletions.
82 changes: 82 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
# Change these settings to your own preference
indent_style = space
indent_size = 4

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.feature]
indent_style = space
indent_size = 4

[*.js]
indent_style = space
indent_size = 2

[*.json]
indent_style = space
indent_size = 2

[*.md]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false

[*.neon]
indent_style = space
indent_size = 4

[*.php]
indent_style = space
indent_size = 4

[*.sh]
indent_style = space
indent_size = 4

[*.{yaml,yml}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false

[.babelrc]
indent_style = space
indent_size = 2

[.gitmodules]
indent_style = tab
indent_size = 4

[.php_cs{,.dist}]
indent_style = space
indent_size = 4

[composer.json]
indent_style = space
indent_size = 4

[package.json]
indent_style = space
indent_size = 2

[phpspec.yml{,.dist}]
indent_style = space
indent_size = 4

[phpstan.neon]
indent_style = space
indent_size = 4

[phpunit.xml{,.dist}]
indent_style = space
indent_size = 4
42 changes: 22 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,39 @@ on:

jobs:
tests:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"

strategy:
fail-fast: false
matrix:
php: ["7.4", "8.0"]
symfony: ["^4.4", "^5.2"]
sylius: ["~1.9.0", "~1.10.0"]
node: ["14.x"]
php: ["8.0", "8.1"]
symfony: ["^6.0"]
sylius: ["^1.12"]
node: ["14.x", "16.x", "18.x"]
mysql: ["5.7", "8.0"]

exclude:
-
php: "8.0"
sylius: "~1.9.0"

env:
APP_ENV: test
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"

steps:
-
uses: actions/checkout@v2
uses: actions/checkout@v3

-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
extensions: intl
tools: symfony
tools: flex,symfony
coverage: none

-
name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: "${{ matrix.node }}"

Expand Down Expand Up @@ -85,22 +80,27 @@ jobs:
-
name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

-
name: Cache Composer
uses: actions/cache@v2
uses: actions/cache@v3
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: Configure global composer
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.2.2"
-
name: Restrict Symfony version
if: matrix.symfony != ''
run: |
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
composer config extra.symfony.require "${{ matrix.symfony }}"
-
Expand All @@ -111,15 +111,17 @@ jobs:
-
name: Install PHP dependencies
run: composer install --no-interaction
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

-
name: Get Yarn cache directory
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

-
name: Cache Yarn
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
Expand All @@ -140,7 +142,7 @@ jobs:
name: Prepare test application assets
run: |
(cd tests/Application && bin/console assets:install public -vvv)
(cd tests/Application && yarn build)
(cd tests/Application && yarn build:prod)
-
name: Prepare test application cache
Expand Down Expand Up @@ -184,7 +186,7 @@ jobs:

-
name: Upload Behat logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: Behat logs
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@
/behat.yml
/phpspec.yml
/phpunit.xml

# Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project
/.php-version
/php.ini
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
phpunit:
vendor/bin/phpunit

phpspec:
vendor/bin/phpspec run --ansi --no-interaction -f dot

phpstan:
vendor/bin/phpstan analyse

psalm:
vendor/bin/psalm

behat-js:
APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress

install:
composer install --no-interaction --no-scripts

backend:
tests/Application/bin/console sylius:install --no-interaction
tests/Application/bin/console sylius:fixtures:load default --no-interaction

frontend:
(cd tests/Application && yarn install --pure-lockfile)
(cd tests/Application && GULP_ENV=prod yarn build)

behat:
APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress

init: install backend frontend

ci: init phpstan psalm phpunit phpspec behat

integration: init phpunit behat

static: install phpspec phpstan psalm
50 changes: 31 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
"description": "Vendor plugin for Sylius. Add Vendor (Brand) to your products",
"license": "MIT",
"require": {
"php": "^7.4 || ^8.0",
"sylius/sylius": "^1.9"
"php": "^8.0",
"sylius/sylius": "^1.12",
"sylius/mailer-bundle": "^1.8 || ^2.0@beta",
"symfony/webpack-encore-bundle": "^1.15"
},
"require-dev": {
"behat/behat": "^3.6.1",
Expand All @@ -26,31 +28,41 @@
"friends-of-behat/suite-settings-extension": "^1.0",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
"phpspec/phpspec": "^7.0",
"phpspec/phpspec": "^7.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.85",
"phpstan/phpstan-doctrine": "0.12.33",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpstan/phpstan": "^1.8.1",
"phpstan/phpstan-doctrine": "1.3.37",
"phpstan/phpstan-strict-rules": "^1.3.0",
"phpstan/phpstan-webmozart-assert": "^1.2.0",
"phpunit/phpunit": "^9.5",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.2",
"symfony/debug-bundle": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
"symfony/intl": "^4.4 || ^5.2",
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
"vimeo/psalm": "4.7.1"
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "^4.2",
"symfony/browser-kit": "^6.0",
"symfony/debug-bundle": "^6.0",
"symfony/dotenv": "^6.0",
"symfony/flex": "^2.2.2",
"symfony/intl": "^6.0",
"symfony/web-profiler-bundle": "^6.0",
"vimeo/psalm": "5.9.0"
},
"conflict": {
"symfony/framework-bundle": "6.2.8"
},
"suggest": {
"stefandoorn/sitemap-plugin": "Adds vendors to the Sylius sitemap plugin"
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
"phpstan/extension-installer": true,
"symfony/flex": true
}
},
"conflict": {
"doctrine/dbal": "^3.0"
"extra": {
"symfony": {
"require": "^6.0"
}
},
"autoload": {
"psr-4": {
Expand Down
42 changes: 42 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
services:
app:
image: sylius/standard:1.11-traditional-alpine
environment:
APP_ENV: "dev"
DATABASE_URL: "mysql://root:mysql@mysql/sylius_%kernel.environment%?charset=utf8mb4"
# DATABASE_URL: "pgsql://root:postgres@postgres/sylius_%kernel.environment%?charset=utf8" # When using postgres
PHP_DATE_TIMEZONE: "Europe/Warsaw"
volumes:
- ./:/app:delegated
- ./.docker/php/php.ini:/etc/php8/php.ini:delegated
- ./.docker/nginx/nginx.conf:/etc/nginx/nginx.conf:delegated
ports:
- 80:80
depends_on:
- mysql
networks:
- sylius

mysql:
image: mysql:8.0
platform: linux/amd64
environment:
MYSQL_ROOT_PASSWORD: mysql
ports:
- ${MYSQL_PORT:-3306}:3306
networks:
- sylius

# postgres:
# image: postgres:14-alpine
# environment:
# POSTGRES_USER: root
# POSTGRES_PASSWORD: postgres
# ports:
# - ${POSTGRES_PORT:-5432}:5432
# networks:
# - sylius

networks:
sylius:
driver: bridge
18 changes: 12 additions & 6 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests/Behat',
__DIR__ . '/ecs.php',
]);

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');
$ecsConfig->import('vendor/sylius-labs/coding-standard/ecs.php');

$containerConfigurator->parameters()->set(Option::SKIP, [
$ecsConfig->skip([
VisibilityRequiredFixer::class => ['*Spec.php'],
]);
};
Loading

0 comments on commit 3f297d5

Please sign in to comment.