Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions .docker/nginx/nginx.conf

This file was deleted.

5 changes: 0 additions & 5 deletions .docker/php/php.ini

This file was deleted.

87 changes: 46 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ "8.1", "8.2", "8.3" ]
symfony: [ "5.4.*", "^6.4" ]
sylius: ["1.13.3"]
node: ["18.x"]
mysql: ["8.0"]
php: ["8.4"]
symfony: ["^7.3"]
sylius: ["~2.1.0"]
node: ["22.x"]
mysql: ["8.4"]

env:
APP_ENV: test
BEHAT_BASE_URL: "https://127.0.0.1:8080/"
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"

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

-
name: Setup PHP
Expand Down Expand Up @@ -69,22 +70,10 @@ jobs:
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 --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 &

-
name: Run webserver
run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon)

-
name: Validate composer.json
run: composer validate --ansi --strict

-
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
Expand All @@ -95,16 +84,12 @@ 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:^2.4"
composer global config --no-plugins allow-plugins.symfony/flex true
composer config extra.symfony.require "${{ matrix.symfony }}"

-
Expand All @@ -115,13 +100,15 @@ jobs:
-
name: Install PHP dependencies
run: composer install --no-interaction
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

-
name: Run unit tests
run: vendor/bin/phpunit --colors=always --testsuite=unit

-
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
Expand All @@ -134,31 +121,39 @@ jobs:

-
name: Install JS dependencies
run: (cd tests/Application && yarn install)
run: (cd vendor/sylius/test-application && yarn install)

-
name: Prepare test application database
run: |
(cd tests/Application && bin/console doctrine:database:create -vvv)
(cd tests/Application && bin/console doctrine:schema:create -vvv)
(vendor/bin/console doctrine:database:create -vvv)
(vendor/bin/console doctrine:schema:create -vvv)

-
name: Prepare test application assets
run: |
(cd tests/Application && bin/console assets:install public -vvv)
(cd tests/Application && yarn build:prod)
vendor/bin/console assets:install -vvv
(cd vendor/sylius/test-application && yarn build)

-
name: Prepare test application cache
run: (cd tests/Application && bin/console cache:warmup -vvv)
run: vendor/bin/console cache:warmup -vvv

-
name: Load fixtures in test application
run: (cd tests/Application && bin/console sylius:fixtures:load -n)
run: vendor/bin/console sylius:fixtures:load -n

-
name: Validate composer.json
run: composer validate --ansi --strict

-
name: Validate container
run: vendor/bin/console lint:container

-
name: Validate database schema
run: (cd tests/Application && bin/console doctrine:schema:validate)
run: vendor/bin/console doctrine:schema:validate

-
name: Run PHPStan
Expand All @@ -173,8 +168,16 @@ jobs:
run: vendor/bin/phpspec run --ansi -f progress --no-interaction

-
name: Run PHPUnit
run: vendor/bin/phpunit --colors=always
name: Run Non-unit PHPUnit tests
run: vendor/bin/phpunit --colors=always --testsuite=non-unit

-
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 --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 &

-
name: Run webserver
run: symfony server:start --port=8080 --daemon

-
name: Run Behat
Expand All @@ -185,18 +188,20 @@ jobs:
uses: actions/upload-artifact@v4
if: failure()
with:
name: Behat logs
name: "Behat logs - ${{ matrix.sylius }}-${{ github.run_id }}-${{ github.run_number }}"
path: etc/build/
if-no-files-found: ignore
compression-level: 6
overwrite: true

roave_bc_check:
name: Roave BC Check
runs-on: ubuntu-latest
env:
PHP_VERSION: 8.2
PHP_VERSION: 8.3
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
/vendor/
/var/
/node_modules/
/drivers/
/composer.lock

/etc/build/*
!/etc/build/.gitignore

/tests/Application/yarn.lock

/.phpunit.result.cache
/behat.yml
/phpspec.yml
/phpunit.xml
/compose.override.yml
/docker-compose.override.yml
.phpunit.result.cache

# Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project
/.php-version
/php.ini
docker-compose.override.yml

/tests/TestApplication/.env.local
/tests/TestApplication/.env.*.local
79 changes: 55 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,36 +1,67 @@
phpunit:
vendor/bin/phpunit
.PHONY: run

phpspec:
vendor/bin/phpspec run --ansi --no-interaction -f dot
DOCKER_COMPOSE ?= docker compose
DOCKER_USER ?= "$(shell id -u):$(shell id -g)"
ENV ?= "dev"

phpstan:
vendor/bin/phpstan analyse
init:
@make -s docker-compose-check
@if [ ! -e compose.override.yml ]; then \
cp compose.override.dist.yml compose.override.yml; \
fi
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php composer install --no-interaction --no-scripts --no-plugins
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm nodejs
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) up -d

psalm:
vendor/bin/psalm
run:
@make -s up

behat-js:
APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress
debug:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) -f compose.yml -f compose.override.yml -f compose.debug.yml up -d

install:
composer install --no-interaction --no-scripts
up:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) up -d

backend:
tests/Application/bin/console sylius:install --no-interaction
tests/Application/bin/console sylius:fixtures:load default --no-interaction
down:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) down

frontend:
(cd tests/Application && yarn install --pure-lockfile)
(cd tests/Application && GULP_ENV=prod yarn build)
clean:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) down -v

behat:
APP_ENV=test vendor/bin/behat --colors --strict --no-interaction -vvv -f progress
php-shell:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) exec php sh

node-shell:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm -i nodejs sh

node-watch:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm -i nodejs "npm run watch"

docker-compose-check:
@$(DOCKER_COMPOSE) version >/dev/null 2>&1 || (echo "Please install docker compose binary or set DOCKER_COMPOSE=\"docker-compose\" for legacy binary" && exit 1)
@echo "You are using \"$(DOCKER_COMPOSE)\" binary"
@echo "Current version is \"$$($(DOCKER_COMPOSE) version)\""

init: install backend frontend
database-init:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console doctrine:database:create -n --if-not-exists
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console doctrine:migrations:migrate -n

ci: init phpstan psalm phpunit phpspec behat
database-reset:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console doctrine:database:drop -n --force --if-exists
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console doctrine:database:create -n
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console doctrine:migrations:migrate -n

integration: init phpunit behat
load-fixtures:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/console sylius:fixtures:load -n

static: install phpspec phpstan psalm
phpstan:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/phpstan analyse -c phpstan.neon

ecs:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/ecs check src

phpunit:
@ENV=$(ENV) DOCKER_USER=$(DOCKER_USER) $(DOCKER_COMPOSE) run --rm php vendor/bin/phpunit

behat:
@ENV=$(ENV) DOCKER_USER=root $(DOCKER_COMPOSE) run --rm php vendor/bin/behat
Loading
Loading