Skip to content

Commit

Permalink
Merge pull request #38 from maximehuran/feature/sylius-1-13
Browse files Browse the repository at this point in the history
Add Sylius 1.13 Compatibility
  • Loading branch information
maximehuran authored Aug 30, 2024
2 parents 483fe9c + 35054d9 commit bcf1395
Show file tree
Hide file tree
Showing 20 changed files with 186 additions and 159 deletions.
35 changes: 21 additions & 14 deletions .github/workflows/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1']
sylius: ['~1.9.0', '~1.10.0', '~1.11.0', '~1.12.0']
php: ['8.0', '8.1', '8.2']
sylius: ["~1.11.0", "~1.12.0", "~1.13.0"]
exclude:
- php: '8.0'
sylius: '~1.9.0'
- php: '8.1'
sylius: '~1.9.0'
- php: '7.4'
- php: '8.2'
sylius: '~1.11.0'
- php: '7.4'
- php: '8.0'
sylius: '~1.12.0'
- php: '8.0'
sylius: '~1.13.0'

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd, intl, json
ini-values: date.timezone=UTC

tools: symfony-cli

- name: Set project php-version
run: |
echo ${{ matrix.php }} > .php-version
Expand All @@ -41,15 +41,22 @@ jobs:
with:
path: plugin

- run: mkdir -p /home/runner/{.composer/cache,.config/composer}
- name: Determine composer cache directory
id: composer-cache-directory
working-directory: plugin
run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- name: Cache dependencies installed with composer
uses: actions/cache@v3
id: cache-composer
with:
path: /home/runner/.composer/cache
key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ github.sha }}
path: ${{ steps.composer-cache-directory.outputs.directory }}
key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ hashFiles('**/composer.json') }}
restore-keys: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-

- name: Ensure that composer cache directory exists
run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }}

- name: Composer Github Auth
run: composer config -g github-oauth.github.com ${{ github.token }}

Expand All @@ -74,7 +81,7 @@ jobs:
composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
composer config repositories.plugin '{"type": "path", "url": "../plugin/"}'
- name: Require plugin & install all
- name: Require plugin & install all dependencies
working-directory: ./sylius
run: |
composer require monsieurbiz/sylius-no-commerce-plugin="*@dev"
22 changes: 14 additions & 8 deletions .github/workflows/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.1']
php: ['8.1', '8.2']

steps:
- uses: actions/checkout@v3
Expand All @@ -22,26 +22,32 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: date.timezone=UTC
extensions: gd, intl, json

- name: Set project php-version
run: |
echo ${{ matrix.php }} > .php-version
echo "${{ matrix.php }}" > .php-version
- uses: actions/cache@v3
- name: Determine composer cache directory
id: composer-cache-directory
run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies installed with composer
uses: actions/cache@v3
id: cache-composer
with:
path: /home/runner/.composer/cache
path: ${{ steps.composer-cache-directory.outputs.directory }}
key: composer2-php:${{ matrix.php }}-${{ github.sha }}
restore-keys: composer2-php:${{ matrix.php }}-

- run: mkdir -p /home/runner/{.composer/cache,.config/composer}
if: steps.cache-composer.outputs.cache-hit != 'true'
- name: Ensure that composer cache directory exists
run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }}

- name: Composer Github Auth
run: composer config -g github-oauth.github.com ${{ github.token }}

- name: Install PHP dependencies
run: composer update --no-scripts --no-plugins --prefer-dist
run: composer update --prefer-dist

- uses: symfonycorp/security-checker-action@v4

34 changes: 17 additions & 17 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,56 +14,56 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.0', '8.1']
php: ['8.1', '8.2']

env:
SYMFONY_ARGS: --no-tls
COMPOSER_ARGS: --prefer-dist
DOCKER_INTERACTIVE_ARGS: -t

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd, intl, json
ini-values: date.timezone=UTC

tools: symfony-cli

- name: Set project php-version
run: |
echo ${{ matrix.php }} > .php-version
echo "${{ matrix.php }}" > .php-version
- name: Install symfony CLI
run: |
curl https://get.symfony.com/cli/installer | bash
echo "${HOME}/.symfony5/bin" >> $GITHUB_PATH
- name: Determine composer cache directory
id: composer-cache-directory
run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
- name: Cache dependencies installed with composer
uses: actions/cache@v3
id: cache-composer
with:
path: /home/runner/.composer/cache
path: ${{ steps.composer-cache-directory.outputs.directory }}
key: composer2-php:${{ matrix.php }}-${{ github.sha }}
restore-keys: composer2-php:${{ matrix.php }}-

- run: mkdir -p /home/runner/{.composer/cache,.config/composer}
- name: Ensure that composer cache directory exists
run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }}

- name: Composer Github Auth
run: composer config -g github-oauth.github.com ${{ github.token }}

- name: Disallow Composer plugins for testing purposes
run: composer config allow-plugins false

- run: make install

- run: make test.composer

- run: make test.phpcs

- run: make test.phpunit

- run: make test.phpstan

- run: make test.phpmd
Expand Down
18 changes: 9 additions & 9 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
'blank_line_after_namespace' => true,
'blank_lines_before_namespace' => true,
'blank_line_before_statement' => true,
'braces' => [
'allow_single_line_closure' => true,
],
'cast_spaces' => true,
'class_attributes_separation' => true,
'class_definition' => [
Expand All @@ -63,7 +60,7 @@
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'comment_to_phpdoc' => true,
'compact_nullable_typehint' => true,
'compact_nullable_type_declaration' => true,
'concat_space' => [
'spacing' => 'one',
],
Expand All @@ -89,7 +86,6 @@
'fully_qualified_strict_types' => true,
'function_declaration' => true,
'function_to_constant' => true,
'function_typehint_space' => true,
'general_phpdoc_tag_rename' => true,
'global_namespace_import' => [
'import_classes' => true,
Expand Down Expand Up @@ -124,7 +120,7 @@
],
'native_constant_invocation' => true,
'native_function_casing' => true,
'new_with_braces' => true,
'new_with_parentheses' => true,
'no_alias_functions' => true,
'no_alternative_syntax' => true,
'no_blank_lines_after_class_opening' => true,
Expand Down Expand Up @@ -163,14 +159,14 @@
'no_short_bool_cast' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_spaces_inside_parenthesis' => true,
'spaces_inside_parentheses' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
],
'no_unset_cast' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_braces' => true,
'no_unneeded_final_method' => true,
'no_unset_on_property' => true,
'no_unused_imports' => true,
Expand All @@ -183,6 +179,7 @@
'no_whitespace_in_blank_line' => true,
'non_printable_character' => true,
'normalize_index_brace' => true,
'nullable_type_declaration_for_default_null_value' => false,
'object_operator_without_whitespace' => true,
'ordered_imports' => [
'imports_order' => [
Expand Down Expand Up @@ -217,7 +214,9 @@
'phpdoc_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => ['groups' => [['ORM\\*'], ['Assert\\*']]],
'phpdoc_separation' => ['groups' => [
['ORM\\*'], ['Assert\\*'],
]],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_tag_type' => true,
'phpdoc_to_comment' => false,
Expand Down Expand Up @@ -253,6 +252,7 @@
'elements' => ['arrays'],
],
'trim_array_spaces' => true,
'type_declaration_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'elements' => [
Expand Down
2 changes: 1 addition & 1 deletion .php-version.dist
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.1
8.2
32 changes: 21 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
.DEFAULT_GOAL := help
SHELL=/bin/bash
APP_DIR=tests/Application
SYLIUS_VERSION=1.12.0
SYLIUS_VERSION=1.13.0
SYMFONY=cd ${APP_DIR} && symfony
COMPOSER=symfony composer
CONSOLE=${SYMFONY} console
export COMPOSE_PROJECT_NAME=no-commerce
export MIGRATIONS_NAMESPACE=MonsieurBiz\\SyliusNoCommercePlugin\\Migrations
export USER_UID=$(shell id -u)
PLUGIN_NAME=sylius-${COMPOSE_PROJECT_NAME}-plugin
COMPOSE=docker-compose
COMPOSE=docker compose
YARN=yarn

###
Expand Down Expand Up @@ -68,22 +70,23 @@ setup_application:
rm -f ${APP_DIR}/yarn.lock
(cd ${APP_DIR} && ${COMPOSER} config repositories.plugin '{"type": "path", "url": "../../"}')
(cd ${APP_DIR} && ${COMPOSER} config extra.symfony.allow-contrib true)
(cd ${APP_DIR} && ${COMPOSER} config extra.symfony.docker false)
(cd ${APP_DIR} && ${COMPOSER} config --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]')
(cd ${APP_DIR} && ${COMPOSER} config allow-plugins true)
(cd ${APP_DIR} && ${COMPOSER} config minimum-stability dev)
(cd ${APP_DIR} && ${COMPOSER} config --no-plugins allow-plugins true)
(cd ${APP_DIR} && ${COMPOSER} config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]')
(cd ${APP_DIR} && ${COMPOSER} require --no-install --no-scripts --no-progress sylius/sylius="~${SYLIUS_VERSION}") # Make sure to install the required version of sylius because the sylius-standard has a soft constraint
$(MAKE) ${APP_DIR}/.php-version
$(MAKE) ${APP_DIR}/php.ini
(cd ${APP_DIR} && ${COMPOSER} install --no-interaction)
$(MAKE) apply_dist
(cd ${APP_DIR} && ${COMPOSER} require --no-progress monsieurbiz/${PLUGIN_NAME}="*@dev")
(cd ${APP_DIR} && ${COMPOSER} require --no-progress --no-interaction monsieurbiz/${PLUGIN_NAME}="*@dev")
rm -rf ${APP_DIR}/var/cache


${APP_DIR}/docker-compose.yaml:
rm -f ${APP_DIR}/docker-compose.yml
rm -f ${APP_DIR}/docker-compose.yaml
rm -f ${APP_DIR}/compose.yml # Remove Sylius file about Docker
rm -f ${APP_DIR}/compose.override.dist.yml # Remove Sylius file about Docker
ln -s ../../docker-compose.yaml.dist ${APP_DIR}/docker-compose.yaml
.PHONY: ${APP_DIR}/docker-compose.yaml

Expand All @@ -98,14 +101,15 @@ apply_dist:
ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))); \
for i in `cd dist && find . -type f`; do \
FILE_PATH=`echo $$i | sed 's|./||'`; \
FILENAME=`basename $$FILE_PATH` \
FOLDER_PATH=`dirname $$FILE_PATH`; \
echo $$FILE_PATH; \
(cd ${APP_DIR} && rm -f $$FILE_PATH); \
(cd ${APP_DIR} && mkdir -p $$FOLDER_PATH); \
if [[ "$$FILENAME" != "Kernel.php" ]]; then \
if [[ $$FILE_PATH != 'src/Kernel.php' ]]; then \
echo "Link $$FILE_PATH"; \
(cd ${APP_DIR} && ln -s $$ROOT_DIR/dist/$$FILE_PATH $$FILE_PATH); \
else \
echo "Copy $$FILE_PATH"; \
(cd ${APP_DIR} && cp $$ROOT_DIR/dist/$$FILE_PATH $$FILE_PATH); \
fi \
done
Expand All @@ -114,17 +118,20 @@ apply_dist:
### TESTS
### ¯¯¯¯¯

test.all: test.composer test.phpstan test.phpmd test.phpspec test.phpcs test.yaml test.schema test.twig test.container ## Run all tests in once
test.all: test.composer test.phpstan test.phpmd test.phpunit test.phpspec test.phpcs test.yaml test.schema test.twig test.container ## Run all tests in once

test.composer: ## Validate composer.json
${COMPOSER} validate --strict --no-plugins
${COMPOSER} validate --strict

test.phpstan: ## Run PHPStan
${COMPOSER} phpstan

test.phpmd: ## Run PHPMD
${COMPOSER} phpmd

test.phpunit: ## Run PHPUnit
${COMPOSER} phpunit

test.phpspec: ## Run PHPSpec
${COMPOSER} phpspec

Expand All @@ -138,7 +145,7 @@ test.container: ## Lint the symfony container
${CONSOLE} lint:container

test.yaml: ## Lint the symfony Yaml files
${CONSOLE} lint:yaml ../../recipes ../../src/Resources/config
${CONSOLE} lint:yaml ../../src/Resources/config --parse-tags

test.schema: ## Validate MySQL Schema
${CONSOLE} doctrine:schema:validate
Expand Down Expand Up @@ -169,6 +176,9 @@ sylius.assets: ## Install all assets with symlinks
messenger.setup: ## Setup Messenger transports
${CONSOLE} messenger:setup-transports

doctrine.diff: ## Doctrine diff
${CONSOLE} doctrine:migration:diff --namespace="${MIGRATIONS_NAMESPACE}"

###
### PLATFORM
### ¯¯¯¯¯¯¯¯
Expand Down
Loading

0 comments on commit bcf1395

Please sign in to comment.