Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP-291: Code style adjustments #267

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
52b2787
OP-291: Update readme
hmfilar Jul 17, 2024
e6dfaba
OP-291: Refactor templates
hmfilar Jul 22, 2024
1984c2d
OP-291: Update dependencies
hmfilar Jul 22, 2024
07a1c60
OP-291: Refactor, simplify processing logic
hmfilar Jul 22, 2024
c545592
OP-291: Use test application build action from SyliusLabs
hmfilar Jul 22, 2024
2d538e5
OP-291: Deprecate WishlistProductFactoryFacade
hmfilar Jul 23, 2024
cd5cc44
OP-291: Refactor AddProductsToCartHandler to handle exceptions in con…
hmfilar Jul 24, 2024
b732a4e
OP-291: Refactor AddSelectedProductsToCartHandler to handle exception…
hmfilar Jul 25, 2024
3db585e
OP-291: Refactor RemoveSelectedProductsFromWishlistHandler to handle …
hmfilar Jul 25, 2024
e156f2d
OP-291: Extract abstraction to prevent code repetition
hmfilar Jul 25, 2024
67e90e1
OP-291: Add a command for removing guest wishlists
hmfilar Jul 25, 2024
6a82668
OP-291: Refactor behats
hmfilar Jul 26, 2024
d53fe47
OP-291: Add tests for the new command
hmfilar Jul 26, 2024
aafb2e1
OP-291: Clean up behat configs
hmfilar Jul 29, 2024
9beaad4
OP-291: Make wishlist page more consistent with cart
hmfilar Jul 29, 2024
be4dc0a
OP-291: Cover edge case with behat tests
hmfilar Jul 30, 2024
516c2bb
OP-291: Replicate wishlist selection logic from product list on produ…
hmfilar Jul 30, 2024
2f48a04
OP-291: Bring back installations steps using recipes and make them op…
hmfilar Jul 30, 2024
167b8f8
OP-291: Include plugin scripts and styles using template events
hmfilar Aug 2, 2024
2808fdf
OP-291: Fix template copying section in readme
hmfilar Aug 28, 2024
aa49117
Merge branch 'master' into feature/op-291-code-style
hmfilar Sep 18, 2024
17d8ab8
OP-291: Update supported php and node versions
hmfilar Sep 18, 2024
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
296 changes: 97 additions & 199 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,208 +1,106 @@
name: Build

on:
push:
branches-ignore:
- 'dependabot/**'
pull_request: ~
release:
types: [created]
schedule:
-
cron: "0 1 * * 6" # Run at 1am every Saturday
workflow_dispatch: ~
push:
branches-ignore:
- 'dependabot/**'
pull_request: ~
release:
types: [ created ]
schedule:
- cron: "0 1 * * 6" # Run at 1am every Saturday
workflow_dispatch: ~

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

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

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

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

exclude:
- sylius: ~1.12.13
state_machine_adapter: "symfony_workflow"
env:
APP_ENV: test
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"

steps:
- uses: actions/checkout@v4

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

- name: Build test application
uses: SyliusLabs/[email protected]
with:
sylius-version: "${{ matrix.sylius }}"
symfony-version: "${{ matrix.symfony }}"
mysql-version: "${{ matrix.mysql }}"
node-version: "${{ matrix.node }}"
working-directory: "."
plugin-build: "yes"

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

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

- name: Run ECS
run: vendor/bin/ecs

- name: Run PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon

- name: Run PHPSpec
run: vendor/bin/phpspec run --ansi -f progress --no-interaction

- name: Run PHPUnit
run: vendor/bin/phpunit --colors=always

- name: Run Behat
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun

- name: Upload Behat logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: Behat logs
path: etc/build/
if-no-files-found: ignore

- name: Upload test log logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: Var logs
path: tests/Application/var/log/
if-no-files-found: ignore

- name: Failed build Slack notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
env:
APP_ENV: test
DATABASE_URL: "mysql://root:[email protected]/sylius?serverVersion=${{ matrix.mysql }}"

steps:
-
uses: actions/checkout@v3

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

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

-
name: Shutdown default MySQL
run: sudo service mysql stop

-
name: Setup MySQL
uses: mirromutth/[email protected]
with:
mysql version: "${{ matrix.mysql }}"
mysql root password: "root"

-
name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144

-
name: Output PHP version for Symfony CLI
run: php -v | head -n 1 | awk '{ print $2 }' > .php-version

-
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: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

-
name: Cache Composer
uses: actions/cache@v4
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: Restrict Symfony version
if: matrix.symfony != ''
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
composer config extra.symfony.require "${{ matrix.symfony }}"

-
name: Restrict Sylius version
if: matrix.sylius != ''
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction

-
name: Install PHP dependencies
run: composer install --no-interaction

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

-
name: Cache Yarn
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json.~1.13.0.dist **/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-

-
name: Install JS dependencies
run: (cd tests/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)

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

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

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

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

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

-
name: Run PHPSpec
run: vendor/bin/phpspec run --ansi -f progress --no-interaction

-
name: Run PHPUnit
run: vendor/bin/phpunit --colors=always

-
name: Run Behat
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun

-
name: Upload Behat logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: Behat logs
path: etc/build/
if-no-files-found: ignore

-
name: Upload test log logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: Var logs
path: tests/Application/var/log/
if-no-files-found: ignore

-
name: Failed build Slack notification
uses: rtCamp/action-slack-notify@v2
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
env:
SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }}
SLACK_COLOR: ${{ job.status }}
SLACK_ICON: https://github.com/rtCamp.png?size=48
SLACK_MESSAGE: ':x:'
SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository
SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }}
SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }}
SLACK_COLOR: ${{ job.status }}
SLACK_ICON: https://github.com/rtCamp.png?size=48
SLACK_MESSAGE: ':x:'
SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository
SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }}
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.12.13", "~1.13.0" ]
node: [ "18.x", "20.x" ]

steps:
Expand Down
8 changes: 1 addition & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"license": "MIT",
"require": {
"php": "^8.1",
"sylius/sylius": "^1.12 || ^1.13",
"symfony/webpack-encore-bundle": "^1.15",
"sylius/sylius": "~1.12.13 || ~1.13.0",
"dompdf/dompdf": "^2.0"
},
"require-dev": {
Expand Down Expand Up @@ -39,11 +38,6 @@
"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,
Expand Down
Loading
Loading