Skip to content

Commit

Permalink
GH Actions: fix running of the tests
Browse files Browse the repository at this point in the history
While the builds currently all show "green", if you actually fold out the "PHPUnit Tests" step, you can see that the tests haven't actually been running on PHP 5.3, 5.4, 5.5, 5.6.

As of PHP 7.0, they have been running, but running against a mismatched PHPUnit version as all test runs are run against PHPUnit 9.5.x, while PHPUnit 9.5 is officially only supported on PHP 7.3 and higher.

Additionally, PHPUnit was being installed 3 (!) times, once via the `setup-php` action, once via the `composer install` and once via the `php-actions/phpunit` action.

To ensure that the tests are always run against the most appropriate PHPUnit version for the PHP version against which the tests are being run, I propose to:
* Remove the installing of PHPUnit via `setup-php`.
* Remove the use of the `php-actions/phpunit` action.
* Defer to the Composer installed PHPUnit version in all cases.

I'm also removing the explicit ini settings for the "moderate" and "modern" jobs.
These look like they were copied over from example code, but these values don't have any effect on the test runs in these workflows, so may as well be removed.

For the "low" job, however, having some ini values set prevents the tests erroring out too quickly.
  • Loading branch information
jrfnl committed Aug 8, 2021
1 parent b93e378 commit e4fd0db
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
matrix:
operating-system: ['ubuntu-18.04']
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0']
phpunit-versions: ['7.5.20']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -20,8 +19,7 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl
ini-values: post_max_size=256M, max_execution_time=180
tools: phpunit:${{ matrix.phpunit-versions }}
ini-values: max_execution_time=600, memory_limit=256M
coverage: none

- name: Use Composer 1.x
Expand All @@ -31,9 +29,7 @@ jobs:
uses: "ramsey/composer-install@v1"

- name: PHPUnit tests
uses: php-actions/phpunit@v2
with:
memory_limit: 256M
run: vendor/bin/phpunit

moderate:
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
Expand All @@ -42,7 +38,6 @@ jobs:
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['7.1', '7.2', '7.3']
phpunit-versions: ['latest']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -52,18 +47,13 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, sodium
ini-values: post_max_size=256M, max_execution_time=180
tools: phpunit:${{ matrix.phpunit-versions }}
coverage: none

- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"

- name: PHPUnit tests
uses: php-actions/phpunit@v2
timeout-minutes: 30
with:
memory_limit: 256M
run: vendor/bin/phpunit

modern:
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
Expand All @@ -72,7 +62,6 @@ jobs:
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['7.4', '8.0']
phpunit-versions: ['latest']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -82,15 +71,10 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, sodium
ini-values: post_max_size=256M, max_execution_time=180
tools: phpunit:${{ matrix.phpunit-versions }}
coverage: none

- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"

- name: PHPUnit tests
uses: php-actions/phpunit@v2
timeout-minutes: 30
with:
memory_limit: 256M
run: vendor/bin/phpunit

0 comments on commit e4fd0db

Please sign in to comment.