Skip to content

Commit

Permalink
Bump SA tools, sync with skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Jun 14, 2022
1 parent f5bf019 commit 15de284
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 61 deletions.
26 changes: 8 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.0"]
symfony: ["^5.4"]
sylius: ["~1.11.0"]
php: ["8.0", "8.1"]
symfony: ["5.4.*"]
sylius: ["~1.11.2"]
node: ["14.x"]
mysql: ["8.0"]

Expand All @@ -49,6 +49,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: "${{ matrix.node }}"
cache: "yarn"
cache-dependency-path: |
**/package.json
**/yarn.lock
-
name: Shutdown default MySQL
Expand Down Expand Up @@ -84,7 +88,7 @@ jobs:

-
name: Cache Composer
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
Expand All @@ -102,20 +106,6 @@ jobs:
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}

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

-
name: Cache Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
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 Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
/behat.yml
/phpspec.yml
/phpunit.xml

# Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project
/.php-version
/php.ini
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"require": {
"php": "^8.0",
"sylius/sylius": "~1.11.0",
"sylius/sylius": "~1.11.2",
"symfony/config": "^5.4",
"symfony/dependency-injection": "^5.4",
"symfony/form": "^5.4",
Expand All @@ -28,10 +28,10 @@
"matthiasnoback/symfony-dependency-injection-test": "^4.2.1",
"phpspec/phpspec": "^7.1",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "1.4.9",
"phpstan/phpstan-doctrine": "1.2.11",
"phpstan/phpstan-strict-rules": "1.1.0",
"phpstan/phpstan-webmozart-assert": "1.1.2",
"phpstan/phpstan": "1.7.14",
"phpstan/phpstan-doctrine": "1.3.9",
"phpstan/phpstan-strict-rules": "1.2.3",
"phpstan/phpstan-webmozart-assert": "1.2.0",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"sylius-labs/coding-standard": "^4.0",
Expand All @@ -41,7 +41,7 @@
"symfony/intl": "^5.4",
"symfony/web-profiler-bundle": "^5.4",
"symfony/webpack-encore-bundle": "^1.14",
"vimeo/psalm": "4.22.0"
"vimeo/psalm": "4.23.0"
},
"config": {
"allow-plugins": {
Expand Down
8 changes: 4 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
includes:
- phpstan-baseline.neon

parameters:
level: max
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false

level: max

paths:
- 'src'
- src
- tests/Behat

excludePaths:
# Makes PHPStan crash
Expand Down
3 changes: 3 additions & 0 deletions tests/Application/config/packages/_sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ sylius_shop:
product_grid:
include_all_descendants: true

sylius_api:
enabled: true

sylius_channel:
resources:
channel:
Expand Down
10 changes: 10 additions & 0 deletions tests/Application/config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
api_platform:
mapping:
paths:
- '%kernel.project_dir%/../../vendor/sylius/sylius/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources'
- '%kernel.project_dir%/config/api_platform'
- '%kernel.project_dir%/src/Entity'
patch_formats:
json: ['application/merge-patch+json']
swagger:
versions: [3]
2 changes: 1 addition & 1 deletion tests/Application/config/packages/fos_rest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ fos_rest:
empty_content: 204
format_listener:
rules:
- { path: '^/api/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true }
- { path: '^/api/v1/.*', priorities: ['json', 'xml'], fallback_format: json, prefer_extension: true }
- { path: '^/', stop: true }
3 changes: 3 additions & 0 deletions tests/Application/config/packages/framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ framework:
session:
handler_id: null
storage_factory_id: session.storage.factory.native
serializer:
mapping:
paths: [ '%kernel.project_dir%/config/serialization' ]

when@test:
framework:
Expand Down
46 changes: 14 additions & 32 deletions tests/Application/config/packages/security.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
parameters:
sylius.security.admin_regex: "^/%sylius_admin.path_name%"
sylius.security.api_regex: "^/api"
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
providers:
Expand All @@ -20,9 +9,6 @@ security:
id: sylius.shop_user_provider.email_or_name_based
sylius_api_shop_user_provider:
id: sylius.shop_user_provider.email_or_name_based
sylius_api_chain_provider:
chain:
providers: [sylius_api_shop_user_provider, sylius_api_admin_user_provider]

encoders:
Sylius\Component\User\Model\UserInterface: argon2i
Expand Down Expand Up @@ -55,12 +41,12 @@ security:
anonymous: true

new_api_admin_user:
pattern: "%sylius.security.new_api_route%/admin-user-authentication-token"
provider: sylius_admin_user_provider
pattern: "%sylius.security.new_api_admin_regex%/.*"
provider: sylius_api_admin_user_provider
stateless: true
anonymous: true
json_login:
check_path: "%sylius.security.new_api_route%/admin-user-authentication-token"
check_path: "%sylius.security.new_api_admin_route%/authentication-token"
username_path: email
password_path: password
success_handler: lexik_jwt_authentication.handler.authentication_success
Expand All @@ -70,12 +56,12 @@ security:
- lexik_jwt_authentication.jwt_token_authenticator

new_api_shop_user:
pattern: "%sylius.security.new_api_route%/shop-user-authentication-token"
provider: sylius_shop_user_provider
pattern: "%sylius.security.new_api_shop_regex%/.*"
provider: sylius_api_shop_user_provider
stateless: true
anonymous: true
json_login:
check_path: "%sylius.security.new_api_route%/shop-user-authentication-token"
check_path: "%sylius.security.new_api_shop_route%/authentication-token"
username_path: email
password_path: password
success_handler: lexik_jwt_authentication.handler.authentication_success
Expand All @@ -84,15 +70,6 @@ security:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator

new_api:
pattern: "%sylius.security.new_api_regex%/*"
provider: sylius_api_chain_provider
stateless: true
anonymous: lazy
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator

shop:
switch_user: { role: ROLE_ALLOWED_TO_SWITCH }
context: shop
Expand Down Expand Up @@ -124,7 +101,11 @@ security:
anonymous: true

dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false

image_resolver:
pattern: ^/media/cache/resolve
security: false

access_control:
Expand All @@ -134,15 +115,16 @@ security:
- { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS }

- { path: "%sylius.security.admin_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: "%sylius.security.api_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: "%sylius.security.shop_regex%/login", role: IS_AUTHENTICATED_ANONYMOUSLY }

- { path: "%sylius.security.shop_regex%/register", role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: "%sylius.security.shop_regex%/verify", role: IS_AUTHENTICATED_ANONYMOUSLY }

- { 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_admin_route%/authentication-token", role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER }
- { path: "%sylius.security.new_api_shop_route%/authentication-token", role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: "%sylius.security.new_api_shop_regex%/.*", role: IS_AUTHENTICATED_ANONYMOUSLY }
Empty file.

0 comments on commit 15de284

Please sign in to comment.