Skip to content

Commit

Permalink
Upgrade CI for PHP 8.4 testing (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored Jul 24, 2024
1 parent 8048a55 commit 83e69ae
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 15 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ jobs:
coverage: false
dependency-versions: 'lowest'
tools: 'composer:v2'
phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: disabled

- php-version: '7.4'
coverage: true
dependency-versions: 'highest'
tools: 'composer:v2'
phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

Expand Down Expand Up @@ -64,6 +66,14 @@ jobs:
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.4'
coverage: false
dependency-versions: 'highest'
tools: 'composer:v2'
composer-options: '--ignore-platform-reqs'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

services:
mysql:
image: mysql:5.7
Expand All @@ -85,8 +95,10 @@ jobs:
coverage: pcov
tools: ${{ matrix.tools }}

- name: Remove not required test tooling
run: composer remove "*php-cs-fixer*" "*phpstan*" --no-update --dev
- name: Remove Lint Tools
# These tools are not required to run tests, so we are removing them to improve dependency resolving and
# testing lowest versions.
run: composer remove "*php-cs-fixer*" "*phpstan*" "*rector*" --dev --no-update

- name: Install composer dependencies
uses: ramsey/composer-install@v3
Expand All @@ -98,10 +110,10 @@ jobs:
run: composer bootstrap-test-environment

- name: Execute unit test cases
run: composer test -- Tests/Unit --coverage-php var/coverage.php --coverage-html coverage-report --log-junit var/junit.xml
run: composer test -- Tests/Unit --coverage-php var/coverage.php --coverage-html coverage-report --log-junit var/junit.xml --config ${{ matrix.phpunit-config || 'phpunit.xml.dist' }}

- name: Execute functional test cases
run: composer test -- Tests/Functional --log-junit var/junit.xml
run: composer test -- Tests/Functional --log-junit var/junit.xml --config ${{ matrix.phpunit-config || 'phpunit.xml.dist' }}

- name: Check code coverage
if: ${{ matrix.coverage }}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^9.6",
"phpunit/phpunit": "^9.6 || ^10.0",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.3 || ^7.0",
"symfony/console": "^4.4 || ^5.4 || ^6.3 || ^7.0",
"symfony/dotenv": "^4.4 || ^5.4 || ^6.3 || ^7.0",
Expand Down
21 changes: 21 additions & 0 deletions phpunit-9.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="Tests/test-bootstrap.php">
<testsuites>
<testsuite name="Sulu Headless Bundle">
<directory>Tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory>.</directory>
<exclude>
<directory>vendor</directory>
</exclude>
</whitelist>
</filter>

<php>
<env name="KERNEL_CLASS" value="Sulu\Bundle\HeadlessBundle\Tests\Application\Kernel"/>
</php>
</phpunit>
23 changes: 13 additions & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@
<phpunit colors="true" bootstrap="Tests/test-bootstrap.php">
<testsuites>
<testsuite name="Sulu Headless Bundle">
<directory>Tests</directory>
<directory>./Tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory>.</directory>
<exclude>
<directory>vendor</directory>
</exclude>
</whitelist>
</filter>

<php>
<env name="KERNEL_CLASS" value="Sulu\Bundle\HeadlessBundle\Tests\Application\Kernel"/>
<env name="APP_ENV" value="test" force="true"/>
</php>

<source>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>Resources/</directory>
<directory>Tests/</directory>
<directory>vendor/</directory>
</exclude>
</source>
</phpunit>

0 comments on commit 83e69ae

Please sign in to comment.