mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
commit
8489dbf4de
2
.github/workflows/experimental-workflow.yml
vendored
2
.github/workflows/experimental-workflow.yml
vendored
@ -30,8 +30,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Setup Node.js 12.x
|
- name: Setup Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
|
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
@ -28,8 +28,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Setup Node.js 12.x
|
- name: Setup Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg"></a>
|
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
Setup PHP with required extensions, php.ini configuration, code-coverage support and tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross platform interface to setup the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
|
Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross platform interface to setup the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
|
||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
|
|
||||||
These tools can be setup globally using the `tools` input.
|
These tools can be setup globally using the `tools` input.
|
||||||
|
|
||||||
`codeception`, `composer`, `composer-prefetcher`, `deployer`, `pecl`, `phinx`, `phpcbf`, `phpcpd`, `php-cs-fixer`, `phpcs`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`
|
`codeception`, `composer`, `composer-prefetcher`, `deployer`, `pecl`, `phinx`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v1
|
uses: shivammathur/setup-php@v1
|
||||||
|
@ -30,10 +30,7 @@ describe('Extension tests', () => {
|
|||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(linux).toContain(
|
expect(linux).toContain('update_extension xdebug 2.9.0');
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-xdebug'
|
|
||||||
);
|
|
||||||
expect(linux).toContain('pecl install xdebug');
|
|
||||||
expect(linux).toContain(
|
expect(linux).toContain(
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
|
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
|
||||||
);
|
);
|
||||||
@ -94,6 +91,9 @@ describe('Extension tests', () => {
|
|||||||
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install xdebug-2.5.5');
|
expect(darwin).toContain('sudo pecl install xdebug-2.5.5');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
|
||||||
|
expect(darwin).toContain('sudo pecl install xdebug-2.9.0');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install xdebug');
|
expect(darwin).toContain('sudo pecl install xdebug');
|
||||||
|
|
||||||
|
@ -239,6 +239,35 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain('Platform fedora is not supported');
|
expect(script).toContain('Platform fedora is not supported');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking addDevTools', async () => {
|
||||||
|
let script: string = await tools.addDevTools('phpize', 'linux');
|
||||||
|
expect(script).toContain('add_devtools');
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('php-config', 'linux');
|
||||||
|
expect(script).toContain('add_devtools');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('phpize', 'darwin');
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('php-config', 'darwin');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('phpize', 'win32');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Log "$cross" "phpize" "phpize is not a windows tool"'
|
||||||
|
);
|
||||||
|
|
||||||
|
script = await tools.addDevTools('php-config', 'win32');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Log "$cross" "php-config" "php-config is not a windows tool"'
|
||||||
|
);
|
||||||
|
|
||||||
|
script = await tools.addDevTools('tool', 'fedora');
|
||||||
|
expect(script).toContain('Platform fedora is not supported');
|
||||||
|
});
|
||||||
|
|
||||||
it('checking addPackage', async () => {
|
it('checking addPackage', async () => {
|
||||||
let script: string = await tools.addPackage(
|
let script: string = await tools.addPackage(
|
||||||
'tool',
|
'tool',
|
||||||
@ -260,7 +289,7 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it('checking addTools on linux', async () => {
|
it('checking addTools on linux', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3',
|
'php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, php-config, phpize',
|
||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
@ -279,10 +308,13 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain('add_pecl');
|
expect(script).toContain('add_pecl');
|
||||||
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
|
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
|
||||||
expect(script).toContain('add_composer_tool phinx phinx:1.2.3 robmorgan/');
|
expect(script).toContain('add_composer_tool phinx phinx:1.2.3 robmorgan/');
|
||||||
|
expect(script).toContain('add_devtools');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
});
|
});
|
||||||
it('checking addTools on darwin', async () => {
|
it('checking addTools on darwin', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, composer-prefetcher:1.2.3',
|
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, composer-prefetcher:1.2.3, phpize, php-config',
|
||||||
'7.4',
|
'7.4',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
@ -308,10 +340,12 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_composer_tool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
|
'add_composer_tool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
|
||||||
);
|
);
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
});
|
});
|
||||||
it('checking addTools on windows', async () => {
|
it('checking addTools on windows', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'codeception, deployer, prestissimo, phpmd, phinx, does_not_exit',
|
'codeception, deployer, prestissimo, phpmd, phinx, php-config, phpize, does_not_exit',
|
||||||
'7.4',
|
'7.4',
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
@ -325,6 +359,9 @@ describe('Tools tests', () => {
|
|||||||
'Add-Composer-Tool prestissimo prestissimo hirak/'
|
'Add-Composer-Tool prestissimo prestissimo hirak/'
|
||||||
);
|
);
|
||||||
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/');
|
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/');
|
||||||
|
expect(script).toContain('phpize is not a windows tool');
|
||||||
|
expect(script).toContain('php-config is not a windows tool');
|
||||||
|
expect(script).toContain('Tool does_not_exit is not supported');
|
||||||
expect(script).toContain('Tool does_not_exit is not supported');
|
expect(script).toContain('Tool does_not_exit is not supported');
|
||||||
});
|
});
|
||||||
it('checking addTools with composer tool using user/tool as input', async () => {
|
it('checking addTools with composer tool using user/tool as input', async () => {
|
||||||
|
57
dist/index.js
vendored
57
dist/index.js
vendored
@ -1297,13 +1297,20 @@ class Command {
|
|||||||
let cmdStr = CMD_STRING + this.command;
|
let cmdStr = CMD_STRING + this.command;
|
||||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||||
cmdStr += ' ';
|
cmdStr += ' ';
|
||||||
|
let first = true;
|
||||||
for (const key in this.properties) {
|
for (const key in this.properties) {
|
||||||
if (this.properties.hasOwnProperty(key)) {
|
if (this.properties.hasOwnProperty(key)) {
|
||||||
const val = this.properties[key];
|
const val = this.properties[key];
|
||||||
if (val) {
|
if (val) {
|
||||||
|
if (first) {
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cmdStr += ',';
|
||||||
|
}
|
||||||
// safely append the val - avoid blowing up when attempting to
|
// safely append the val - avoid blowing up when attempting to
|
||||||
// call .replace() if message is not a string for some reason
|
// call .replace() if message is not a string for some reason
|
||||||
cmdStr += `${key}=${escape(`${val || ''}`)},`;
|
cmdStr += `${key}=${escape(`${val || ''}`)}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1813,6 +1820,29 @@ function addArchive(tool, version, url, os_version) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.addArchive = addArchive;
|
exports.addArchive = addArchive;
|
||||||
|
/**
|
||||||
|
* Function to get the script to setup php-config and phpize
|
||||||
|
*
|
||||||
|
* @param tool
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
function addDevTools(tool, os_version) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
switch (os_version) {
|
||||||
|
case 'linux':
|
||||||
|
return ('add_devtools' +
|
||||||
|
'\n' +
|
||||||
|
(yield utils.addLog('$tick', tool, 'Added', 'linux')));
|
||||||
|
case 'darwin':
|
||||||
|
return yield utils.addLog('$tick', tool, 'Added', 'darwin');
|
||||||
|
case 'win32':
|
||||||
|
return yield utils.addLog('$cross', tool, tool + ' is not a windows tool', 'win32');
|
||||||
|
default:
|
||||||
|
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.addDevTools = addDevTools;
|
||||||
/**
|
/**
|
||||||
* Helper function to get script to setup a tool using composer
|
* Helper function to get script to setup a tool using composer
|
||||||
*
|
*
|
||||||
@ -1902,6 +1932,10 @@ function addTools(tools_csv, php_version, os_version) {
|
|||||||
case 'pecl':
|
case 'pecl':
|
||||||
script += yield getPECLCommand(os_version);
|
script += yield getPECLCommand(os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'php-config':
|
||||||
|
case 'phpize':
|
||||||
|
script += yield addDevTools(tool, os_version);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
script += yield utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version);
|
script += yield utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version);
|
||||||
break;
|
break;
|
||||||
@ -2537,6 +2571,9 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
case /5\.6xdebug/.test(version_extension):
|
case /5\.6xdebug/.test(version_extension):
|
||||||
install_command = 'sudo pecl install xdebug-2.5.5' + pipe;
|
install_command = 'sudo pecl install xdebug-2.5.5' + pipe;
|
||||||
break;
|
break;
|
||||||
|
case /7\.0xdebug/.test(version_extension):
|
||||||
|
install_command = 'sudo pecl install xdebug-2.9.0' + pipe;
|
||||||
|
break;
|
||||||
case /5\.6redis/.test(version_extension):
|
case /5\.6redis/.test(version_extension):
|
||||||
install_command = 'sudo pecl install redis-2.2.8' + pipe;
|
install_command = 'sudo pecl install redis-2.2.8' + pipe;
|
||||||
break;
|
break;
|
||||||
@ -2631,17 +2668,27 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
version +
|
version +
|
||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
|
// match 7.0xdebug..7.4xdebug
|
||||||
|
case /^7\.[0-4]xdebug$/.test(version_extension):
|
||||||
|
script +=
|
||||||
|
'\nupdate_extension xdebug 2.9.0' +
|
||||||
|
pipe +
|
||||||
|
'\n' +
|
||||||
|
(yield utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
||||||
|
return;
|
||||||
// match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
install_command =
|
script +=
|
||||||
'sh ' +
|
'\nsh ' +
|
||||||
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
||||||
' ' +
|
' ' +
|
||||||
extension +
|
extension +
|
||||||
' ' +
|
' ' +
|
||||||
version +
|
version +
|
||||||
pipe;
|
pipe +
|
||||||
break;
|
'\n' +
|
||||||
|
(yield utils.addLog('$tick', extension, 'Installed and enabled', 'linux'));
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
install_command =
|
install_command =
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
||||||
|
1209
package-lock.json
generated
1209
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.7.2",
|
"version": "1.7.3",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Setup PHP for use with GitHub Actions",
|
"description": "Setup PHP for use with GitHub Actions",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -24,6 +24,9 @@ export async function addExtensionDarwin(
|
|||||||
case /5\.6xdebug/.test(version_extension):
|
case /5\.6xdebug/.test(version_extension):
|
||||||
install_command = 'sudo pecl install xdebug-2.5.5' + pipe;
|
install_command = 'sudo pecl install xdebug-2.5.5' + pipe;
|
||||||
break;
|
break;
|
||||||
|
case /7\.0xdebug/.test(version_extension):
|
||||||
|
install_command = 'sudo pecl install xdebug-2.9.0' + pipe;
|
||||||
|
break;
|
||||||
case /5\.6redis/.test(version_extension):
|
case /5\.6redis/.test(version_extension):
|
||||||
install_command = 'sudo pecl install redis-2.2.8' + pipe;
|
install_command = 'sudo pecl install redis-2.2.8' + pipe;
|
||||||
break;
|
break;
|
||||||
@ -118,17 +121,32 @@ export async function addExtensionLinux(
|
|||||||
version +
|
version +
|
||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
|
// match 7.0xdebug..7.4xdebug
|
||||||
|
case /^7\.[0-4]xdebug$/.test(version_extension):
|
||||||
|
script +=
|
||||||
|
'\nupdate_extension xdebug 2.9.0' +
|
||||||
|
pipe +
|
||||||
|
'\n' +
|
||||||
|
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
||||||
|
return;
|
||||||
// match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
install_command =
|
script +=
|
||||||
'sh ' +
|
'\nsh ' +
|
||||||
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
||||||
' ' +
|
' ' +
|
||||||
extension +
|
extension +
|
||||||
' ' +
|
' ' +
|
||||||
version +
|
version +
|
||||||
pipe;
|
pipe +
|
||||||
break;
|
'\n' +
|
||||||
|
(await utils.addLog(
|
||||||
|
'$tick',
|
||||||
|
extension,
|
||||||
|
'Installed and enabled',
|
||||||
|
'linux'
|
||||||
|
));
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
install_command =
|
install_command =
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
||||||
|
@ -53,6 +53,8 @@ add_tool() {
|
|||||||
tool=$2
|
tool=$2
|
||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
brew install composer >/dev/null 2>&1
|
brew install composer >/dev/null 2>&1
|
||||||
|
composer -q global config process-timeout 0
|
||||||
|
add_log "$tick" "$tool" "Added"
|
||||||
else
|
else
|
||||||
if [ ! -e /usr/local/bin/"$tool" ]; then
|
if [ ! -e /usr/local/bin/"$tool" ]; then
|
||||||
rm -rf /usr/local/bin/"${tool:?}"
|
rm -rf /usr/local/bin/"${tool:?}"
|
||||||
|
@ -14,6 +14,10 @@ $tick = ([char]8730)
|
|||||||
$domain = 'https://github.com'
|
$domain = 'https://github.com'
|
||||||
$php_dir = 'C:\tools\php'
|
$php_dir = 'C:\tools\php'
|
||||||
$ext_dir = $php_dir + '\ext'
|
$ext_dir = $php_dir + '\ext'
|
||||||
|
Install-Phpextension psr -MinimumStability stable -Path $php_dir
|
||||||
|
if($extension -eq "phalcon4") {
|
||||||
|
Install-Phpextension phalcon -MinimumStability stable -Path $php_dir
|
||||||
|
} else {
|
||||||
$installed = Get-Php -Path $php_dir
|
$installed = Get-Php -Path $php_dir
|
||||||
$extension_version = $extension.substring($extension.Length - 1)
|
$extension_version = $extension.substring($extension.Length - 1)
|
||||||
$nts = if(! $installed.ThreadSafe ) { "_nts" } else { "" }
|
$nts = if(! $installed.ThreadSafe ) { "_nts" } else { "" }
|
||||||
@ -22,6 +26,6 @@ $zip_file = $match.Matches[0].Groups[1].Value
|
|||||||
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip >$null 2>&1
|
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip >$null 2>&1
|
||||||
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force >$null 2>&1
|
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force >$null 2>&1
|
||||||
New-Item -ItemType SymbolicLink -Path $ext_dir\php_phalcon.dll -Target $ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll >$null 2>&1
|
New-Item -ItemType SymbolicLink -Path $ext_dir\php_phalcon.dll -Target $ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll >$null 2>&1
|
||||||
Install-Phpextension psr -MinimumStability stable -Path $php_dir
|
|
||||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
||||||
|
}
|
||||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Installed and enabled"
|
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Installed and enabled"
|
@ -51,6 +51,21 @@ remove_extension() {
|
|||||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to update extension
|
||||||
|
update_extension() {
|
||||||
|
extension=$1
|
||||||
|
latest_version=$2
|
||||||
|
current_version=$(php -r "echo phpversion('$extension');")
|
||||||
|
final_version=$(printf "%s\n%s" "$current_version" "$latest_version" | sort | tail -n 1)
|
||||||
|
if [ "$final_version" != "$current_version" ]; then
|
||||||
|
version_exists=$(apt-cache policy -- *"$extension" | grep "$final_version")
|
||||||
|
if [ -z "$version_exists" ]; then
|
||||||
|
update_ppa
|
||||||
|
fi
|
||||||
|
$apt_install php"$version"-"$extension"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup a remote tool
|
# Function to setup a remote tool
|
||||||
add_tool() {
|
add_tool() {
|
||||||
url=$1
|
url=$1
|
||||||
@ -65,6 +80,9 @@ add_tool() {
|
|||||||
else
|
else
|
||||||
add_log "$cross" "$tool" "Could not setup $tool"
|
add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
fi
|
fi
|
||||||
|
if [ "$tool" = "composer" ]; then
|
||||||
|
composer -q global config process-timeout 0
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
add_composer_tool() {
|
add_composer_tool() {
|
||||||
@ -78,6 +96,15 @@ add_composer_tool() {
|
|||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to setup phpize and php-config
|
||||||
|
add_devtools() {
|
||||||
|
if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then
|
||||||
|
$apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
||||||
|
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup the nightly build from master branch
|
# Function to setup the nightly build from master branch
|
||||||
setup_master() {
|
setup_master() {
|
||||||
tar_file=php_"$version"%2Bubuntu"$(lsb_release -r -s)".tar.xz
|
tar_file=php_"$version"%2Bubuntu"$(lsb_release -r -s)".tar.xz
|
||||||
@ -94,9 +121,7 @@ setup_master() {
|
|||||||
# Function to setup PECL
|
# Function to setup PECL
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
update_ppa
|
update_ppa
|
||||||
$apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1
|
add_devtools
|
||||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
|
||||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
|
||||||
wget https://github.com/pear/pearweb_phars/raw/master/install-pear-nozlib.phar >/dev/null 2>&1
|
wget https://github.com/pear/pearweb_phars/raw/master/install-pear-nozlib.phar >/dev/null 2>&1
|
||||||
sudo php install-pear-nozlib.phar >/dev/null 2>&1
|
sudo php install-pear-nozlib.phar >/dev/null 2>&1
|
||||||
sudo rm -rf install-pear-nozlib.phar >/dev/null 2>&1
|
sudo rm -rf install-pear-nozlib.phar >/dev/null 2>&1
|
||||||
|
@ -91,6 +91,7 @@ Function Add-Tool() {
|
|||||||
)
|
)
|
||||||
if($tool -eq "composer") {
|
if($tool -eq "composer") {
|
||||||
Install-Composer -Scope System -Path $php_dir -PhpPath $php_dir
|
Install-Composer -Scope System -Path $php_dir -PhpPath $php_dir
|
||||||
|
composer -q global config process-timeout 0
|
||||||
Add-Log $tick $tool "Added"
|
Add-Log $tick $tool "Added"
|
||||||
} else {
|
} else {
|
||||||
if (Test-Path $php_dir\$tool) {
|
if (Test-Path $php_dir\$tool) {
|
||||||
@ -170,6 +171,7 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Step-Log "Setup PHP"
|
Step-Log "Setup PHP"
|
||||||
|
$status = "Installed"
|
||||||
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.')))) {
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.')))) {
|
||||||
if ($version -lt '7.0') {
|
if ($version -lt '7.0') {
|
||||||
Install-Module -Name VcRedist -Force
|
Install-Module -Name VcRedist -Force
|
||||||
@ -180,9 +182,11 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
}
|
}
|
||||||
|
|
||||||
Install-Php -Version $version -Architecture $arch -ThreadSafe $true -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1
|
Install-Php -Version $version -Architecture $arch -ThreadSafe $true -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1
|
||||||
|
} else {
|
||||||
|
$updated = Update-Php $php_dir >$null 2>&1
|
||||||
|
if($updated -eq $False) {
|
||||||
|
$status = "Found"
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
Update-Php $php_dir >$null 2>&1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$installed = Get-Php -Path $php_dir
|
$installed = Get-Php -Path $php_dir
|
||||||
@ -194,4 +198,4 @@ if ($version -eq 'master') {
|
|||||||
Set-PhpIniKey -Key 'opcache.jit_buffer_size' -Value '256M' -Path $php_dir
|
Set-PhpIniKey -Key 'opcache.jit_buffer_size' -Value '256M' -Path $php_dir
|
||||||
Set-PhpIniKey -Key 'opcache.jit' -Value '1235' -Path $php_dir
|
Set-PhpIniKey -Key 'opcache.jit' -Value '1235' -Path $php_dir
|
||||||
}
|
}
|
||||||
Add-Log $tick "PHP" "Installed PHP $($installed.FullVersion)"
|
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
||||||
|
39
src/tools.ts
39
src/tools.ts
@ -269,6 +269,41 @@ export async function addArchive(
|
|||||||
return (await getArchiveCommand(os_version)) + url + ' ' + tool;
|
return (await getArchiveCommand(os_version)) + url + ' ' + tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to get the script to setup php-config and phpize
|
||||||
|
*
|
||||||
|
* @param tool
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
export async function addDevTools(
|
||||||
|
tool: string,
|
||||||
|
os_version: string
|
||||||
|
): Promise<string> {
|
||||||
|
switch (os_version) {
|
||||||
|
case 'linux':
|
||||||
|
return (
|
||||||
|
'add_devtools' +
|
||||||
|
'\n' +
|
||||||
|
(await utils.addLog('$tick', tool, 'Added', 'linux'))
|
||||||
|
);
|
||||||
|
case 'darwin':
|
||||||
|
return await utils.addLog('$tick', tool, 'Added', 'darwin');
|
||||||
|
case 'win32':
|
||||||
|
return await utils.addLog(
|
||||||
|
'$cross',
|
||||||
|
tool,
|
||||||
|
tool + ' is not a windows tool',
|
||||||
|
'win32'
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return await utils.log(
|
||||||
|
'Platform ' + os_version + ' is not supported',
|
||||||
|
os_version,
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get script to setup a tool using composer
|
* Helper function to get script to setup a tool using composer
|
||||||
*
|
*
|
||||||
@ -368,6 +403,10 @@ export async function addTools(
|
|||||||
case 'pecl':
|
case 'pecl':
|
||||||
script += await getPECLCommand(os_version);
|
script += await getPECLCommand(os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'php-config':
|
||||||
|
case 'phpize':
|
||||||
|
script += await addDevTools(tool, os_version);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
script += await utils.addLog(
|
script += await utils.addLog(
|
||||||
'$cross',
|
'$cross',
|
||||||
|
Loading…
Reference in New Issue
Block a user