Skip to content

Commit

Permalink
Upgrade for Sylius 1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Feb 27, 2023
1 parent 30c413f commit cccb919
Show file tree
Hide file tree
Showing 54 changed files with 504 additions and 314 deletions.
48 changes: 48 additions & 0 deletions .docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
user www-data;
worker_processes auto;
daemon off;
pid /run/nginx.pid;

include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

server_tokens off;

client_max_body_size 64m;
sendfile on;
tcp_nodelay on;
tcp_nopush on;

gzip_vary on;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

server {
listen 80;

root /app/tests/Application/public;
index index.php;

location / {
try_files $uri /index.php$is_args$args;
}

location ~ \.php$ {
include fastcgi_params;

fastcgi_pass unix:/var/run/php8-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;

fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
}
}
5 changes: 5 additions & 0 deletions .docker/php/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[PHP]
memory_limit=512M

[date]
date.timezone=${PHP_DATE_TIMEZONE}
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
25 changes: 16 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ 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: ["8.0"]
symfony: ["5.4.*"]
sylius: ["^1.11.2"]
node: ["14.x"]
mysql: ["8.0"]
php: ["8.0", "8.1"]
symfony: ["5.4.*", "^6.0"]
sylius: ["^1.12"]
node: ["18.x"]
mysql: ["5.7", "8.0"]

env:
APP_ENV: test
Expand All @@ -41,7 +41,7 @@ jobs:
with:
php-version: "${{ matrix.php }}"
extensions: intl
tools: symfony
tools: flex,symfony
coverage: none

-
Expand Down Expand Up @@ -91,11 +91,16 @@ jobs:
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 @@ -106,6 +111,8 @@ jobs:
-
name: Install PHP dependencies
run: composer install --no-interaction
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

-
name: Get Yarn cache directory
Expand Down Expand Up @@ -135,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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
# Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project
/.php-version
/php.ini
docker-compose.override.yml
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
49 changes: 28 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"license": "MIT",
"require": {
"php": "^8.0",
"sylius/sylius": "^1.11"
"sylius/sylius": "^1.12",
"sylius/mailer-bundle": "^1.8 || ^2.0",
"symfony/webpack-encore-bundle": "^1.15"
},
"require-dev": {
"behat/behat": "^3.6.1",
Expand All @@ -24,35 +26,35 @@
"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.99",
"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.16",
"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": "^5.4",
"symfony/debug-bundle": "^5.4",
"symfony/dotenv": "^5.4",
"symfony/intl": "^5.4",
"symfony/web-profiler-bundle": "^5.4",
"vimeo/psalm": "4.7.1",
"polishsymfonycommunity/symfony-mocker-container": "^1.0"
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "^4.2",
"symfony/browser-kit": "^5.4 || ^6.0",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/flex": "^2.2.2",
"symfony/intl": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"vimeo/psalm": "4.27.0"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"symfony/thanks": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
"dealerdirect/phpcodesniffer-composer-installer": false,
"phpstan/extension-installer": true,
"symfony/flex": true,
"symfony/thanks": true
}
},
"extra": {
"branch-alias": {
"dev-master": "1.11-dev"
"dev-master": "1.12-dev"
}
},
"autoload": {
Expand Down Expand Up @@ -87,6 +89,11 @@
"@phpunit",
"@phpspec",
"@behat"
]
],
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd",
"security-checker security:check": "script"
}
}
}
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
5 changes: 5 additions & 0 deletions e2e-test-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Make sure to set GOOGLE_CHROME env variable pointing to your Google Chrome binary. For example on macOS:
# GOOGLE_CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ./e2e-test-server.sh

trap 'kill %1; kill %2' SIGINT
cd tests/Application && APP_ENV=test symfony server:start --port=8080 --dir=public & "${GOOGLE_CHROME}" --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 --disable-gpu --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' --crash-dumps-dir=/tmp https://127.0.0.1 & tee
Loading

0 comments on commit cccb919

Please sign in to comment.