Skip to content

Commit 8d554c2

Browse files
authored
Update test matrix to cover multiple PHP versions (#20)
1 parent e47f44a commit 8d554c2

5 files changed

Lines changed: 22 additions & 29 deletions

File tree

.github/workflows/dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
pull_request:
1111

1212
env:
13-
PHP_VERSION: 7.2
13+
PHP_VERSION: 8.1
1414

1515
jobs:
1616
composer-require-checker:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

3-
sed --in-place --regexp-extended --expression='s/"(symfony\/.*)": "\^.*"/"\1": "'$VERSION'"/' composer.json
3+
cat <<< $(jq --arg version $VERSION '.require |= with_entries(if ((.key|test("^symfony/service-contracts")|not) and (.key|test("^symfony/"))) then .value=$version else . end)' < composer.json) > composer.json

.github/workflows/tests.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88

99
env:
1010
SYMFONY_DEPRECATIONS_HELPER: weak
11-
PHP_VERSION: 7.2
1211

1312
jobs:
1413
PHPUnit:
@@ -18,27 +17,25 @@ jobs:
1817
fail-fast: false
1918
matrix:
2019
include:
21-
- { symfony-locked-version: none, dependency-version: prefer-lowest }
22-
- { symfony-locked-version: none, dependency-version: prefer-stable }
23-
- { symfony-locked-version: 3.4.*, dependency-version: prefer-stable }
24-
- { symfony-locked-version: 4.4.*, dependency-version: prefer-stable }
25-
name: PHPUnit (Symfony Version Lock ${{ matrix.symfony-locked-version }}, ${{ matrix.dependency-version }})
20+
- { php-version: 7.2, symfony-locked-version: none, dependency-version: prefer-lowest }
21+
- { php-version: 7.2, symfony-locked-version: 3.4.*, dependency-version: prefer-stable }
22+
- { php-version: 7.4, symfony-locked-version: 4.4.*, dependency-version: prefer-stable }
23+
- { php-version: 8.1, symfony-locked-version: none, dependency-version: prefer-stable }
24+
name: PHPUnit (PHP ${{matrix.php-version}}, Symfony Version Lock ${{ matrix.symfony-locked-version }}, ${{ matrix.dependency-version }})
2625
steps:
2726
- uses: actions/checkout@v2
2827
- uses: shivammathur/setup-php@v2
2928
with:
30-
php-version: ${{ env.PHP_VERSION }}
29+
php-version: ${{ matrix.php-version }}
3130
tools: composer:v2
3231
- uses: actions/cache@v2
3332
with:
3433
path: vendor
35-
key: composer-${{ runner.os }}-${{ env.PHP_VERSION }}-${{ matrix.symfony-locked-version }}-${{ matrix.dependency-version }}-${{ hashFiles('composer.json') }}
34+
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.symfony-locked-version }}-${{ matrix.dependency-version }}-${{ hashFiles('composer.json') }}
3635
restore-keys: |
37-
composer-${{ runner.os }}-${{ env.PHP_VERSION }}-${{ matrix.symfony-locked-version }}-${{ matrix.dependency-version }}-
36+
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.symfony-locked-version }}-${{ matrix.dependency-version }}-
3837
- run: VERSION=${{ matrix.symfony-locked-version }} .github/workflows/lock-symfony-version.sh
3938
if: matrix.symfony-locked-version != 'none'
40-
- run: composer update --${{ matrix.dependency-version }} --no-interaction --no-scripts --no-progress --prefer-dist
39+
- run: composer update --${{ matrix.dependency-version }} --no-interaction --no-scripts --no-progress --ansi
4140
- run: composer show
4241
- run: vendor/bin/phpunit
43-
- uses: lhotari/action-upterm@v1
44-
if: failure()

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
},
1818

1919
"require-dev": {
20-
"phpunit/phpunit": "^7.0|^8.0|^9.0",
20+
"phpunit/phpunit": "^8.5|^9.5",
2121
"symfony/expression-language": "^3.4.11|^4.0|^5.0",
22-
"symfony/framework-bundle": "^3.4.11|^4.0|^5.0",
23-
"symfony/phpunit-bridge": "*",
22+
"symfony/framework-bundle": "^3.4.23|^4.2.4|^5.0",
23+
"symfony/phpunit-bridge": ">= 6.0",
2424
"symfony/routing": "^3.4.11|^4.0|^5.0",
2525
"symfony/templating": "^3.4.11|^4.0|^5.0",
2626
"symfony/twig-bundle": "^3.4.11|^4.0|^5.0",

phpunit.xml.dist

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.7/phpunit.xsd"
5-
bootstrap="vendor/autoload.php">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.7/phpunit.xsd"
5+
bootstrap="vendor/autoload.php">
66

77
<php>
8-
<server name="KERNEL_CLASS" value="\Webfactory\ShortcodeBundle\Tests\Fixtures\TestKernel" />
8+
<env name="SHELL_VERBOSITY" value="-1" />
9+
<server name="KERNEL_CLASS" value="\Webfactory\ShortcodeBundle\Tests\Fixtures\TestKernel" />
910
</php>
1011

1112
<testsuites>
1213
<testsuite name="Project Test Suite">
13-
<directory>Tests</directory>
14+
<directory>tests</directory>
1415
</testsuite>
1516
</testsuites>
1617

17-
<!-- Filter for code coverage -->
1818
<filter>
1919
<whitelist processUncoveredFilesFromWhitelist="true">
20-
<directory suffix=".php">./</directory>
21-
<exclude>
22-
<directory>vendor</directory>
23-
<directory>Tests</directory>
24-
</exclude>
20+
<directory suffix=".php">src</directory>
2521
</whitelist>
2622
</filter>
2723

0 commit comments

Comments
 (0)