Skip to content

Commit

Permalink
fos/oauth move to dev
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherhero committed Jul 13, 2021
1 parent f28e3de commit 73c505c
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 99 deletions.
59 changes: 45 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
name: Build

on:
push: ~
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
runs-on: ubuntu-18.04

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

strategy:
fail-fast: false
matrix:
php: [7.3, 7.4]
node: [10.x]
mysql: [5.7, 8.0]
php: ["8.0", "7.4"]
symfony: ["^4.4", "^5.2"]
sylius: ["~1.9.0", "~1.10.0"]
node: ["10.x"]
mysql: ["8.0"]

exclude:
- # PHP 7.3 does not support "caching_sha2_password" authentication plugin which is a default one in MySQL 8.0
php: 7.3
mysql: 8.0
- sylius: ~1.9.0
php: 8.0

- sylius: ~1.10.0
symfony: 4.4

env:
APP_ENV: test
Expand Down Expand Up @@ -61,6 +68,14 @@ jobs:
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
Expand Down Expand Up @@ -90,9 +105,22 @@ jobs:
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 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
run: composer install --no-interaction --no-scripts

-
name: Get Yarn cache directory
Expand All @@ -107,6 +135,7 @@ jobs:
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-yarn-
-
name: Install JS dependencies
run: (cd tests/Application && yarn install)
Expand All @@ -116,15 +145,21 @@ jobs:
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 build)
-
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
Expand All @@ -137,10 +172,6 @@ jobs:
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
Expand Down
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
"description": "Blacklist plugin for Sylius.",
"license": "MIT",
"require": {
"php": "^7.3 || ^8.0",
"sylius/sylius": "~1.8.0 || ~1.9.0 || ~1.10.0",
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev"
"php": "^7.3 || ^7.4 || ^8.0",
"sylius/sylius": "~1.8.0 || ~1.9.0 || ~1.10.0"
},
"require-dev": {
"behat/behat": "^3.7",
Expand All @@ -24,7 +23,7 @@
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/variadic-extension": "^1.3",
"lchrusciel/api-test-case": "^4.1||^5.0",
"lakion/mink-debug-extension": "^2.0.0",
"friendsofsymfony/oauth-server-bundle": "^1.6 || >2.0.0-alpha.0 ^2.0@dev",
"phpspec/phpspec": "^7.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "0.12.82",
Expand All @@ -33,13 +32,13 @@
"phpstan/phpstan-webmozart-assert": "0.12.12",
"phpunit/phpunit": "^9.5",
"sensiolabs/security-checker": "^6.0",
"sylius-labs/coding-standard": "^3.1",
"sylius-labs/coding-standard": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.2",
"symfony/debug-bundle": "^4.4 || ^5.2",
"symfony/dotenv": "^4.4 || ^5.2",
"symfony/intl": "^4.4 || ^5.2",
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
"vimeo/psalm": "4.6.4"
"vimeo/psalm": "4.7.1"
},
"autoload": {
"psr-4": {
Expand Down
14 changes: 14 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');

$containerConfigurator->parameters()->set(Option::SKIP, [
VisibilityRequiredFixer::class => ['*Spec.php'],
]);
};
2 changes: 1 addition & 1 deletion tests/Application/.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ APP_SECRET=EDITME
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
DATABASE_URL=mysql://root:password@127.0.0.1/sylius_test?serverVersion=8.0
DATABASE_URL=mysql://[email protected]/bitbag_sylius_blacklist_plugin_%kernel.environment%
###< doctrine/doctrine-bundle ###

###> lexik/jwt-authentication-bundle ###
Expand Down
1 change: 0 additions & 1 deletion tests/Application/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true],
SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],
Symplify\ConsoleColorDiff\ConsoleColorDiffBundle::class => ['dev' => true, 'test' => true],
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
];
2 changes: 2 additions & 0 deletions tests/Application/config/sylius/1.8/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
return [
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true],
FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true],
Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true],
];
37 changes: 0 additions & 37 deletions tests/Application/config/sylius/1.8/packages/_sylius.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,2 @@
imports:
- { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" }
- { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusShopBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" }

- { resource: "@BitBagSyliusBlacklistPlugin/Resources/config/config.yaml" }

- { resource: "../../../../src/Resources/config/config.yaml" }

parameters:
sylius_core.public_dir: '%kernel.project_dir%/public'

sylius_shop:
product_grid:
include_all_descendants: true

sylius_grid:
grids:
sylius_admin_customer:
fields:
fraudStatus:
type: twig
label: bitbag_sylius_blacklist_plugin.ui.fraud_status
options:
template: "@BitBagSyliusBlacklistPlugin/Customer/Grid/Field/fraudStatus.html.twig"
filters:
fraudStatus:
type: select
label: bitbag_sylius_blacklist_plugin.ui.fraud_status
form_options:
choices:
bitbag_sylius_blacklist_plugin.ui.neutral: Neutral
bitbag_sylius_blacklist_plugin.ui.blacklisted: Blacklisted
bitbag_sylius_blacklist_plugin.ui.whitelisted: Whitelisted
37 changes: 0 additions & 37 deletions tests/Application/config/sylius/1.9/packages/_sylius.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,2 @@
imports:
- { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" }
- { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusShopBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" }

- { resource: "@BitBagSyliusBlacklistPlugin/Resources/config/config.yaml" }

- { resource: "../../../../src/Resources/config/config.yaml" }

parameters:
sylius_core.public_dir: '%kernel.project_dir%/public'

sylius_shop:
product_grid:
include_all_descendants: true

sylius_grid:
grids:
sylius_admin_customer:
fields:
fraudStatus:
type: twig
label: bitbag_sylius_blacklist_plugin.ui.fraud_status
options:
template: "@BitBagSyliusBlacklistPlugin/Customer/Grid/Field/fraudStatus.html.twig"
filters:
fraudStatus:
type: select
label: bitbag_sylius_blacklist_plugin.ui.fraud_status
form_options:
choices:
bitbag_sylius_blacklist_plugin.ui.neutral: Neutral
bitbag_sylius_blacklist_plugin.ui.blacklisted: Blacklisted
bitbag_sylius_blacklist_plugin.ui.whitelisted: Whitelisted
13 changes: 10 additions & 3 deletions tests/Application/config/sylius/1.9/packages/security.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
parameters:
sylius.security.admin_regex: "^/admin"
sylius.security.admin_regex: "^/%sylius_admin.path_name%"
sylius.security.api_regex: "^/api"
sylius.security.shop_regex: "^/(?!admin|new-api|api/.*|api$|media/.*)[^/]++"
sylius.security.shop_regex: "^/(?!%sylius_admin.path_name%|new-api|api/.*|api$|media/.*)[^/]++"
sylius.security.new_api_route: "/new-api"
sylius.security.new_api_regex: "^%sylius.security.new_api_route%"
sylius.security.new_api_admin_route: "%sylius.security.new_api_route%/admin"
sylius.security.new_api_admin_regex: "^%sylius.security.new_api_admin_route%"
sylius.security.new_api_shop_route: "%sylius.security.new_api_route%/shop"
sylius.security.new_api_shop_regex: "^%sylius.security.new_api_shop_route%"

security:
always_authenticate_before_granting: true
Expand Down Expand Up @@ -41,7 +45,7 @@ security:
csrf_token_id: admin_authenticate
remember_me:
secret: "%env(APP_SECRET)%"
path: /admin
path: "/%sylius_admin.path_name%"
name: APP_ADMIN_REMEMBER_ME
lifetime: 31536000
remember_me_parameter: _remember_me
Expand Down Expand Up @@ -150,3 +154,6 @@ security:
- { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS }
- { path: "%sylius.security.api_regex%/.*", role: ROLE_API_ACCESS }
- { path: "%sylius.security.shop_regex%/account", role: ROLE_USER }

- { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS }
- { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY }

0 comments on commit 73c505c

Please sign in to comment.