Skip to content

Commit 50becf4

Browse files
authored
Merge pull request #53 from JanPalen/feature/OP-359-update-build
Feature/op 359 update build
2 parents 5e78ef6 + e394afa commit 50becf4

29 files changed

+277
-157
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,30 @@ on:
88
release:
99
types: [created]
1010
schedule:
11-
-
12-
cron: "0 1 * * 6" # Run at 1am every Saturday
11+
- cron: "0 1 * * 6" # Run at 1am every Saturday
1312
workflow_dispatch: ~
1413

1514
jobs:
1615
tests:
1716
runs-on: ubuntu-latest
18-
17+
1918
name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}"
20-
19+
2120
strategy:
2221
fail-fast: false
2322
matrix:
24-
php: [8.0, 8.1, 8.2, 8.3]
25-
symfony: [^5.4, ^6.0]
26-
sylius: [~1.12.0, ~1.13.0]
27-
node: [18.x, 20.x]
28-
mysql: [5.7, 8.0]
29-
23+
php: [ "8.0", "8.1", "8.2", "8.3" ]
24+
symfony: [ "^5.4", "^6.4" ]
25+
sylius: [ "^1.12", "^1.13" ]
26+
node: [ "18.x", "20.x" ]
27+
mysql: [ "8.0" ]
28+
3029
exclude:
31-
- sylius: "~1.13.0"
32-
php: "8.0"
30+
- sylius: ^1.13
31+
php: 8.0
32+
- sylius: ^1.12
33+
php: 8.0
34+
symfony: ^6.4
3335

3436
env:
3537
APP_ENV: test
@@ -84,25 +86,23 @@ jobs:
8486
-
8587
name: Get Composer cache directory
8688
id: composer-cache
87-
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
89+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
8890

8991
-
9092
name: Cache Composer
91-
uses: actions/cache@v2
93+
uses: actions/cache@v4
9294
with:
9395
path: ${{ steps.composer-cache.outputs.dir }}
9496
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
9597
restore-keys: |
9698
${{ runner.os }}-php-${{ matrix.php }}-composer-
97-
9899
-
99100
name: Restrict Symfony version
100101
if: matrix.symfony != ''
101102
run: |
102103
composer global config --no-plugins allow-plugins.symfony/flex true
103104
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
104105
composer config extra.symfony.require "${{ matrix.symfony }}"
105-
106106
-
107107
name: Restrict Sylius version
108108
if: matrix.sylius != ''
@@ -111,21 +111,22 @@ jobs:
111111
-
112112
name: Install PHP dependencies
113113
run: composer install --no-interaction
114+
env:
115+
SYMFONY_REQUIRE: ${{ matrix.symfony }}
114116

115117
-
116118
name: Get Yarn cache directory
117119
id: yarn-cache
118-
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
120+
run: echo "::set-output name=dir::$(yarn cache dir)"
119121

120122
-
121123
name: Cache Yarn
122-
uses: actions/cache@v2
124+
uses: actions/cache@v4
123125
with:
124126
path: ${{ steps.yarn-cache.outputs.dir }}
125127
key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
126128
restore-keys: |
127129
${{ runner.os }}-node-${{ matrix.node }}-yarn-
128-
129130
-
130131
name: Install JS dependencies
131132
run: (cd tests/Application && yarn install)
@@ -135,13 +136,11 @@ jobs:
135136
run: |
136137
(cd tests/Application && bin/console doctrine:database:create -vvv)
137138
(cd tests/Application && bin/console doctrine:schema:create -vvv)
138-
139139
-
140140
name: Prepare test application assets
141141
run: |
142142
(cd tests/Application && bin/console assets:install public -vvv)
143143
(cd tests/Application && yarn encore dev)
144-
145144
-
146145
name: Prepare test application cache
147146
run: (cd tests/Application && bin/console cache:warmup -vvv)
@@ -158,30 +157,25 @@ jobs:
158157
name: Validate database schema
159158
run: (cd tests/Application && bin/console doctrine:schema:validate)
160159

161-
-
162-
name: Run PHPStan
163-
run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/
164-
165-
# TODO: Temporary disabled!
166-
# -
167-
# name: Run Psalm
168-
# run: vendor/bin/psalm
169-
170160
-
171161
name: Run PHPSpec
172162
run: vendor/bin/phpspec run --ansi -f progress --no-interaction
173163

174-
# -
175-
# name: Run PHPUnit
176-
# run: vendor/bin/phpunit --colors=always
164+
-
165+
name: Run PHPUnit
166+
run: vendor/bin/phpunit --colors=always
167+
168+
-
169+
name: Create behat logs directory
170+
run: (mkdir -p etc/build && chmod a+rw etc/build )
177171

178172
-
179173
name: Run Behat
180174
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun
181175

182176
-
183177
name: Upload Behat logs
184-
uses: actions/upload-artifact@v2
178+
uses: actions/upload-artifact@v3
185179
if: failure()
186180
with:
187181
name: Behat logs

.github/workflows/coding_standard.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Coding standard
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'dependabot/**'
7+
pull_request: ~
8+
release:
9+
types: [ created ]
10+
workflow_dispatch: ~
11+
12+
jobs:
13+
tests:
14+
runs-on: ubuntu-latest
15+
16+
name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}"
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
php: [ "8.0", "8.1", "8.2", "8.3" ]
22+
symfony: [ "^5.4", "^6.4" ]
23+
sylius: [ "^1.12", "^1.13" ]
24+
node: [ "18.x", "20.x" ]
25+
26+
exclude:
27+
- sylius: ^1.13
28+
php: 8.0
29+
- sylius: ^1.12
30+
php: 8.0
31+
symfony: ^6.4
32+
33+
steps:
34+
- uses: actions/checkout@v3
35+
36+
- name: Setup PHP
37+
uses: shivammathur/setup-php@v2
38+
with:
39+
php-version: "${{ matrix.php }}"
40+
extensions: intl
41+
tools: symfony
42+
coverage: none
43+
44+
- name: Get Composer cache directory
45+
id: composer-cache
46+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
47+
48+
- name: Cache Composer
49+
uses: actions/cache@v4
50+
with:
51+
path: ${{ steps.composer-cache.outputs.dir }}
52+
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json', '**/composer.lock') }}
53+
restore-keys: |
54+
${{ runner.os }}-php-${{ matrix.php }}-composer-
55+
56+
- name: Restrict Symfony version
57+
if: matrix.symfony != ''
58+
run: |
59+
composer global config --no-plugins allow-plugins.symfony/flex true
60+
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10"
61+
composer config extra.symfony.require "${{ matrix.symfony }}"
62+
63+
- name: Restrict Sylius version
64+
if: matrix.sylius != ''
65+
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction
66+
67+
- name: Install PHP dependencies
68+
run: composer install --no-interaction
69+
env:
70+
SYMFONY_REQUIRE: ${{ matrix.symfony }}
71+
72+
- name: Run PHPStan
73+
run: vendor/bin/phpstan analyse -c phpstan.neon -l 8 src/
74+
75+
- name: Run ECS
76+
run: vendor/bin/ecs check src
77+
78+
- name: Failed build Slack notification
79+
uses: rtCamp/action-slack-notify@v2
80+
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
81+
env:
82+
SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }}
83+
SLACK_COLOR: ${{ job.status }}
84+
SLACK_ICON: https://github.com/rtCamp.png?size=48
85+
SLACK_MESSAGE: ':x:'
86+
SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository
87+
SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }}
88+
SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99

1010
/behat.yml
1111
/phpspec.yml
12+
/phpunit.xml

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"behat/behat": "^3.7",
1313
"behat/mink-selenium2-driver": "~1.6.0",
1414
"symfony/webpack-encore-bundle": "^1.15",
15-
"bitbag/coding-standard": "^1.0.1 || ^2.0.0",
15+
"bitbag/coding-standard": "^3.0",
1616
"dmore/behat-chrome-extension": "^1.3",
1717
"dmore/chrome-mink-driver": "^2.7",
1818
"friends-of-behat/mink": "^1.8",
@@ -36,7 +36,6 @@
3636
"symfony/dotenv": "^5.4 || ^6.0",
3737
"symfony/intl": "^5.4 || ^6.0",
3838
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
39-
"vimeo/psalm": "4.7.1 || ^5.0.0",
4039
"polishsymfonycommunity/symfony-mocker-container": "^1.0"
4140
},
4241
"conflict": {

ecs.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,12 @@
22

33
declare(strict_types=1);
44

5-
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
6-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
7-
use Symplify\EasyCodingStandard\ValueObject\Option;
8-
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
5+
use Symplify\EasyCodingStandard\Config\ECSConfig;
96

10-
return static function (ContainerConfigurator $containerConfigurator): void {
11-
$containerConfigurator->import('vendor/bitbag/coding-standard/ecs.php');
12-
$services = $containerConfigurator->services();
13-
$services->set(ArraySyntaxFixer::class)
14-
->call('configure', [[
15-
'syntax' => 'short',
16-
]]);
7+
return static function (ECSConfig $config): void {
178

18-
$parameters = $containerConfigurator->parameters();
19-
$parameters->set(Option::PATHS, [
20-
__DIR__ . '/src',
21-
__DIR__ . '/tests',
22-
]);
9+
putenv('ALLOW_BITBAG_OS_HEADER=1');
10+
11+
$config->import('vendor/bitbag/coding-standard/ecs.php');
12+
$config->paths(['src', 'tests']);
2313
};

phpunit.xml.dist

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
cacheResultFile=".phpunit.cache/test-results"
6+
executionOrder="depends,defects"
7+
forceCoversAnnotation="true"
8+
beStrictAboutCoversAnnotation="true"
9+
beStrictAboutOutputDuringTests="true"
10+
beStrictAboutTodoAnnotatedTests="true"
11+
convertDeprecationsToExceptions="true"
12+
failOnRisky="true"
13+
failOnWarning="true"
14+
verbose="true">
15+
<testsuites>
16+
<testsuite name="default">
17+
<directory>tests</directory>
18+
</testsuite>
19+
</testsuites>
20+
21+
<coverage cacheDirectory=".phpunit.cache/code-coverage"
22+
processUncoveredFiles="true">
23+
<include>
24+
<directory suffix=".php">src</directory>
25+
</include>
26+
</coverage>
27+
</phpunit>

src/BitBagSyliusShippingExportPlugin.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
4+
* This file has been created by developers from BitBag.
5+
* Feel free to contact us once you face any issues or want to start
6+
* You can find more information about us on https://bitbag.io and write us
7+
* an email on hello@bitbag.io.
8+
*/
89

910
declare(strict_types=1);
1011

src/Context/ShippingGatewayContext.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
4+
* This file has been created by developers from BitBag.
5+
* Feel free to contact us once you face any issues or want to start
6+
* You can find more information about us on https://bitbag.io and write us
7+
* an email on hello@bitbag.io.
8+
*/
89

910
declare(strict_types=1);
1011

@@ -36,7 +37,7 @@ public function __construct(
3637
RequestStack $requestStack,
3738
FormTypeRegistryInterface $shippingGatewayFormTypeRegistry,
3839
ShippingGatewayRepositoryInterface $shippingGatewayRepository,
39-
array $shippingGateways
40+
array $shippingGateways,
4041
) {
4142
$this->requestStack = $requestStack;
4243
$this->shippingGatewayFormTypeRegistry = $shippingGatewayFormTypeRegistry;
@@ -68,7 +69,7 @@ public function getCode(): ?string
6869
if (false === $this->shippingGatewayFormTypeRegistry->has('shipping_gateway_config', $code)) {
6970
throw new ShippingGatewayNotFoundException(sprintf(
7071
'Gateway with %s code could not be found',
71-
$code
72+
$code,
7273
));
7374
}
7475

@@ -93,7 +94,7 @@ private function getExistingShippingGateway(int $id): ShippingGatewayInterface
9394
if (false === $shippingGateway instanceof ShippingGatewayInterface) {
9495
throw new ShippingGatewayNotFoundException(sprintf(
9596
'Gateway with %d id could not be found in the database.',
96-
$id
97+
$id,
9798
));
9899
}
99100

src/Context/ShippingGatewayContextInterface.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22

33
/*
4-
* This file was created by developers working at BitBag
5-
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
6-
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7-
*/
4+
* This file has been created by developers from BitBag.
5+
* Feel free to contact us once you face any issues or want to start
6+
* You can find more information about us on https://bitbag.io and write us
7+
* an email on hello@bitbag.io.
8+
*/
89

910
declare(strict_types=1);
1011

0 commit comments

Comments
 (0)