Skip to content

Commit 5f4dcec

Browse files
authored
Merge pull request #17 from elbformat/matrix-jobs
Run tests with multiple php/symfony versions
2 parents 81fa509 + 511dd26 commit 5f4dcec

17 files changed

+124
-69
lines changed

.circleci/config.yml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,29 @@ orbs:
99
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
1010
jobs:
1111
build:
12+
parameters: &jobParams
13+
php_version:
14+
type: string
15+
symfony_version:
16+
type: string
17+
monolog_version:
18+
type: string
1219
docker:
13-
- image: 'hgiesenow/php:8.1'
20+
- image: 'hgiesenow/php:<< parameters.php_version >>'
1421
steps:
1522
- checkout
16-
- run: 'composer install --dev'
23+
- run: 'composer require -W symfony/dom-crawler:"^<< parameters.symfony_version >>" symfony/property-access:"^<< parameters.symfony_version >>"; rm composer.lock'
24+
- run: 'composer require --dev -W symfony/framework-bundle:"^<< parameters.symfony_version >>"; rm composer.lock'
25+
- run: 'composer require --dev -W monolog/monolog:"^<< parameters.monolog_version >>"; rm composer.lock'
26+
- run: 'if [ "5.4" == "<< parameters.symfony_version >>" ]; then composer require --dev -W symfony/swiftmailer-bundle:"^3.5"; fi'
1727
- persist_to_workspace:
1828
root: '.'
1929
paths: 'vendor'
2030
phpunit:
31+
parameters:
32+
<<: *jobParams
2133
docker:
22-
- image: 'hgiesenow/php:8.1'
34+
- image: 'hgiesenow/php:<< parameters.php_version >>'
2335
steps:
2436
- checkout
2537
- attach_workspace:
@@ -39,23 +51,39 @@ jobs:
3951
- run: 'vendor/bin/php-cs-fixer fix --diff --dry-run src'
4052
- run: 'vendor/bin/php-cs-fixer fix --diff --dry-run tests'
4153
psalm:
54+
parameters:
55+
<<: *jobParams
4256
docker:
43-
- image: 'hgiesenow/php:8.1'
57+
- image: 'hgiesenow/php:<< parameters.php_version >>'
4458
steps:
4559
- checkout
4660
- attach_workspace:
4761
at: '.'
48-
- run: 'vendor/bin/psalm'
62+
- run: 'if [ "5.4" == "<< parameters.symfony_version >>" ]; then vendor/bin/psalm; else vendor/bin/psalm -c psalm-sf6.xml; fi'
4963

5064
# Invoke jobs via workflows
5165
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
5266
workflows:
5367
test-workflow:
5468
jobs:
55-
- build
69+
- build:
70+
name: 'build/php-<< matrix.php_version >>/sf-<< matrix.symfony_version >>/monolog-<< matrix.monolog_version >>'
71+
matrix:
72+
parameters: &params
73+
php_version: ['8.1','8.2']
74+
symfony_version: ['5.4','6.2']
75+
monolog_version: ['2.6']
5676
- phpunit:
57-
requires: ['build']
77+
name: 'phpunit/php-<< matrix.php_version >>/sf-<< matrix.symfony_version >>/monolog-<< matrix.monolog_version >>'
78+
requires: ['build/php-<< matrix.php_version >>/sf-<< matrix.symfony_version >>/monolog-<< matrix.monolog_version >>']
79+
matrix:
80+
parameters:
81+
<<: *params
5882
- php-cs-fixer:
59-
requires: ['build']
83+
requires: ['build/php-8.1/sf-5.4/monolog-2.6']
6084
- psalm:
61-
requires: ['build']
85+
name: 'psalm/php-<< matrix.php_version >>/sf-<< matrix.symfony_version >>/monolog-<< matrix.monolog_version >>'
86+
requires: ['build/php-<< matrix.php_version >>/sf-<< matrix.symfony_version >>/monolog-<< matrix.monolog_version >>']
87+
matrix:
88+
parameters:
89+
<<: *params

composer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,16 @@
2626
"ext-json": "*",
2727
"behat/behat": "^3.8",
2828
"friends-of-behat/symfony-extension": "^2.2",
29-
"symfony/dom-crawler": "^5.4",
30-
"symfony/property-access": "^5.4"
29+
"symfony/dom-crawler": "^5.4|^6.2",
30+
"symfony/property-access": "^5.4|^6.2"
3131
},
3232
"require-dev": {
3333
"friendsofphp/php-cs-fixer": "^3.3",
3434
"phpunit/phpunit": "^9.5",
3535
"vimeo/psalm": "^4.13",
3636
"monolog/monolog": "^2.6",
37-
"symfony/framework-bundle": "^5.4",
38-
"doctrine/orm": "^2.12",
39-
"symfony/swiftmailer-bundle": "^3.5"
37+
"symfony/framework-bundle": "^5.4|^6.2",
38+
"doctrine/orm": "^2.12"
4039
},
4140
"config": {
4241
"allow-plugins": {

doc/development.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@ vendor/bin/php-cs-fixer fix --diff src
1212
vendor/bin/php-cs-fixer fix --diff tests
1313
# Check code
1414
vendor/bin/psalm
15+
# Enable optional bundles
16+
composer require --dev -W symfony/swiftmailer-bundle:"^3.5"
17+
# Try upgraded monolog version
18+
composer require --dev -W monolog/monolog:"^3.0"
1519
```
1620

21+
22+
1723
Enable xdebug inside the container
1824
```bash
1925
apk add autoconf g++ make

docker/Dockerfile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.1-alpine
1+
FROM php:8.2-alpine
22
# For codecov upload inside circleci
33
RUN apk add gpg gpg-agent gpgv
44
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="true" backupStaticAttributes="false" colors="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" forceCoversAnnotation="false" processIsolation="false" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" stopOnRisky="false" verbose="false">
3-
<coverage processUncoveredFiles="true">
3+
<coverage processUncoveredFiles="false">
44
<include>
55
<directory suffix=".php">src/</directory>
66
</include>

psalm-sf6.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="1"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
>
9+
<projectFiles>
10+
<directory name="src" />
11+
<ignoreFiles>
12+
<directory name="vendor" />
13+
<file name="src/Context/SwiftmailerContext.php" />
14+
<file name="src/Swiftmailer/TestTransport.php" />
15+
<file name="src/DependencyInjection/SwiftmailerCompilerPass.php" />
16+
</ignoreFiles>
17+
</projectFiles>
18+
<issueHandlers>
19+
<MissingDependency>
20+
<errorLevel type="suppress">
21+
<file name="src/DependencyInjection/ElbformatSymfonyBehatExtension.php" />
22+
</errorLevel>
23+
</MissingDependency>
24+
</issueHandlers>
25+
</psalm>

tests/Application/ApplicationFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Application;
3+
namespace Elbformat\SymfonyBehatBundle\Tests\Application;
44

55
use Elbformat\SymfonyBehatBundle\Application\ApplicationFactory;
66
use PHPUnit\Framework\TestCase;

tests/Browser/StateFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Browser;
3+
namespace Elbformat\SymfonyBehatBundle\Tests\Browser;
44

55
use Elbformat\SymfonyBehatBundle\Browser\State;
66
use Elbformat\SymfonyBehatBundle\Browser\StateFactory;

tests/Browser/StateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Browser;
3+
namespace Elbformat\SymfonyBehatBundle\Tests\Browser;
44

55
use Elbformat\SymfonyBehatBundle\Browser\State;
66
use PHPUnit\Framework\TestCase;

tests/BundleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function testBuild(): void
1919
{
2020
$bundle = new ElbformatSymfonyBehatBundle();
2121
$container = $this->createMock(ContainerBuilder::class);
22-
$container->expects($this->exactly(2))->method('addCompilerPass')->withConsecutive([$this->isInstanceOf(MonologCompilerPass::class)], [$this->isInstanceOf(SwiftmailerCompilerPass::class)])->willReturn(null);
22+
$container->expects($this->exactly(2))->method('addCompilerPass')->withConsecutive([$this->isInstanceOf(MonologCompilerPass::class)], [$this->isInstanceOf(SwiftmailerCompilerPass::class)]);
2323
$bundle->build($container);
2424
}
2525
}

0 commit comments

Comments
 (0)