Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH Actions: run tests against PHP 8.1 and other tweaks #172

Merged
merged 8 commits into from Aug 8, 2021

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Aug 8, 2021

This is largely the same PR as pulled in paragonie/sodium_compat#135

Commit details

GH Actions: ubuntu-16.04 is no longer supported

... use ubuntu-18.04 or ubuntu-latest for 20.04 instead.

Also see:

GH Actions: explicitly set code coverage to none

As no code coverage is being recorded for these builds, it is good practice to explicitly set coverage: none in setup-php.
This fixes a warning on PHP 5.3 stating that Xdebug is on.

GH Actions: enable Composer caching

... by using the ramsey/composer-install action.

This means that the Composer downloads directory for dependencies will be cached and restored on each build. This conserves resources and should also make builds faster.

Ref: https://github.com/marketplace/actions/install-composer-dependencies

GH Actions: split off Psalm to separate workflow

Psalm does not need to be run against multiple PHP versions. Running it once should be enough.

With that in mind, this commit:

  • Introduces a separate, dedicated workflow which only installs and runs Psalm.
  • Removes the Psalm related steps from the CI workflow.
  • Removes Psalm from the tools setting for setup-php.

GH Actions: clean up running of the tests

In contrast to Sodium Compat, the tests for this package were running on the low PHP versions.

However, the point remains that 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.

This simplifies the script and ensures that the tests are always run against the most appropriate PHPUnit version for the PHP version against which the tests are being run, by:

  • 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 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.

GH Actions: merge "moderate" and "modern" jobs

As there is now effectively no difference anymore between the moderate and modern jobs, these jobs can now be merged into one.

GH Actions: set error reporting to -1

The default setting for error_reporting used by the SetupPHP action is error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT and display_errors is set to Off.

For the purposes of CI, I'd recommend running with -1 and display_errors=On to ensure all PHP notices are shown.

Ref: shivammathur/setup-php#469

GH Actions: enable testing against PHP 8.1

For now, this build is still allowed to fail.

As no code coverage is being recorded for these builds, it is good practice to explicitly set `coverage: none` in `setup-php`.
This fixes a warning on PHP 5.3 stating that Xdebug is on.
... by using the `ramsey/composer-install` action.

This means that the Composer downloads directory for dependencies will be cached and restored on each build. This conserves resources and should also make builds faster.

Ref: https://github.com/marketplace/actions/install-composer-dependencies
Psalm does not need to be run against multiple PHP versions. Running it once should be enough.

With that in mind, this commit:
* Introduces a separate, dedicated workflow which only installs and runs Psalm.
* Removes the Psalm related steps from the `CI` workflow.
* Removes Psalm from the `tools` setting for `setup-php`.
In contrast to Sodium Compat, the tests for this package _were_ running on the low PHP versions.

However, the point remains that 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.

This simplifies the script and ensures that the tests are always run against the most appropriate PHPUnit version for the PHP version against which the tests are being run, by:
* 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 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.
As there is now effectively no difference anymore between the `moderate` and `modern` jobs, these jobs can now be merged into one.
The default setting for `error_reporting` used by the SetupPHP action is `error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT` and `display_errors` is set to `Off`.

For the purposes of CI, I'd recommend running with `E_ALL` and `display_errors=On` to ensure **all** PHP notices are shown.

Ref: shivammathur/setup-php#469
For now, this build is still allowed to fail.
@glensc
Copy link
Contributor

glensc commented Aug 8, 2021

massive description! 🙇‍♂️

@paragonie-security paragonie-security merged commit 73f1f02 into paragonie:master Aug 8, 2021
@jrfnl jrfnl deleted the feature/ghactions-fix-it branch August 8, 2021 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants