Skip to content

Commit

Permalink
Improve build
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Nov 8, 2023
1 parent 9a9118d commit d2e5c44
Show file tree
Hide file tree
Showing 18 changed files with 139 additions and 62 deletions.
14 changes: 0 additions & 14 deletions .github/dependabot.yml

This file was deleted.

90 changes: 83 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "build"
on:
push:
branches:
- "0.*"
- "0.*.x"
paths-ignore:
- "**/*.md"
pull_request:
Expand Down Expand Up @@ -71,13 +71,36 @@ jobs:
- "7.4"
- "8.0"
- "8.1"
- "8.2"

dependencies:
- "lowest"
- "highest"

symfony:
- "^5.4"
- "~6.0.0"
- "~6.1.0"
- "~6.2.0"
- "~6.3.0"

exclude:
- php-version: "7.4"
symfony: "~6.0.0"
- php-version: "7.4"
symfony: "~6.1.0"
- php-version: "7.4"
symfony: "~6.2.0"
- php-version: "7.4"
symfony: "~6.3.0"
- php-version: "8.0"
symfony: "~6.0.0"
- php-version: "8.0"
symfony: "~6.1.0"
- php-version: "8.0"
symfony: "~6.2.0"
- php-version: "8.0"
symfony: "~6.3.0"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -113,17 +136,42 @@ jobs:
runs-on: "ubuntu-latest"

strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"

dependencies:
- "lowest"
- "highest"

symfony:
- "^5.4"
- "~6.0.0"
- "~6.1.0"
- "~6.2.0"
- "~6.3.0"

exclude:
- php-version: "7.4"
symfony: "~6.0.0"
- php-version: "7.4"
symfony: "~6.1.0"
- php-version: "7.4"
symfony: "~6.2.0"
- php-version: "7.4"
symfony: "~6.3.0"
- php-version: "8.0"
symfony: "~6.0.0"
- php-version: "8.0"
symfony: "~6.1.0"
- php-version: "8.0"
symfony: "~6.2.0"
- php-version: "8.0"
symfony: "~6.3.0"

steps:
- name: "Checkout"
Expand All @@ -137,18 +185,18 @@ jobs:
php-version: "${{ matrix.php-version }}"
tools: "flex"

- name: "Remove sylius/sylius from composer.json"
run: "composer remove --dev --no-update --no-plugins --no-scripts sylius/sylius"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
env:
SYMFONY_REQUIRE: "${{ matrix.symfony }}"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Cache warmup"
run: "(cd tests/Application && bin/console cache:warmup)"

- name: "Static analysis"
run: "composer analyse"
run: "vendor/bin/psalm --php-version=${{ matrix.php-version }}"

unit-tests:
name: "Unit tests (PHP ${{ matrix.php-version }} | Dependency versions: ${{ matrix.dependencies }} | Symfony: ${{ matrix.symfony }})"
Expand All @@ -161,12 +209,36 @@ jobs:
- "7.4"
- "8.0"
- "8.1"
- "8.2"

dependencies:
- "lowest"
- "highest"

symfony:
- "^5.4"
- "~6.0.0"
- "~6.1.0"
- "~6.2.0"
- "~6.3.0"

exclude:
- php-version: "7.4"
symfony: "~6.0.0"
- php-version: "7.4"
symfony: "~6.1.0"
- php-version: "7.4"
symfony: "~6.2.0"
- php-version: "7.4"
symfony: "~6.3.0"
- php-version: "8.0"
symfony: "~6.0.0"
- php-version: "8.0"
symfony: "~6.1.0"
- php-version: "8.0"
symfony: "~6.2.0"
- php-version: "8.0"
symfony: "~6.3.0"

steps:
- name: "Checkout"
Expand All @@ -180,6 +252,9 @@ jobs:
php-version: "${{ matrix.php-version }}"
tools: "flex"

- name: "Remove sylius/sylius from composer.json"
run: "composer remove --dev --no-update --no-plugins --no-scripts sylius/sylius"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
env:
Expand All @@ -201,6 +276,7 @@ jobs:
- "7.4"
- "8.0"
- "8.1"
- "8.2"

dependencies:
- "highest"
Expand All @@ -226,7 +302,7 @@ jobs:
- name: "Setup node"
uses: "actions/setup-node@v3"
with:
node-version: "14"
node-version: "16"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
Expand Down Expand Up @@ -315,7 +391,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.2"

dependencies:
- "highest"
Expand Down
32 changes: 11 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"knplabs/knp-snappy": "^1.4",
"knplabs/knp-snappy-bundle": "^1.9",
"setono/doctrine-object-manager-trait": "^1.1",
"sylius/api-bundle": "^1.0",
"sylius/api-bundle": "^1.10",
"sylius/channel": "^1.0",
"sylius/channel-bundle": "^1.0",
"sylius/core": "^1.0",
Expand All @@ -29,7 +29,7 @@
"sylius/locale-bundle": "^1.0",
"sylius/mailer-bundle": "^1.6 || ^2.0",
"sylius/money-bundle": "^1.0",
"sylius/order": "^1.0",
"sylius/order": "^1.10",
"sylius/order-bundle": "^1.0",
"sylius/product": "^1.0",
"sylius/product-bundle": "^1.0",
Expand Down Expand Up @@ -57,28 +57,27 @@
"webmozart/assert": "^1.11"
},
"require-dev": {
"friendsofsymfony/oauth-server-bundle": ">2.0.0-alpha.0 ^2.0@dev",
"lexik/jwt-authentication-bundle": "^2.16",
"lexik/jwt-authentication-bundle": "^2.19",
"matthiasnoback/symfony-config-test": "^4.3",
"matthiasnoback/symfony-dependency-injection-test": "^4.3",
"php-http/message-factory": "^1.1",
"phpspec/phpspec": "^7.2",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.6",
"phpspec/phpspec": "^7.4",
"phpspec/prophecy-phpunit": "^2.0.2",
"phpunit/phpunit": "^9.6.13",
"psalm/plugin-phpunit": "^0.18",
"psalm/plugin-symfony": "^5.0",
"setono/code-quality-pack": "^2.4",
"setono/code-quality-pack": "^2.6",
"setono/sylius-behat-pack": "^0.2.2",
"setono/sylius-catalog-promotion-plugin": "^0.4",
"setono/sylius-catalog-promotion-plugin": "^0.4.8 || ^0.5",
"sylius/sylius": "~1.10.14",
"symfony/debug-bundle": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/framework-bundle": "^5.4 || ^6.0",
"symfony/intl": "^5.4 || ^6.0",
"symfony/property-info": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"symfony/webpack-encore-bundle": "^1.16",
"weirdan/doctrine-psalm-plugin": "^2.5"
"symfony/webpack-encore-bundle": "^1.17",
"weirdan/doctrine-psalm-plugin": "^2.9"
},
"prefer-stable": true,
"autoload": {
Expand All @@ -104,20 +103,12 @@
},
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"scripts": {
"all": [
"@checks",
"@tests"
],
"analyse": [
"@ensure-test-container-exists",
"psalm"
],
"analyse": "psalm",
"assets": [
"@ensure-assets-installed",
"@ensure-assets-compiled"
Expand All @@ -140,7 +131,6 @@
"ensure-env-dev-copied": "(cd tests/Application && ([[ -f .env.local ]] || cp .env .env.local))",
"ensure-env-test-copied": "(cd tests/Application && ([[ -f .env.test.local ]] || cp .env.test .env.test.local))",
"ensure-schema-updated": "composer ensure-env-copied && (cd tests/Application && bin/console doctrine:schema:update --force -e ${SYMFONY_ENV:-'dev'})",
"ensure-test-container-exists": "[[ -f tests/Application/var/cache/test/Tests_Setono_SyliusGiftCardPlugin_Application_KernelTestDebugContainer.xml ]] || tests/Application/bin/console cache:warmup --env=test",
"ensure-vendors-installed": "[[ -f vendor/autoload.php ]] || php -d memory_limit=-1 /usr/local/bin/composer install",
"fix-style": "ecs check --fix",
"fixtures": [
Expand Down
13 changes: 9 additions & 4 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedPsalmSuppress="false"
findUnusedBaselineEntry="true"
findUnusedBaselineEntry="false"
findUnusedVariablesAndParams="false"
findUnusedCode="false"
errorLevel="1"
Expand All @@ -20,11 +20,9 @@
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin">
<containerXml>tests/Application/var/cache/test/Tests_Setono_SyliusGiftCardPlugin_Application_KernelTestDebugContainer.xml</containerXml>
</pluginClass>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
<pluginClass class="Weirdan\DoctrinePsalmPlugin\Plugin"/>
<pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin"/>
</plugins>
<forbiddenFunctions>
<function name="dd"/>
Expand All @@ -37,8 +35,15 @@
<RedundantConditionGivenDocblockType errorLevel="suppress"/>
<MissingTemplateParam>
<errorLevel type="suppress">
<directory name="src/Factory"/>
<directory name="src/Form"/>
<directory name="src/Repository"/>
</errorLevel>
</MissingTemplateParam>
<UndefinedDocblockClass>
<errorLevel type="suppress">
<referencedClass name="ApiPlatform\Api\IriConverterInterface"/>
</errorLevel>
</UndefinedDocblockClass>
</issueHandlers>
</psalm>
3 changes: 1 addition & 2 deletions src/Api/CommandHandler/AddGiftCardToOrderHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
use Setono\SyliusGiftCardPlugin\Model\OrderInterface;
use Setono\SyliusGiftCardPlugin\Repository\GiftCardRepositoryInterface;
use Setono\SyliusGiftCardPlugin\Repository\OrderRepositoryInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Webmozart\Assert\Assert;

final class AddGiftCardToOrderHandler implements MessageHandlerInterface
final class AddGiftCardToOrderHandler
{
private GiftCardRepositoryInterface $giftCardRepository;

Expand Down
3 changes: 1 addition & 2 deletions src/Api/CommandHandler/AddItemToCartHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
use Sylius\Component\Core\Repository\ProductVariantRepositoryInterface;
use Sylius\Component\Order\Modifier\OrderItemQuantityModifierInterface;
use Sylius\Component\Order\Modifier\OrderModifierInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Webmozart\Assert\Assert;

final class AddItemToCartHandler implements MessageHandlerInterface
final class AddItemToCartHandler
{
private OrderRepositoryInterface $orderRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
use Sylius\Component\Locale\Model\LocaleInterface;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Webmozart\Assert\Assert;

final class AssociateConfigurationToChannelHandler implements MessageHandlerInterface
final class AssociateConfigurationToChannelHandler
{
private RepositoryInterface $giftCardConfigurationRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
use Setono\SyliusGiftCardPlugin\Api\Command\CreateGiftCardConfiguration;
use Setono\SyliusGiftCardPlugin\Factory\GiftCardConfigurationFactoryInterface;
use Setono\SyliusGiftCardPlugin\Model\GiftCardConfigurationInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;

final class CreateGiftCardConfigurationHandler implements MessageHandlerInterface
final class CreateGiftCardConfigurationHandler
{
private GiftCardConfigurationFactoryInterface $giftCardConfigurationFactory;

Expand Down
3 changes: 1 addition & 2 deletions src/Api/CommandHandler/RemoveGiftCardFromOrderHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
use Setono\SyliusGiftCardPlugin\Model\OrderInterface;
use Setono\SyliusGiftCardPlugin\Repository\GiftCardRepositoryInterface;
use Setono\SyliusGiftCardPlugin\Repository\OrderRepositoryInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Webmozart\Assert\Assert;

final class RemoveGiftCardFromOrderHandler implements MessageHandlerInterface
final class RemoveGiftCardFromOrderHandler
{
private GiftCardRepositoryInterface $giftCardRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ private function getOwner(string $ownerIri): GiftCardConfigurationInterface
if ($this->iriConverter instanceof LegacyIriConverterInterface) {
$owner = $this->iriConverter->getItemFromIri($ownerIri);
} else {
/**
* @psalm-suppress UndefinedDocblockClass
*
* @var mixed $owner
*/
$owner = $this->iriConverter->getResourceFromIri($ownerIri);
}

Expand Down
Loading

0 comments on commit d2e5c44

Please sign in to comment.