Skip to content

Commit 2a2fee9

Browse files
authored
Unification (#102)
* 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: Add bootstrap.php The tests rely on JPATH_ROOT being defined. * Tests: Avoid inspection of implementation details * Tests: Fix tests for PHP 5.3 and 8.1
1 parent 181ef5a commit 2a2fee9

16 files changed

+771
-759
lines changed

.appveyor.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
build: false
2+
platform:
3+
- x64
4+
clone_folder: C:\projects\filesystem
5+
6+
branches:
7+
except:
8+
- gh-pages
9+
10+
## Build matrix for lowest and highest possible targets
11+
environment:
12+
PHPBuild: "x64"
13+
VC: "vc15"
14+
WINCACHE: "2.0.0.8"
15+
matrix:
16+
- php_ver_target: 5.3.10
17+
- php_ver_target: 5.3.29
18+
- php_ver_target: 5.4.45
19+
- php_ver_target: 7.0.33
20+
- php_ver_target: 7.1.33
21+
- php_ver_target: 7.2.34
22+
- php_ver_target: 7.3.33
23+
- php_ver_target: 7.4.27
24+
- php_ver_target: 8.0.15
25+
- php_ver_target: 8.1.2
26+
27+
init:
28+
- SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH%
29+
- SET COMPOSER_NO_INTERACTION=1
30+
- SET PHP=1 # This var relates to caching the php install
31+
- SET ANSICON=121x90 (121x90)
32+
33+
## Install PHP and composer, and run the appropriate composer command
34+
install:
35+
- IF EXIST C:\tools\php (SET PHP=0)
36+
- ps: >-
37+
If ($env:PHP -eq "1") {
38+
appveyor-retry cinst php --version=$env:php_ver_target --package-parameters='""/InstallDir:C:\tools\php""' --ignore-checksums -y --no-progress --limit-output
39+
}
40+
- cd C:\tools\php
41+
- IF %PHP%==1 copy php.ini-production php.ini /Y
42+
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
43+
- IF %PHP%==1 echo extension_dir=ext >> php.ini
44+
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
45+
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
46+
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
47+
- IF %PHP%==1 echo extension=php_ftp.dll >> php.ini
48+
- IF %PHP%==1 echo extension=php_gd2.dll >> php.ini
49+
- IF %PHP%==1 echo extension=php_gmp.dll >> php.ini
50+
- IF %PHP%==1 echo extension=php_pgsql.dll >> php.ini
51+
- IF %PHP%==1 echo extension=php_curl.dll >> php.ini
52+
- IF %PHP%==1 echo zend_extension=php_opcache.dll >> php.ini
53+
- IF %PHP%==1 echo opcache.enable_cli=1 >> php.ini
54+
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
55+
- IF %PHP%==1 php -r "readfile('http://getcomposer.org/installer');" | php
56+
- cd C:\projects\filesystem
57+
- IF NOT %php_ver_target%=="8.0.0" composer update --prefer-stable --no-progress
58+
- IF %php_ver_target%=="8.0.0" composer update --prefer-stable --no-progress --ignore-platform-req=php
59+
60+
test_script:
61+
- cd C:\projects\filesystem
62+
- vendor\bin\phpunit

.drone.jsonnet

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ local composer(phpversion, params) = {
1818
volumes: volumes,
1919
commands: [
2020
"php -v",
21-
"composer update " + params
21+
"composer update " + params,
2222
]
2323
};
2424

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

@@ -51,14 +50,24 @@ local pipeline(name, phpversion, params) = {
5150
volumes: volumes,
5251
commands: [
5352
"php -v",
54-
"composer update",
53+
"composer update --prefer-stable",
5554
"composer require phpmd/phpmd phpstan/phpstan"
5655
]
5756
},
5857
{
59-
name: "phpcs",
58+
name: "phpcs (loose)",
6059
image: "joomlaprojects/docker-images:php7.4",
6160
depends: [ "composer" ],
61+
commands: [
62+
"vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards",
63+
"vendor/bin/phpcs -p --report=full --extensions=php --standard=ruleset.xml src/"
64+
]
65+
},
66+
{
67+
name: "phpcs (strict)",
68+
image: "joomlaprojects/docker-images:php7.4",
69+
depends: [ "composer" ],
70+
failure: "ignore",
6271
commands: [
6372
"vendor/bin/phpcs --config-set installed_paths vendor/joomla/coding-standards",
6473
"vendor/bin/phpcs -p --report=full --extensions=php --standard=Joomla src/"
@@ -106,15 +115,31 @@ local pipeline(name, phpversion, params) = {
106115
}
107116
]
108117
},
109-
pipeline("5.3 lowest", "5.3", "--prefer-stable --prefer-lowest"),
118+
{
119+
kind: "pipeline",
120+
name: "PHP 5.3 lowest",
121+
volumes: hostvolumes,
122+
steps: [
123+
{
124+
name: "composer",
125+
image: "joomlaprojects/docker-images:php5.3",
126+
volumes: volumes,
127+
commands: [
128+
"php -v",
129+
"composer update --prefer-stable --prefer-lowest",
130+
"composer update phpunit/phpunit-mock-objects"
131+
]
132+
},
133+
phpunit("5.3")
134+
]
135+
},
110136
pipeline("5.3", "5.3", "--prefer-stable"),
111-
pipeline("5.4", "5.4", "--prefer-stable"),
112-
pipeline("5.5", "5.5", "--prefer-stable"),
113137
pipeline("5.6", "5.6", "--prefer-stable"),
114138
pipeline("7.0", "7.0", "--prefer-stable"),
115139
pipeline("7.1", "7.1", "--prefer-stable"),
116140
pipeline("7.2", "7.2", "--prefer-stable"),
117141
pipeline("7.3", "7.3", "--prefer-stable"),
118142
pipeline("7.4", "7.4", "--prefer-stable"),
119-
pipeline("8.0", "8.0", "--ignore-platform-reqs")
143+
pipeline("8.0", "8.0", "--prefer-stable"),
144+
pipeline("8.1", "8.1", "--prefer-stable")
120145
]

0 commit comments

Comments
 (0)