Skip to content

Commit

Permalink
Merge pull request #95 from Setono/better-build
Browse files Browse the repository at this point in the history
Better, more robust build
  • Loading branch information
loevgaard authored Aug 7, 2023
2 parents d0ab2ad + e626d72 commit c5f2494
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 76 deletions.
58 changes: 44 additions & 14 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
- name: "Check style"
run: "composer check-style"

- name: "Rector"
run: "vendor/bin/rector process --dry-run"

- name: "Lint yaml files"
run: "(cd tests/Application && bin/console lint:yaml ../../src/Resources)"

Expand All @@ -74,8 +77,17 @@ jobs:
- "8.2"

dependencies:
- "lowest"
- "highest"


symfony:
- "^5.4"
- "^6.0"

exclude:
- php-version: "7.4"
symfony: "^6.0"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
Expand All @@ -88,6 +100,9 @@ jobs:
php-version: "${{ matrix.php-version }}"
tools: "composer-require-checker, composer-unused, flex"

- name: "Remove require-dev section in composer.json"
run: "composer config --unset require-dev"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
env:
Expand All @@ -96,11 +111,11 @@ jobs:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run maglnet/composer-require-checker"
run: "composer-require-checker check --config-file=$(pwd)/composer-require-checker.json"
run: "composer-require-checker check"

- name: "Run composer-unused/composer-unused"
run: "composer-unused"

static-code-analysis:
name: "Static Code Analysis (PHP${{ matrix.php-version }} | Deps: ${{ matrix.dependencies }} | SF${{ matrix.symfony }})"

Expand All @@ -109,14 +124,21 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"

dependencies:
- "lowest"
- "highest"

symfony:
- "^5.4"
- "^6.0"

exclude:
- php-version: "7.4"
symfony: "^6.0"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
Expand All @@ -128,6 +150,9 @@ jobs:
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"
tools: "flex"

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

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
Expand All @@ -136,9 +161,6 @@ jobs:
with:
dependency-versions: "${{ matrix.dependencies }}"

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

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

Expand All @@ -154,10 +176,18 @@ jobs:
- "8.0"
- "8.1"
- "8.2"

dependencies:
- "highest"

symfony:
- "^5.4"
- "^6.0"

exclude:
- php-version: "7.4"
symfony: "^6.0"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
Expand All @@ -169,6 +199,9 @@ jobs:
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"
tools: "flex"

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

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
Expand All @@ -188,14 +221,11 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "7.4" # We only do the integration tests on the lowest PHP requirement because the maintenance burden for doing this for all PHP versions requires a lot of Sylius application changes

dependencies:
- "highest"

steps:
- name: "Start MySQL"
run: "sudo /etc/init.d/mysql start"
Expand Down
36 changes: 0 additions & 36 deletions composer-require-checker.json

This file was deleted.

12 changes: 0 additions & 12 deletions composer-unused.php

This file was deleted.

16 changes: 10 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@
"setono/composite-compiler-pass": "^1.1",
"setono/google-analytics-bundle": "^1.0.0-alpha.5",
"setono/google-analytics-measurement-protocol": "^1.0@alpha",
"sylius/channel": "^1.0",
"sylius/channel-bundle": "^1.0",
"sylius/core": "^1.8",
"sylius/grid-bundle": "^1.10",
"sylius/locale": "^1.0",
"sylius/order": "^1.0",
"sylius/product": "^1.0",
"sylius/resource-bundle": "^1.8",
"sylius/taxonomy": "^1.0",
"sylius/ui-bundle": "^1.0",
"symfony/config": "^5.4 || ^6.0",
"symfony/dependency-injection": "^5.4 || ^6.0",
"symfony/event-dispatcher": "^5.4 || ^6.0",
Expand All @@ -36,13 +44,13 @@
"api-platform/core": "^2.7.13",
"behat/behat": "^3.13",
"icanhazstring/composer-unused": "^0.8.10",
"league/flysystem-bundle": "^2.4",
"matthiasnoback/symfony-config-test": "^4.3",
"matthiasnoback/symfony-dependency-injection-test": "^4.3",
"php-http/message-factory": "^1.1",
"phpspec/prophecy-phpunit": "^2.0.2",
"phpunit/phpunit": "^9.6.10",
"psalm/plugin-phpunit": "^0.18",
"psalm/plugin-symfony": "^5.0",
"setono/code-quality-pack": "^2.4",
"sylius/sylius": "~1.10.14",
"symfony/debug-bundle": "^5.4 || ^6.0",
Expand Down Expand Up @@ -77,12 +85,8 @@
"sort-packages": true
},
"scripts": {
"analyse": [
"@ensure-test-container-exists",
"psalm"
],
"analyse": "psalm",
"check-style": "ecs check",
"ensure-test-container-exists": "[[ -f tests/Application/var/cache/test/Tests_Setono_SyliusAnalyticsPlugin_Application_KernelTestDebugContainer.xml ]] || tests/Application/bin/console cache:warmup --env=test",
"fix-style": "ecs check --fix",
"phpunit": "phpunit"
}
Expand Down
12 changes: 6 additions & 6 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedPsalmSuppress="true"
findUnusedPsalmSuppress="false"
findUnusedCode="false"
findUnusedBaselineEntry="true"
phpVersion="7.4"
Expand All @@ -15,12 +15,12 @@
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin">
<containerXml>tests/Application/var/cache/test/Tests_Setono_SyliusAnalyticsPlugin_Application_KernelTestDebugContainer.xml</containerXml>
</pluginClass>
</plugins>
<issueHandlers>
<PluginIssue name="QueryBuilderSetParameter" errorLevel="info"/>
<MissingTemplateParam>
<errorLevel type="suppress">
<directory name="src/Repository"/>
</errorLevel>
</MissingTemplateParam>
</issueHandlers>
</psalm>
4 changes: 3 additions & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ final class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('setono_sylius_analytics');

/** @var ArrayNodeDefinition $rootNode */
$rootNode = $treeBuilder->getRootNode();

$this->addEventsSection($rootNode);
Expand All @@ -54,7 +56,7 @@ private function addEventsSection(ArrayNodeDefinition $node): void

private function addResourcesSection(ArrayNodeDefinition $node): void
{
/** @psalm-suppress MixedMethodCall,PossiblyNullReference,UndefinedInterfaceMethod */
/** @psalm-suppress MixedMethodCall,PossiblyNullReference,PossiblyUndefinedMethod,UndefinedInterfaceMethod */
$node
->children()
->arrayNode('resources')
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 @@ -7,7 +7,6 @@
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Sylius\Bundle\OrderBundle\SyliusOrderBundle::class => ['all' => true],
Sylius\Bundle\MoneyBundle\SyliusMoneyBundle::class => ['all' => true],
Expand Down

0 comments on commit c5f2494

Please sign in to comment.