Skip to content

Commit a31e26a

Browse files
authored
Merge pull request #279 from BitBagCommerce/MAINTENANCE/sylius-1.14-support
Sylius 1.14 support
2 parents f96f3f8 + 7b97175 commit a31e26a

31 files changed

+384
-229
lines changed

.docker/fpm.conf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[www]
2+
user = www-data
3+
group = www-data
4+
5+
listen = /var/run/php-www.sock
6+
listen.owner = www-data
7+
listen.group = www-data
8+
listen.mode = 0660
9+
10+
clear_env = no
11+
12+
pm = dynamic
13+
pm.max_children = 5
14+
pm.start_servers = 2
15+
pm.min_spare_servers = 1
16+
pm.max_spare_servers = 3
17+
18+
pm.status_path = /status
19+
catch_workers_output = yes
20+
21+
security.limit_extensions = .php

.docker/nginx.conf

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
user www-data;
2+
worker_processes auto;
3+
daemon off;
4+
pid /run/nginx.pid;
5+
6+
include /etc/nginx/modules-enabled/*.conf;
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
http {
13+
include /etc/nginx/mime.types;
14+
default_type application/octet-stream;
15+
16+
server_tokens off;
17+
18+
client_max_body_size 64m;
19+
sendfile on;
20+
tcp_nodelay on;
21+
tcp_nopush on;
22+
23+
gzip_vary on;
24+
25+
access_log /var/log/nginx/access.log;
26+
error_log /var/log/nginx/error.log;
27+
28+
server {
29+
listen 80;
30+
31+
root /app/tests/Application/public;
32+
index index.php;
33+
34+
location / {
35+
try_files $uri /index.php$is_args$args;
36+
}
37+
38+
location ~ \.php$ {
39+
include fastcgi_params;
40+
41+
fastcgi_pass unix:/var/run/php-www.sock;
42+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
43+
44+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
45+
fastcgi_param DOCUMENT_ROOT $realpath_root;
46+
}
47+
}
48+
}

.docker/nginx/nginx.conf

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
user www-data;
2+
worker_processes auto;
3+
daemon off;
4+
pid /run/nginx.pid;
5+
6+
include /etc/nginx/modules-enabled/*.conf;
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
http {
13+
include /etc/nginx/mime.types;
14+
default_type application/octet-stream;
15+
16+
server_tokens off;
17+
18+
client_max_body_size 64m;
19+
sendfile on;
20+
tcp_nodelay on;
21+
tcp_nopush on;
22+
23+
gzip_vary on;
24+
25+
access_log /var/log/nginx/access.log;
26+
error_log /var/log/nginx/error.log;
27+
28+
server {
29+
listen 80;
30+
31+
root /app/tests/Application/public;
32+
index index.php;
33+
34+
location / {
35+
try_files $uri /index.php$is_args$args;
36+
}
37+
38+
location ~ \.php$ {
39+
include fastcgi_params;
40+
41+
fastcgi_pass unix:/var/run/php8-fpm.sock;
42+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
43+
44+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
45+
fastcgi_param DOCUMENT_ROOT $realpath_root;
46+
}
47+
}
48+
}

.docker/php/php-cli.ini

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[PHP]
2+
memory_limit=1024M
3+
4+
[date]
5+
date.timezone=${PHP_DATE_TIMEZONE}
6+
7+
[opcache]
8+
opcache.enable=0
9+
opcache.memory_consumption=256
10+
opcache.max_accelerated_files=20000
11+
opcache.validate_timestamps=0
12+
;opcache.preload=/app/config/preload.php
13+
opcache.preload_user=www-data
14+
opcache.jit=1255
15+
opcache.jit_buffer_size=256M

.docker/php/php-fpm.ini

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[PHP]
2+
memory_limit=-1
3+
4+
[date]
5+
date.timezone=${PHP_DATE_TIMEZONE}
6+
7+
[opcache]
8+
zend_extension=opcache.so
9+
opcache.enable=0
10+
opcache.memory_consumption=256
11+
opcache.max_accelerated_files=20000
12+
opcache.validate_timestamps=0
13+
;opcache.preload=/app/config/preload.php
14+
opcache.preload_user=www-data
15+
opcache.jit=1255
16+
opcache.jit_buffer_size=256M
17+
18+
[xdebug]
19+
zend_extension=xdebug
20+
xdebug.mode=${XDEBUG_MODE}
21+
xdebug.client_host=host.docker.internal
22+
xdebug.start_with_request=trigger
23+
xdebug.client_port=9003
24+
xdebug.discover_client_host=1

.docker/supervisord.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[supervisord]
2+
nodaemon = true
3+
user = root
4+
pidfile = /run/supervisord.pid
5+
6+
[program:nginx]
7+
command = /usr/sbin/nginx
8+
user = root
9+
autostart = true
10+
11+
[program:php-fpm]
12+
command = /usr/sbin/php-fpm -F
13+
user = root
14+
autostart = true

.github/workflows/build.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,24 @@ jobs:
1717
runs-on: ubuntu-latest
1818

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

2222
strategy:
2323
fail-fast: false
2424
matrix:
2525
php: [ "8.1", "8.2", "8.3" ]
2626
symfony: ["^5.4", "^6.4"]
27-
sylius: [ "^1.12", "^1.13" ]
27+
sylius: [ "~1.13.0", "~1.14.0" ]
2828
node: [ "18.x", "20.x" ]
2929
mysql: ["8.0"]
3030
state_machine_adapter: ["winzou_state_machine", "symfony_workflow"]
3131

32+
exclude:
33+
-
34+
php: "8.3"
35+
symfony: "^5.4"
36+
sylius: "~1.13.0"
37+
3238
env:
3339
APP_ENV: test
3440
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"
@@ -146,7 +152,7 @@ jobs:
146152
name: Prepare test application assets
147153
run: |
148154
(cd tests/Application && bin/console assets:install public -vvv)
149-
(cd tests/Application && yarn prod)
155+
(cd tests/Application && yarn build)
150156
151157
-
152158
name: Prepare test application cache
@@ -178,7 +184,7 @@ jobs:
178184

179185
-
180186
name: Upload Behat logs
181-
uses: actions/upload-artifact@v3
187+
uses: actions/upload-artifact@v4
182188
if: failure()
183189
with:
184190
name: Behat logs
@@ -187,7 +193,7 @@ jobs:
187193

188194
-
189195
name: Upload test log logs
190-
uses: actions/upload-artifact@v3
196+
uses: actions/upload-artifact@v4
191197
if: failure()
192198
with:
193199
name: Var logs

.github/workflows/coding_standard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
matrix:
2121
php: [ "8.1", "8.2", "8.3" ]
2222
symfony: [ "^5.4", "^6.4" ]
23-
sylius: [ "^1.12", "^1.13" ]
23+
sylius: [ "^1.13", "^1.14" ]
2424
node: [ "18.x", "20.x" ]
2525

2626
steps:

Dockerfile

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
FROM ubuntu:20.04
2+
ARG DEBIAN_FRONTEND=noninteractive
3+
ARG PHP_VERSION=8.2
4+
ENV LC_ALL=C.UTF-8
5+
6+
# Install basic tools
7+
RUN apt-get update && apt-get install -y \
8+
software-properties-common \
9+
curl \
10+
make \
11+
supervisor \
12+
unzip \
13+
python2 \
14+
g++
15+
16+
# Append NODE, NGINX and PHP repositories
17+
RUN add-apt-repository ppa:ondrej/php \
18+
&& add-apt-repository ppa:ondrej/nginx \
19+
&& curl -sL https://deb.nodesource.com/setup_14.x | bash -
20+
21+
# Install required PHP extensions
22+
RUN apt-get update && apt-get install -y \
23+
nodejs \
24+
nginx \
25+
php${PHP_VERSION} \
26+
php${PHP_VERSION}-apcu \
27+
php${PHP_VERSION}-calendar \
28+
php${PHP_VERSION}-common \
29+
php${PHP_VERSION}-cli \
30+
php${PHP_VERSION}-ctype \
31+
php${PHP_VERSION}-curl \
32+
php${PHP_VERSION}-dom \
33+
php${PHP_VERSION}-exif \
34+
php${PHP_VERSION}-fpm \
35+
php${PHP_VERSION}-gd \
36+
php${PHP_VERSION}-intl \
37+
php${PHP_VERSION}-mbstring \
38+
php${PHP_VERSION}-mysql \
39+
php${PHP_VERSION}-opcache \
40+
php${PHP_VERSION}-pdo \
41+
php${PHP_VERSION}-pgsql \
42+
php${PHP_VERSION}-sqlite \
43+
php${PHP_VERSION}-xdebug \
44+
php${PHP_VERSION}-xml \
45+
php${PHP_VERSION}-xsl \
46+
php${PHP_VERSION}-yaml \
47+
php${PHP_VERSION}-zip
48+
49+
# Install Composer
50+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename composer
51+
52+
# Cleanup
53+
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/*
54+
55+
# Create directory for php-fpm socket
56+
# Link php-fpm binary file without version
57+
# -p Creates missing intermediate path name directories
58+
RUN ln -s /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm && mkdir -p /run/php
59+
60+
# Install yarn
61+
RUN npm install -g yarn && npm cache clean --force
62+
63+
# Initialize config files
64+
COPY .docker/supervisord.conf /etc/supervisor/conf.d/supervisor.conf
65+
COPY .docker/nginx.conf /etc/nginx/nginx.conf
66+
COPY .docker/fpm.conf /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
67+
COPY .docker/php/php-fpm.ini /etc/php/${PHP_VERSION}/fpm/php.ini
68+
COPY .docker/php/php-cli.ini /etc/php/${PHP_VERSION}/cli/php.ini
69+
70+
WORKDIR /app
71+
72+
EXPOSE 80
73+
74+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
phpunit:
2+
vendor/bin/phpunit
3+
4+
phpspec:
5+
vendor/bin/phpspec run --ansi --no-interaction -f dot
6+
7+
phpstan:
8+
vendor/bin/phpstan analyse
9+
10+
psalm:
11+
vendor/bin/psalm
12+
13+
behat-js:
14+
APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress
15+
16+
install:
17+
composer install --no-interaction --no-scripts
18+
19+
backend:
20+
tests/Application/bin/console sylius:install --no-interaction
21+
tests/Application/bin/console sylius:fixtures:load default --no-interaction
22+
23+
frontend:
24+
(cd tests/Application && yarn install --pure-lockfile)
25+
(cd tests/Application && bin/console assets:install public)
26+
27+
behat:
28+
APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress
29+
30+
init: install backend frontend
31+
32+
ci: init phpstan psalm phpunit phpspec behat
33+
34+
integration: init phpunit behat
35+
36+
static: install phpspec phpstan psalm

0 commit comments

Comments
 (0)