Skip to content

Commit

Permalink
Merge pull request #133 from ashnazg/actions
Browse files Browse the repository at this point in the history
Set up Github Actions builds
  • Loading branch information
ashnazg authored Jan 29, 2024
2 parents de92a08 + b440d25 commit 77b4f33
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 3 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
on:
push:
branches:
- master
pull_request:

jobs:
test:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest ]
php: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]
dependencies: [ 'locked' ]

name: PHP ${{ matrix.php }} on ${{ matrix.operating-system }} with ${{ matrix.dependencies }} dependencies

steps:
- uses: actions/checkout@v2
name: Checkout repository

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- uses: ramsey/composer-install@v1
with:
dependency-versions: ${{ matrix.dependencies }}

- name: Install PEAR
run: |
sudo apt-get --fix-broken install
sudo apt-get install php-pear
pear list
sudo pear channel-update pear
sudo pear upgrade -f pear
sudo pear install text_diff
pear list
pear config-set umask 0022
sudo pear config-set umask 0022 system
- name: Run tests
run: |
umask 0022
sudo pear run-tests --ini=" -d include_path=.:/usr/share/php" -q -d -r ./tests
6 changes: 5 additions & 1 deletion tests/PEAR_Command_Install/upgrade-all/test.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10232,7 +10232,11 @@ $command->run('upgrade-all', array(), array());
$phpunit->assertNoErrors('after upgrade');

$log = array_slice($fakelog->getLog(), 0, 5);
function poop($a, $b) {return strnatcasecmp($a['info']['data'], $b['info']['data']);}
function poop($a, $b) {
if (empty($a['info']['data'])) { $a['info']['data'] = ''; }
if (empty($b['info']['data'])) { $b['info']['data'] = ''; }
return strnatcasecmp($a['info']['data'], $b['info']['data']);
}
usort($log, 'poop');

$phpunit->assertEquals(
Expand Down
7 changes: 7 additions & 0 deletions tests/PEAR_Command_Package/package-validate/test_fail.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if (!getenv('PHP_PEAR_RUNTESTS')) {
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'setup.php.inc';
touch($temp_path . DIRECTORY_SEPARATOR . 'bloob.xml');
$ret = $command->run('package-validate', array(), array($temp_path . DIRECTORY_SEPARATOR . 'bloob.xml'));
/*
if (version_compare(phpversion(), '5.0.0', '>=')) {
if (version_compare(phpversion(), '5.0.3', '>=')) {
$errmsg = 'XML error: Invalid document end at line 1';
Expand All @@ -21,6 +22,12 @@ if (version_compare(phpversion(), '5.0.0', '>=')) {
} else {
$errmsg = 'XML error: no element found at line 1';
}
*/
// Ubuntu used by Github Actions seems to have the above difference backported, mostly
$errmsg = 'XML error: Invalid document end at line 1'; // got this on 5.6 and up
if (version_compare(phpversion(), '5.6.0', '<')) {
$errmsg = 'XML error: no element found at line 1'; // got this on 5.5 & 5.4
}
$phpunit->assertErrors(array(
array('package' => 'PEAR_PackageFile', 'message' => 'package.xml "' .
$temp_path . DIRECTORY_SEPARATOR . 'bloob.xml" has no package.xml <package> version'),
Expand Down
7 changes: 7 additions & 0 deletions tests/PEAR_Command_Package/package/test_fail.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ $phpunit->assertErrors(array(
array('package' => 'PEAR_Error', 'message' => 'Cannot package, errors in package file'),
), 'ret 1');
$phpunit->assertIsa('PEAR_Error', $ret, 'bloob.xml');
/*
if (version_compare(phpversion(), '5.0.0', '>=')) {
if (version_compare(phpversion(), '5.0.3', '>=')) {
$errmsg = 'XML error: Invalid document end at line 1';
Expand All @@ -28,6 +29,12 @@ if (version_compare(phpversion(), '5.0.0', '>=')) {
} else {
$errmsg = 'XML error: no element found at line 1';
}
*/
// Ubuntu used by Github Actions seems to have the above difference backported, mostly
$errmsg = 'XML error: Invalid document end at line 1'; // got this on 5.6 and up
if (version_compare(phpversion(), '5.6.0', '<')) {
$errmsg = 'XML error: no element found at line 1'; // got this on 5.5 & 5.4
}
$phpunit->assertEquals(array (
0 =>
array (
Expand Down
7 changes: 7 additions & 0 deletions tests/PEAR_Command_Package/package/test_fail_multiple.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $phpunit->assertErrors(array(
array('package' => 'PEAR_Error', 'message' => 'Cannot package, errors in second package file'),
), 'ret');
$phpunit->assertIsa('PEAR_Error', $ret, 'bloob.xml');
/*
if (version_compare(phpversion(), '5.0.0', '>=')) {
if (version_compare(phpversion(), '5.0.3', '>=')) {
$errmsg = 'XML error: Invalid document end at line 1';
Expand All @@ -31,6 +32,12 @@ if (version_compare(phpversion(), '5.0.0', '>=')) {
} else {
$errmsg = 'XML error: no element found at line 1';
}
*/
// Ubuntu used by Github Actions seems to have the above difference backported, mostly
$errmsg = 'XML error: Invalid document end at line 1'; // got this on 5.6 and up
if (version_compare(phpversion(), '5.6.0', '<')) {
$errmsg = 'XML error: no element found at line 1'; // got this on 5.5 & 5.4
}
$phpunit->assertEquals(array (
0 =>
array (
Expand Down
8 changes: 8 additions & 0 deletions tests/PEAR_Command_Registry/info/test_fail.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ $phpunit->assertErrors(array(
), '1 params');
touch($temp_path . DIRECTORY_SEPARATOR . 'smong.xml');
$e = $command->run('info', array(), array($temp_path . DIRECTORY_SEPARATOR . 'smong.xml'));
/*
if (version_compare(phpversion(), '5.0.0', '>=')) {
if (version_compare(phpversion(), '5.0.3', '>=')) {
$err = 'Invalid document end';
Expand All @@ -29,6 +30,13 @@ if (version_compare(phpversion(), '5.0.0', '>=')) {
} else {
$err = 'no element found';
}
*/
// Ubuntu used by Github Actions seems to have the above difference backported, mostly
$err = 'Invalid document end'; // got this on 5.6 and up
if (version_compare(phpversion(), '5.6.0', '<')) {
$err = 'no element found'; // got this on 5.5 & 5.4
}

$phpunit->assertErrors(array(
array('package' => 'PEAR_PackageFile', 'message' => 'package.xml "' . $temp_path . DIRECTORY_SEPARATOR . 'smong.xml" has no package.xml <package> version'),
array('package' => 'PEAR_Error', 'message' => "XML error: $err at line 1"),
Expand Down
11 changes: 11 additions & 0 deletions tests/PEAR_Command_Remote/list-all/test_rest_fail.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9389,6 +9389,7 @@ $pearweb->addRESTConfig("http://pear.php.net/rest/p/validate_be/info.xml", '<?xm
<r xlink:href="/rest/r/validate_be"/>
</p>', 'text/xml');
$command->run('list-all', array(), array());
/*
if (version_compare(phpversion(), '5.0.0', 'lt')) {
$phpunit->assertErrors(array(
array('package' => 'PEAR_Error', 'message' => 'The package list could not be fetched from the remote server. Please try again. (Debug info: "Invalid xml downloaded from "http://pear.php.net/rest/p/validate_be/info.xml": XML Error: \'undefined entity\' on line \'17\'")')
Expand All @@ -9398,6 +9399,16 @@ if (version_compare(phpversion(), '5.0.0', 'lt')) {
array('package' => 'PEAR_Error', 'message' => 'The package list could not be fetched from the remote server. Please try again. (Debug info: "Invalid xml downloaded from "http://pear.php.net/rest/p/validate_be/info.xml": XML Error: \'Undeclared entity error\' on line \'17\'")')
), 'errors');
}
*/
// Ubuntu used by Github Actions seems to have the above difference backported, mostly
$message = "XML Error: 'Undeclared entity error' on line '17'"; // got this on 5.6 and up
if (version_compare(phpversion(), '5.6.0', '<')) {
$message = "XML Error: 'undefined entity' on line '17'"; // got this on 5.5. & 5.4
}
$phpunit->assertErrors(array(
array('package' => 'PEAR_Error', 'message' => 'The package list could not be fetched from the remote server. Please try again. (Debug info: "Invalid xml downloaded from "http://pear.php.net/rest/p/validate_be/info.xml": ' . $message . '")')
), 'errors');

$phpunit->assertEquals(array (
0 =>
array (
Expand Down
9 changes: 8 additions & 1 deletion tests/PEAR_Common/test_infoFromString_invalidxml.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ if (!function_exists('token_get_all')) {
<?php
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc';

/*
// 5.2.9 and up has the proper error msg again
$php5 = (version_compare(phpversion(), '5.0.0', '>=') && version_compare(phpversion(), '5.2.8', '<='));

if ($php5) {
$message = 'XML error: Empty document at line 1';
} else {
Expand All @@ -26,6 +26,13 @@ if ($php5) {
$message = 'XML error: Not well-formed (invalid token) at line 1';
}
}
*/
// Ubuntu used by Github Actions seems to have the above difference backported, mostly
$message = 'XML error: Not well-formed (invalid token) at line 1'; // got this on 5.6 and up
if (version_compare(phpversion(), '5.6.0', '<')) {
$message = 'XML error: not well-formed (invalid token) at line 1'; // got this on 5.5 & 5.4
}


$ret = $common->infoFromString('\\goober');
$phpunit->assertErrors(array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ $pathtopackagexml = dirname(__FILE__) . DIRECTORY_SEPARATOR .
$dp = newDownloaderPackage(array());
$phpunit->assertNoErrors('after create');

/*
// 5.2.9 and up has the proper error msg again
$php5 = (version_compare(phpversion(), '5.0.0', '>=') && version_compare(phpversion(), '5.2.8', '<='));
if ($php5) {
Expand All @@ -26,6 +27,12 @@ if ($php5) {
$message = 'XML error: Not well-formed (invalid token) at line 1';
}
}
*/
// Ubuntu used by Github Actions seems to have the above difference backported, mostly
$message = 'XML error: Not well-formed (invalid token) at line 1'; // got this on 5.6 and up
if (version_compare(phpversion(), '5.6.0', '<')) {
$message = 'XML error: not well-formed (invalid token) at line 1'; // got this on 5.5 & 5.4
}

$result = $dp->initialize($pathtopackagexml);
$phpunit->assertErrors(
Expand Down
7 changes: 7 additions & 0 deletions tests/PEAR_PackageFile/v1/Parser/test_invalidxmlparse.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@ if (!getenv('PHP_PEAR_RUNTESTS')) {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc';
$pathtopackagexml = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'package.xml';
$result = &$parser->parse('<xmlbad', PEAR_VALIDATE_NORMAL, $pathtopackagexml);
/*
if (version_compare(phpversion(), '5.0.0', '<')) {
$message = 'XML error: unclosed token at line 1';
} elseif (version_compare(phpversion(), '5.0.3', '<')) {
$message = 'XML error: XML_ERR_GT_REQUIRED at line 1';
} else {
$message = 'XML error: > required at line 1';
}
*/
// Ubuntu used by Github Actions seems to have the above difference backported, mostly
$message = 'XML error: > required at line 1'; // got this on 5.6 and up
if (version_compare(phpversion(), '5.6.0', '<')) {
$message = 'XML error: unclosed token at line 1'; // got this on 5.5 & 5.4
}
$phpunit->assertErrors(array(
'message' => $message,
'package' => 'PEAR_Error',
Expand Down
7 changes: 7 additions & 0 deletions tests/PEAR_Packager/test_fail.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ $phpunit->assertErrors(array(
array('package' => 'PEAR_Error', 'message' => 'Cannot package, errors in package file'),
), 'ret');
$phpunit->assertIsa('PEAR_Error', $ret, 'bloob.xml');
/*
if (version_compare(phpversion(), '5.0.0', '>=')) {
if (version_compare(phpversion(), '5.0.3', '>=')) {
//yeesh, make up your mind, php devs!
Expand All @@ -28,6 +29,12 @@ if (version_compare(phpversion(), '5.0.0', '>=')) {
} else {
$errmsg = 'XML error: no element found at line 1';
}
*/
// Ubuntu used by Github Actions seems to have the above difference backported, mostly
$errmsg = 'XML error: Invalid document end at line 1'; // got this on 5.6 and up
if (version_compare(phpversion(), '5.6.0', '<')) {
$errmsg = 'XML error: no element found at line 1'; // got this on 5.5 & 5.4
}
$phpunit->assertEquals(array (
0 =>
array (
Expand Down
7 changes: 7 additions & 0 deletions tests/PEAR_Packager/test_fail_multiple.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ $phpunit->assertErrors(array(
array('package' => 'PEAR_Error', 'message' => 'Cannot package, errors in second package file'),
), 'ret');
$phpunit->assertIsa('PEAR_Error', $ret, 'bloob.xml');
/*
if (version_compare(phpversion(), '5.0.0', '>=')) {
if (version_compare(phpversion(), '5.0.3', '>=')) {
//yeesh, make up your mind, php devs!
Expand All @@ -31,6 +32,12 @@ if (version_compare(phpversion(), '5.0.0', '>=')) {
} else {
$errmsg = 'XML error: no element found at line 1';
}
*/
// Ubuntu used by Github Actions seems to have the above difference backported, mostly
$errmsg = 'XML error: Invalid document end at line 1'; // got this on 5.6 and up
if (version_compare(phpversion(), '5.6.0', '<')) {
$errmsg = 'XML error: no element found at line 1'; // got this on 5.5 & 5.4
}
$phpunit->assertEquals(array (
0 =>
array (
Expand Down
4 changes: 3 additions & 1 deletion tests/PEAR_RunTest/test_bug10092cookie.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ if (!getenv('PHP_PEAR_RUNTESTS')) {
cookie1=val1 ; cookie2=val2%20; cookie3=val 3.; cookie 4= value 4 %3B; cookie1=bogus; %20cookie1=ignore;+cookie1=ignore;cookie1;cookie 5=%20 value; cookie%206=�;cookie+7=;$cookie.8;cookie-9=1;;;- & % $cookie 10=10
--FILE--
<?php
if (version_compare(PHP_VERSION, '7.2.34') === -1) {
//if (version_compare(PHP_VERSION, '7.2.34') === -1) {
// although behavior is changed only in 7.2.34, test behavior implies that Ubuntu may have backported the cookie fix to 7.1, 7.0, and 5.6
if (version_compare(PHP_VERSION, '5.6.40') === -1) {
$expected = array(
'cookie1'=> 'val1 ',
'cookie2'=> 'val2 ',
Expand Down

0 comments on commit 77b4f33

Please sign in to comment.