Skip to content

Commit

Permalink
Merge pull request #279 from BitBagCommerce/MAINTENANCE/sylius-1.14-s…
Browse files Browse the repository at this point in the history
…upport

Sylius 1.14 support
  • Loading branch information
hmfilar authored Feb 11, 2025
2 parents f96f3f8 + 7b97175 commit a31e26a
Show file tree
Hide file tree
Showing 31 changed files with 384 additions and 229 deletions.
21 changes: 21 additions & 0 deletions .docker/fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[www]
user = www-data
group = www-data

listen = /var/run/php-www.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

clear_env = no

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

pm.status_path = /status
catch_workers_output = yes

security.limit_extensions = .php
48 changes: 48 additions & 0 deletions .docker/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/php-www.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;

fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
}
}
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;
}
}
}
15 changes: 15 additions & 0 deletions .docker/php/php-cli.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[PHP]
memory_limit=1024M

[date]
date.timezone=${PHP_DATE_TIMEZONE}

[opcache]
opcache.enable=0
opcache.memory_consumption=256
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0
;opcache.preload=/app/config/preload.php
opcache.preload_user=www-data
opcache.jit=1255
opcache.jit_buffer_size=256M
24 changes: 24 additions & 0 deletions .docker/php/php-fpm.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[PHP]
memory_limit=-1

[date]
date.timezone=${PHP_DATE_TIMEZONE}

[opcache]
zend_extension=opcache.so
opcache.enable=0
opcache.memory_consumption=256
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0
;opcache.preload=/app/config/preload.php
opcache.preload_user=www-data
opcache.jit=1255
opcache.jit_buffer_size=256M

[xdebug]
zend_extension=xdebug
xdebug.mode=${XDEBUG_MODE}
xdebug.client_host=host.docker.internal
xdebug.start_with_request=trigger
xdebug.client_port=9003
xdebug.discover_client_host=1
14 changes: 14 additions & 0 deletions .docker/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[supervisord]
nodaemon = true
user = root
pidfile = /run/supervisord.pid

[program:nginx]
command = /usr/sbin/nginx
user = root
autostart = true

[program:php-fpm]
command = /usr/sbin/php-fpm -F
user = root
autostart = true
16 changes: 11 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,24 @@ jobs:
runs-on: ubuntu-latest

name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }},
MySQL ${{ matrix.mysql }}, State Machine Adapter ${{ matrix.state_machine_adapter }}"
MySQL ${{ matrix.mysql }}, State Machine Adapter ${{ matrix.state_machine_adapter }}, Node ${{ matrix.node }}"

strategy:
fail-fast: false
matrix:
php: [ "8.1", "8.2", "8.3" ]
symfony: ["^5.4", "^6.4"]
sylius: [ "^1.12", "^1.13" ]
sylius: [ "~1.13.0", "~1.14.0" ]
node: [ "18.x", "20.x" ]
mysql: ["8.0"]
state_machine_adapter: ["winzou_state_machine", "symfony_workflow"]

exclude:
-
php: "8.3"
symfony: "^5.4"
sylius: "~1.13.0"

env:
APP_ENV: test
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"
Expand Down Expand Up @@ -146,7 +152,7 @@ jobs:
name: Prepare test application assets
run: |
(cd tests/Application && bin/console assets:install public -vvv)
(cd tests/Application && yarn prod)
(cd tests/Application && yarn build)
-
name: Prepare test application cache
Expand Down Expand Up @@ -178,7 +184,7 @@ jobs:

-
name: Upload Behat logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: Behat logs
Expand All @@ -187,7 +193,7 @@ jobs:

-
name: Upload test log logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: Var logs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coding_standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
matrix:
php: [ "8.1", "8.2", "8.3" ]
symfony: [ "^5.4", "^6.4" ]
sylius: [ "^1.12", "^1.13" ]
sylius: [ "^1.13", "^1.14" ]
node: [ "18.x", "20.x" ]

steps:
Expand Down
74 changes: 74 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
ARG PHP_VERSION=8.2
ENV LC_ALL=C.UTF-8

# Install basic tools
RUN apt-get update && apt-get install -y \
software-properties-common \
curl \
make \
supervisor \
unzip \
python2 \
g++

# Append NODE, NGINX and PHP repositories
RUN add-apt-repository ppa:ondrej/php \
&& add-apt-repository ppa:ondrej/nginx \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash -

# Install required PHP extensions
RUN apt-get update && apt-get install -y \
nodejs \
nginx \
php${PHP_VERSION} \
php${PHP_VERSION}-apcu \
php${PHP_VERSION}-calendar \
php${PHP_VERSION}-common \
php${PHP_VERSION}-cli \
php${PHP_VERSION}-ctype \
php${PHP_VERSION}-curl \
php${PHP_VERSION}-dom \
php${PHP_VERSION}-exif \
php${PHP_VERSION}-fpm \
php${PHP_VERSION}-gd \
php${PHP_VERSION}-intl \
php${PHP_VERSION}-mbstring \
php${PHP_VERSION}-mysql \
php${PHP_VERSION}-opcache \
php${PHP_VERSION}-pdo \
php${PHP_VERSION}-pgsql \
php${PHP_VERSION}-sqlite \
php${PHP_VERSION}-xdebug \
php${PHP_VERSION}-xml \
php${PHP_VERSION}-xsl \
php${PHP_VERSION}-yaml \
php${PHP_VERSION}-zip

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename composer

# Cleanup
RUN apt-get remove --purge -y software-properties-common curl && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* /usr/share/man/*

# Create directory for php-fpm socket
# Link php-fpm binary file without version
# -p Creates missing intermediate path name directories
RUN ln -s /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm && mkdir -p /run/php

# Install yarn
RUN npm install -g yarn && npm cache clean --force

# Initialize config files
COPY .docker/supervisord.conf /etc/supervisor/conf.d/supervisor.conf
COPY .docker/nginx.conf /etc/nginx/nginx.conf
COPY .docker/fpm.conf /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
COPY .docker/php/php-fpm.ini /etc/php/${PHP_VERSION}/fpm/php.ini
COPY .docker/php/php-cli.ini /etc/php/${PHP_VERSION}/cli/php.ini

WORKDIR /app

EXPOSE 80

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
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 && bin/console assets:install public)

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
10 changes: 1 addition & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"require": {
"php": "^8.1",
"sylius/sylius": "^1.12 || ^1.13",
"sylius/sylius": "^1.13 || ^1.14",
"symfony/webpack-encore-bundle": "^1.15",
"dompdf/dompdf": "^2.0"
},
Expand Down Expand Up @@ -38,14 +38,6 @@
"lchrusciel/api-test-case": "^4.1 || ^5.0",
"nelmio/alice": "^3.10"
},
"conflict": {
"symfony/symfony": "4.1.8",
"symfony/browser-kit": "4.1.8",
"symfony/dom-crawler": "4.1.8",
"symfony/routing": "4.1.8",
"symfony/doctrine-bridge": "4.4.16",
"symfony/validator": "^6.4.7"
},
"prefer-stable": true,
"autoload": {
"psr-4": {
Expand Down
7 changes: 1 addition & 6 deletions doc/05-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ $ composer install
$ cd tests/Application
```

Copy `package.json.~1.xx.dist` file to `package.json` for specific version of Sylius (example for 1.12.0):
```bash
$ cp package.json.\~1.12.dist package.json
```

Then:

```bash
Expand All @@ -26,4 +21,4 @@ $ APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public -
$ open https://localhost:8080
$ vendor/bin/behat
$ vendor/bin/phpspec run
```
```
Loading

0 comments on commit a31e26a

Please sign in to comment.