Skip to content

Commit

Permalink
PHP 8.1 Compatibility (#41)
Browse files Browse the repository at this point in the history
* Unify templated files
  A lot of files are identical throughout the different packages.
  This is the base for unifying them for easier handling.
* Adjust tests path
  Some packages use 'tests' as tests directory, while other use 'Tests'. The reference in phpunit.xml.dist is adjusted accordingly.
* Build: Ignore PHP 5.4 and 5.5
  The images used for tests with these versions have problems with using composer (giving curl error 60), so they are removed for now, until a solution is found.
* Build: Introducing loose and strict code style check
  As some packages irreversibly violate our code style by using underscores in variable and method names, the loose check will let names with underscore pass. This check must pass. The strict check is applied without any exceptions, but allowed to fail, so we still get informed about these violations.
* Build: Check for PHP 8.1 compatibility
  Since the CMS has expressed a need for PHP 8.1 compatible versions of the packages from Framework 1, compatibility should also be tested.
* Tests: Don't use phpunit.xml to provide PHP values
  The phpunit.xml should only specify values that are required by the test environment. Everything that the tests themselves require should be made available via bootstrap.php.
* Tests: Provide separate tests for PHP < 7.1 and PHP 7.1+
  • Loading branch information
nibra authored Jan 25, 2022
1 parent e7e62c6 commit 728ba9e
Show file tree
Hide file tree
Showing 19 changed files with 2,178 additions and 113 deletions.
62 changes: 62 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
build: false
platform:
- x64
clone_folder: C:\projects\filesystem

branches:
except:
- gh-pages

## Build matrix for lowest and highest possible targets
environment:
PHPBuild: "x64"
VC: "vc15"
WINCACHE: "2.0.0.8"
matrix:
- php_ver_target: 5.3.10
- php_ver_target: 5.3.29
- php_ver_target: 5.4.45
- php_ver_target: 7.0.33
- php_ver_target: 7.1.33
- php_ver_target: 7.2.34
- php_ver_target: 7.3.33
- php_ver_target: 7.4.27
- php_ver_target: 8.0.15
- php_ver_target: 8.1.2

init:
- SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH%
- SET COMPOSER_NO_INTERACTION=1
- SET PHP=1 # This var relates to caching the php install
- SET ANSICON=121x90 (121x90)

## Install PHP and composer, and run the appropriate composer command
install:
- IF EXIST C:\tools\php (SET PHP=0)
- ps: >-
If ($env:PHP -eq "1") {
appveyor-retry cinst php --version=$env:php_ver_target --package-parameters='""/InstallDir:C:\tools\php""' --ignore-checksums -y --no-progress --limit-output
}
- cd C:\tools\php
- IF %PHP%==1 copy php.ini-production php.ini /Y
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
- IF %PHP%==1 echo extension_dir=ext >> php.ini
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
- IF %PHP%==1 echo extension=php_ftp.dll >> php.ini
- IF %PHP%==1 echo extension=php_gd2.dll >> php.ini
- IF %PHP%==1 echo extension=php_gmp.dll >> php.ini
- IF %PHP%==1 echo extension=php_pgsql.dll >> php.ini
- IF %PHP%==1 echo extension=php_curl.dll >> php.ini
- IF %PHP%==1 echo zend_extension=php_opcache.dll >> php.ini
- IF %PHP%==1 echo opcache.enable_cli=1 >> php.ini
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- IF %PHP%==1 php -r "readfile('http://getcomposer.org/installer');" | php
- cd C:\projects\filesystem
- IF NOT %php_ver_target%=="8.0.0" composer update --prefer-stable --no-progress
- IF %php_ver_target%=="8.0.0" composer update --prefer-stable --no-progress --ignore-platform-req=php

test_script:
- cd C:\projects\filesystem
- vendor\bin\phpunit
23 changes: 15 additions & 8 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ local composer(phpversion, params) = {
volumes: volumes,
commands: [
"php -v",
"composer --version",
"composer update " + params,
]
};

local phpunit(phpversion) = {
name: "PHPUnit",
image: "joomlaprojects/docker-images:php" + phpversion,
[if phpversion == "8.0" then "failure"]: "ignore",
commands: ["vendor/bin/phpunit"]
};

Expand All @@ -52,17 +50,27 @@ local pipeline(name, phpversion, params) = {
volumes: volumes,
commands: [
"php -v",
"composer update",
"composer update --prefer-stable",
"composer require phpmd/phpmd phpstan/phpstan"
]
},
{
name: "phpcs",
name: "phpcs (loose)",
image: "joomlaprojects/docker-images:php7.4",
depends: [ "composer" ],
commands: [
"vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards",
"vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/"
"vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php"
]
},
{
name: "phpcs (strict)",
image: "joomlaprojects/docker-images:php7.4",
depends: [ "composer" ],
failure: "ignore",
commands: [
"vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards",
"vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/Inflector.php src/Normalise.php src/String.php src/StringHelper.php"
]
},
{
Expand Down Expand Up @@ -126,13 +134,12 @@ local pipeline(name, phpversion, params) = {
]
},
pipeline("5.3", "5.3", "--prefer-stable"),
pipeline("5.4", "5.4", "--prefer-stable"),
pipeline("5.5", "5.5", "--prefer-stable"),
pipeline("5.6", "5.6", "--prefer-stable"),
pipeline("7.0", "7.0", "--prefer-stable"),
pipeline("7.1", "7.1", "--prefer-stable"),
pipeline("7.2", "7.2", "--prefer-stable"),
pipeline("7.3", "7.3", "--prefer-stable"),
pipeline("7.4", "7.4", "--prefer-stable"),
pipeline("8.0", "8.0", "--ignore-platform-reqs --prefer-stable")
pipeline("8.0", "8.0", "--prefer-stable"),
pipeline("8.1", "8.1", "--prefer-stable")
]
Loading

0 comments on commit 728ba9e

Please sign in to comment.