mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-08-01 19:27:57 +07:00
Compare commits
7 Commits
1.11.6
...
releases/v
Author | SHA1 | Date | |
---|---|---|---|
bc71c880ee | |||
28c92ba4ee | |||
ffd019edc6 | |||
0e506b34ac | |||
aa0ecfbc6f | |||
f29cd24dbf | |||
2a41b9d1ba |
14
README.md
14
README.md
@ -56,11 +56,12 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
| Virtual environment | YAML workflow label | Pre-installed PHP |
|
| Virtual environment | YAML workflow label | Pre-installed PHP |
|
||||||
|----------------------|------------------------------------|------------------------|
|
|----------------------|------------------------------------|------------------------|
|
||||||
| Ubuntu 20.04 | `ubuntu-latest` or `ubuntu-20.04` | `PHP 7.4` to `PHP 8.1` |
|
| Ubuntu 20.04 | `ubuntu-latest` or `ubuntu-20.04` | `PHP 7.4` to `PHP 8.1` |
|
||||||
| Ubuntu 18.04 | `ubuntu-18.04` | `PHP 7.1` to `PHP 8.1` |
|
| Ubuntu 18.04 | `ubuntu-18.04` | `PHP 7.2` to `PHP 8.1` |
|
||||||
| Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.1` |
|
| Windows Server 2022 | `windows-latest` or `windows-2022` | `PHP 8.1` |
|
||||||
| Windows Server 2019 | `windows-2019` | `PHP 8.1` |
|
| Windows Server 2019 | `windows-2019` | `PHP 8.1` |
|
||||||
| macOS 11.x Big Sur | `macos-11` | `PHP 8.1` |
|
| macOS Monterey 12.x | `macos-12` | `PHP 8.1` |
|
||||||
| macOS 10.15 Catalina | `macos-latest` or `macos-10.15` | `PHP 8.1` |
|
| macOS Big Sur 11.x | `macos-latest` or `macos-11` | `PHP 8.1` |
|
||||||
|
| macOS Catalina 10.15 | `macos-10.15` | `PHP 8.1` |
|
||||||
|
|
||||||
## :heavy_plus_sign: PHP Extension Support
|
## :heavy_plus_sign: PHP Extension Support
|
||||||
- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
|
- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
|
||||||
@ -415,6 +416,13 @@ These companies generously provide setup-php their products and services to aid
|
|||||||
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
|
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
|
||||||
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="70" height="60">
|
<img src="https://setup-php.com/sponsors/tidelift.png" alt="Tidelift" width="70" height="60">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<a href="https://www.scaleway.com/en/about-us/open-source-program#gh-light-mode-only">
|
||||||
|
<img src="https://setup-php.com/sponsors/scaleway.png" alt="Scaleway" width="174" height="60">
|
||||||
|
</a>
|
||||||
|
<a href="https://www.scaleway.com/en/about-us/open-source-program#gh-dark-mode-only">
|
||||||
|
<img src="https://setup-php.com/sponsors/scaleway-white.png" alt="Scaleway" width="174" height="60">
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## :bookmark: Dependencies
|
## :bookmark: Dependencies
|
||||||
|
@ -198,37 +198,37 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('checking getComposerUrl', async () => {
|
it('checking getComposerUrl', async () => {
|
||||||
expect(await tools.getComposerUrl('latest')).toContain(
|
expect(await tools.getComposerUrl('latest', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-stable.phar'
|
'https://getcomposer.org/composer-stable.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('stable')).toContain(
|
expect(await tools.getComposerUrl('stable', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-stable.phar'
|
'https://getcomposer.org/composer-stable.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('snapshot')).toContain(
|
expect(await tools.getComposerUrl('snapshot', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer.phar'
|
'https://getcomposer.org/composer.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('preview')).toContain(
|
expect(await tools.getComposerUrl('preview', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-preview.phar'
|
'https://getcomposer.org/composer-preview.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('1')).toContain(
|
expect(await tools.getComposerUrl('1', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-1.phar'
|
'https://getcomposer.org/composer-1.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('2')).toContain(
|
expect(await tools.getComposerUrl('2', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-2.phar'
|
'https://getcomposer.org/composer-2.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('1.7.2')).toContain(
|
expect(await tools.getComposerUrl('1.7.2', '7.4')).toContain(
|
||||||
'https://github.com/composer/composer/releases/download/1.7.2/composer.phar'
|
'https://github.com/composer/composer/releases/download/1.7.2/composer.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('1.7.2')).toContain(
|
expect(await tools.getComposerUrl('1.7.2', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-1.7.2.phar'
|
'https://getcomposer.org/composer-1.7.2.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('2.0.0-RC2')).toContain(
|
expect(await tools.getComposerUrl('2.0.0-RC2', '7.4')).toContain(
|
||||||
'https://github.com/composer/composer/releases/download/2.0.0-RC2/composer.phar'
|
'https://github.com/composer/composer/releases/download/2.0.0-RC2/composer.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('2.0.0-RC2')).toContain(
|
expect(await tools.getComposerUrl('2.0.0-RC2', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-2.0.0-RC2.phar'
|
'https://getcomposer.org/composer-2.0.0-RC2.phar'
|
||||||
);
|
);
|
||||||
expect(await tools.getComposerUrl('wrong')).toContain(
|
expect(await tools.getComposerUrl('wrong', '7.4')).toContain(
|
||||||
'https://getcomposer.org/composer-stable.phar'
|
'https://getcomposer.org/composer-stable.phar'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -347,7 +347,7 @@ describe('Tools tests', () => {
|
|||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
||||||
@ -381,7 +381,7 @@ describe('Tools tests', () => {
|
|||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr'
|
'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/1.2.3/cs2pr cs2pr'
|
||||||
@ -418,7 +418,7 @@ describe('Tools tests', () => {
|
|||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
'Add-Tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr'
|
||||||
@ -447,7 +447,7 @@ describe('Tools tests', () => {
|
|||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer'
|
'Add-Tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'
|
||||||
);
|
);
|
||||||
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
|
expect(script).toContain('Add-Composertool prestissimo prestissimo hirak/');
|
||||||
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
|
expect(script).toContain('Add-Composertool phinx phinx robmorgan/');
|
||||||
@ -462,12 +462,12 @@ describe('Tools tests', () => {
|
|||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-1.phar,https://getcomposer.org/composer-1.phar composer'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-1.phar,https://getcomposer.org/composer-1.phar composer'
|
||||||
);
|
);
|
||||||
|
|
||||||
script = await tools.addTools('composer:preview', '7.4', 'linux');
|
script = await tools.addTools('composer:preview', '7.4', 'linux');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-preview.phar,https://getcomposer.org/composer-preview.phar composer'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-preview.phar,https://getcomposer.org/composer-preview.phar composer'
|
||||||
);
|
);
|
||||||
script = await tools.addTools(
|
script = await tools.addTools(
|
||||||
'composer:v1, composer:preview, composer:snapshot',
|
'composer:v1, composer:preview, composer:snapshot',
|
||||||
@ -475,7 +475,7 @@ describe('Tools tests', () => {
|
|||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-snapshot.phar,https://getcomposer.org/composer.phar composer'
|
'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-snapshot.phar,https://getcomposer.org/composer.phar composer'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -207,9 +207,9 @@ describe('Utils tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('checking suppressOutput', async () => {
|
it('checking suppressOutput', async () => {
|
||||||
expect(await utils.suppressOutput('win32')).toEqual(' >$null 2>&1');
|
expect(await utils.suppressOutput('win32')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('linux')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('linux')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('darwin')).toEqual(' >/dev/null 2>&1');
|
expect(await utils.suppressOutput('darwin')).toEqual(' ');
|
||||||
expect(await utils.suppressOutput('openbsd')).toContain(
|
expect(await utils.suppressOutput('openbsd')).toContain(
|
||||||
'Platform openbsd is not supported'
|
'Platform openbsd is not supported'
|
||||||
);
|
);
|
||||||
|
48
dist/index.js
vendored
48
dist/index.js
vendored
@ -8,7 +8,11 @@
|
|||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
@ -87,7 +91,11 @@ exports.addINIValues = addINIValues;
|
|||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
@ -192,7 +200,11 @@ exports.addCoverage = addCoverage;
|
|||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
@ -232,7 +244,7 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
' ' +
|
' ' +
|
||||||
ext_prefix;
|
ext_prefix;
|
||||||
return;
|
return;
|
||||||
case /(5\.6|7\.[0-4]|8.0)(amqp|expect|grpc|igbinary|imagick|imap|mongodb|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(version_extension):
|
case /(5\.6|7\.[0-4]|8.0)(amqp|expect|grpc|igbinary|imagick|imap|mcrypt|mongodb|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(version_extension):
|
||||||
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
||||||
case /^(5\.6|7\.[0-3])phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^(5\.6|7\.[0-3])phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
case /(7\.[0-4]|8\.0])vips/.test(version_extension):
|
case /(7\.[0-4]|8\.0])vips/.test(version_extension):
|
||||||
@ -388,7 +400,11 @@ exports.addExtension = addExtension;
|
|||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
@ -492,7 +508,11 @@ exports.run = run;
|
|||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
@ -655,8 +675,8 @@ async function addComposer(tools_list) {
|
|||||||
return tools_list;
|
return tools_list;
|
||||||
}
|
}
|
||||||
exports.addComposer = addComposer;
|
exports.addComposer = addComposer;
|
||||||
async function getComposerUrl(version) {
|
async function getComposerUrl(version, php_version) {
|
||||||
let cache_url = `https://github.com/shivammathur/composer-cache/releases/latest/download/composer-${version.replace('latest', 'stable')}.phar`;
|
let cache_url = `https://github.com/shivammathur/composer-cache/releases/latest/download/composer-${php_version}-${version.replace('latest', 'stable')}.phar`;
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case /^snapshot$/.test(version):
|
case /^snapshot$/.test(version):
|
||||||
return `${cache_url},https://getcomposer.org/composer.phar`;
|
return `${cache_url},https://getcomposer.org/composer.phar`;
|
||||||
@ -750,7 +770,7 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version);
|
||||||
break;
|
break;
|
||||||
case 'composer':
|
case 'composer':
|
||||||
url = await getComposerUrl(version);
|
url = await getComposerUrl(version, php_version);
|
||||||
script += await addArchive('composer', url, os_version);
|
script += await addArchive('composer', url, os_version);
|
||||||
break;
|
break;
|
||||||
case 'codeception':
|
case 'codeception':
|
||||||
@ -806,7 +826,11 @@ exports.addTools = addTools;
|
|||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
@ -999,10 +1023,10 @@ exports.getExtensionPrefix = getExtensionPrefix;
|
|||||||
async function suppressOutput(os_version) {
|
async function suppressOutput(os_version) {
|
||||||
switch (os_version) {
|
switch (os_version) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return ' >$null 2>&1';
|
return ' ';
|
||||||
case 'linux':
|
case 'linux':
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return ' >/dev/null 2>&1';
|
return ' ';
|
||||||
default:
|
default:
|
||||||
return await log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
return await log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||||
}
|
}
|
||||||
|
572
package-lock.json
generated
572
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.11.6",
|
"version": "1.11.7",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Setup PHP for use with GitHub Actions",
|
"description": "Setup PHP for use with GitHub Actions",
|
||||||
"main": "lib/install.js",
|
"main": "lib/install.js",
|
||||||
@ -35,27 +35,27 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.6.0",
|
"@actions/core": "^1.6.0",
|
||||||
"@actions/exec": "^1.1.0",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.1",
|
"@actions/io": "^1.1.2",
|
||||||
"fs": "0.0.1-security"
|
"fs": "0.0.1-security"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.4.0",
|
"@types/jest": "^27.4.1",
|
||||||
"@types/node": "^17.0.16",
|
"@types/node": "^17.0.23",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.11.0",
|
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
||||||
"@typescript-eslint/parser": "^5.11.0",
|
"@typescript-eslint/parser": "^5.18.0",
|
||||||
"@vercel/ncc": "^0.33.1",
|
"@vercel/ncc": "^0.33.3",
|
||||||
"eslint": "^8.8.0",
|
"eslint": "^8.13.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-import": "^2.25.4",
|
"eslint-plugin-import": "^2.26.0",
|
||||||
"eslint-plugin-jest": "^26.1.0",
|
"eslint-plugin-jest": "^26.1.4",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"jest-circus": "^27.5.1",
|
"jest-circus": "^27.5.1",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.6.2",
|
||||||
"simple-git-hooks": "^2.7.0",
|
"simple-git-hooks": "^2.7.0",
|
||||||
"ts-jest": "^27.1.3",
|
"ts-jest": "^27.1.4",
|
||||||
"typescript": "^4.5.5"
|
"typescript": "^4.6.3"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/shivammathur/setup-php/issues"
|
"url": "https://github.com/shivammathur/setup-php/issues"
|
||||||
|
@ -33,7 +33,7 @@ export async function addExtensionDarwin(
|
|||||||
// match 5.6 to 8.0 amqp, expect, grpc, igbinary, imagick, imap, mongodb, msgpack, pecl_http, propro, protobuf, raphf, rdkafka, redis, ssh2, swoole, xdebug, xdebug2, yaml, zmq
|
// match 5.6 to 8.0 amqp, expect, grpc, igbinary, imagick, imap, mongodb, msgpack, pecl_http, propro, protobuf, raphf, rdkafka, redis, ssh2, swoole, xdebug, xdebug2, yaml, zmq
|
||||||
// match 7.1pcov to 8.0pcov
|
// match 7.1pcov to 8.0pcov
|
||||||
// match 7.0vips to 8.0vips
|
// match 7.0vips to 8.0vips
|
||||||
case /(5\.6|7\.[0-4]|8.0)(amqp|expect|grpc|igbinary|imagick|imap|mongodb|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(
|
case /(5\.6|7\.[0-4]|8.0)(amqp|expect|grpc|igbinary|imagick|imap|mcrypt|mongodb|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
|
||||||
|
@ -20,8 +20,8 @@ add_log() {
|
|||||||
remove_extension() {
|
remove_extension() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
sudo sed -Ei '' "/=(.*\/)?\"?$extension/d" "$ini_file"
|
sudo sed -Ei '' "/=(.*\/)?\"?$extension/d" "$ini_file"
|
||||||
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
sudo rm -rf "$scan_dir"/*"$extension"*
|
||||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
sudo rm -rf "$ext_dir"/"$extension".so
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to test if extension is loaded
|
# Function to test if extension is loaded
|
||||||
@ -37,7 +37,7 @@ check_extension() {
|
|||||||
# Function to install PECL extensions and accept default options
|
# Function to install PECL extensions and accept default options
|
||||||
pecl_install() {
|
pecl_install() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
|
yes '' | sudo pecl install -f "$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get the PECL version
|
# Function to get the PECL version
|
||||||
@ -70,7 +70,7 @@ add_pecl_extension() {
|
|||||||
else
|
else
|
||||||
remove_extension "$extension"
|
remove_extension "$extension"
|
||||||
(
|
(
|
||||||
pecl_install "$extension-$pecl_version" >/dev/null 2>&1 &&
|
pecl_install "$extension-$pecl_version" &&
|
||||||
check_extension "$extension" &&
|
check_extension "$extension" &&
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
add_log "$tick" "$extension" "Installed and enabled"
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
||||||
@ -93,9 +93,9 @@ fetch_brew_tap() {
|
|||||||
add_brew_tap() {
|
add_brew_tap() {
|
||||||
tap=$1
|
tap=$1
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
fetch_brew_tap "$tap" >/dev/null 2>&1
|
fetch_brew_tap "$tap"
|
||||||
if ! [ -d "$tap_dir/$tap" ]; then
|
if ! [ -d "$tap_dir/$tap" ]; then
|
||||||
brew tap "$tap" >/dev/null 2>&1
|
brew tap "$tap"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ add_extension() {
|
|||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
elif ! check_extension "$extension"; then
|
elif ! check_extension "$extension"; then
|
||||||
(
|
(
|
||||||
eval "$install_command" >/dev/null 2>&1 &&
|
eval "$install_command" &&
|
||||||
check_extension "$extension" &&
|
check_extension "$extension" &&
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
add_log "$tick" "$extension" "Installed and enabled"
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
@ -188,15 +188,15 @@ add_tool() {
|
|||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
configure_composer "$tool_path"
|
configure_composer "$tool_path"
|
||||||
elif [ "$tool" = "phan" ]; then
|
elif [ "$tool" = "phan" ]; then
|
||||||
add_extension fileinfo "pecl_install fileinfo" extension >/dev/null 2>&1
|
add_extension fileinfo "pecl_install fileinfo" extension
|
||||||
add_extension ast "pecl_install ast" extension >/dev/null 2>&1
|
add_extension ast "pecl_install ast" extension
|
||||||
elif [ "$tool" = "phive" ]; then
|
elif [ "$tool" = "phive" ]; then
|
||||||
add_extension curl "pecl_install curl" extension >/dev/null 2>&1
|
add_extension curl "pecl_install curl" extension
|
||||||
add_extension mbstring "pecl_install mbstring" extension >/dev/null 2>&1
|
add_extension mbstring "pecl_install mbstring" extension
|
||||||
add_extension xml "pecl_install xml" extension >/dev/null 2>&1
|
add_extension xml "pecl_install xml" extension
|
||||||
elif [ "$tool" = "cs2pr" ]; then
|
elif [ "$tool" = "cs2pr" ]; then
|
||||||
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
|
sudo sed -i '' 's/exit(9)/exit(0)/' "$tool_path"
|
||||||
tr -d '\r' < "$tool_path" | sudo tee "$tool_path.tmp" >/dev/null 2>&1 && sudo mv "$tool_path.tmp" "$tool_path"
|
tr -d '\r' < "$tool_path" | sudo tee "$tool_path.tmp" && sudo mv "$tool_path.tmp" "$tool_path"
|
||||||
sudo chmod a+x "$tool_path"
|
sudo chmod a+x "$tool_path"
|
||||||
fi
|
fi
|
||||||
add_log "$tick" "$tool" "Added"
|
add_log "$tick" "$tool" "Added"
|
||||||
@ -211,8 +211,8 @@ add_composertool() {
|
|||||||
release=$2
|
release=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
(
|
(
|
||||||
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
sudo rm -f "$composer_lock" || true
|
||||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
composer global require "$prefix$release" &&
|
||||||
add_log "$tick" "$tool" "Added"
|
add_log "$tick" "$tool" "Added"
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
if [ -e "$composer_bin/composer" ]; then
|
if [ -e "$composer_bin/composer" ]; then
|
||||||
@ -226,8 +226,8 @@ add_composertool() {
|
|||||||
# Function to configure PECL
|
# Function to configure PECL
|
||||||
configure_pecl() {
|
configure_pecl() {
|
||||||
for tool in pear pecl; do
|
for tool in pear pecl; do
|
||||||
sudo "$tool" config-set php_ini "$ini_file" >/dev/null 2>&1
|
sudo "$tool" config-set php_ini "$ini_file"
|
||||||
sudo "$tool" channel-update "$tool".php.net >/dev/null 2>&1
|
sudo "$tool" channel-update "$tool".php.net
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,31 +242,39 @@ link_libraries() {
|
|||||||
formula_prefix="$(brew --prefix "$formula")"
|
formula_prefix="$(brew --prefix "$formula")"
|
||||||
sudo mkdir -p "$formula_prefix"/lib
|
sudo mkdir -p "$formula_prefix"/lib
|
||||||
for lib in "$formula_prefix"/lib/*.dylib; do
|
for lib in "$formula_prefix"/lib/*.dylib; do
|
||||||
[ -f "$lib" ] || break
|
|
||||||
lib_name=$(basename "$lib")
|
lib_name=$(basename "$lib")
|
||||||
sudo cp -a "$lib" "$brew_prefix/lib/$lib_name" 2>/dev/null || true
|
sudo cp -a "$lib" "$brew_prefix/lib/$lib_name" 2>/dev/null || true
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
patch_brew() {
|
patch_brew() {
|
||||||
sudo sed -i '' "s/ keg.link(verbose: verbose?)/ keg.link(verbose: verbose?, overwrite: true)/" "$brew_repo"/Library/Homebrew/formula_installer.rb
|
formula_installer="$brew_repo"/Library/Homebrew/formula_installer.rb
|
||||||
|
code=" keg.link\(verbose: verbose\?"
|
||||||
|
sudo sed -Ei '' "s/$code.*/$code, overwrite: true\)/" "$formula_installer"
|
||||||
# shellcheck disable=SC2064
|
# shellcheck disable=SC2064
|
||||||
trap "git -C $brew_repo stash >/dev/null 2>&1" exit
|
trap "sudo sed -Ei '' 's/$code.*/$code, overwrite: overwrite?\)/' $formula_installer" exit
|
||||||
|
}
|
||||||
|
|
||||||
|
# Helper function to update the dependencies.
|
||||||
|
update_dependencies_helper() {
|
||||||
|
dependency=$1
|
||||||
|
curl -o "$tap_dir/homebrew/homebrew-core/Formula/$formula.rb" "${curl_opts[@]}" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$formula.rb"
|
||||||
|
link_libraries "$dependency"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to update dependencies
|
# Function to update dependencies
|
||||||
update_dependencies() {
|
update_dependencies() {
|
||||||
|
if ! [ -e /tmp/update_dependencies ]; then
|
||||||
if [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
|
if [ "${ImageOS:-}" != "" ] && [ "${ImageVersion:-}" != "" ]; then
|
||||||
patch_brew
|
patch_brew
|
||||||
while read -r formula; do
|
while read -r dependency; do
|
||||||
(
|
update_dependencies_helper "$dependency" &
|
||||||
curl -o "$tap_dir/homebrew/homebrew-core/Formula/$formula.rb" "${curl_opts[@]}" "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/$formula.rb"
|
to_wait+=($!)
|
||||||
link_libraries "$formula"
|
done <"$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
||||||
) &
|
|
||||||
to_wait+=( $! )
|
|
||||||
done < "$tap_dir/shivammathur/homebrew-php/.github/deps/${ImageOS:?}_${ImageVersion:?}"
|
|
||||||
wait "${to_wait[@]}"
|
wait "${to_wait[@]}"
|
||||||
fi
|
fi
|
||||||
|
echo '' | sudo tee /tmp/update_dependencies
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get PHP version if it is already installed using Homebrew.
|
# Function to get PHP version if it is already installed using Homebrew.
|
||||||
@ -320,7 +328,7 @@ export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
|||||||
# Setup PHP
|
# Setup PHP
|
||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
if [ "$existing_version" != "$version" ]; then
|
if [ "$existing_version" != "$version" ]; then
|
||||||
setup_php >/dev/null 2>&1
|
setup_php
|
||||||
status="Installed"
|
status="Installed"
|
||||||
else
|
else
|
||||||
status="Found"
|
status="Found"
|
||||||
|
@ -13,7 +13,7 @@ add_gearman_helper() {
|
|||||||
# Function to add gearman extension.
|
# Function to add gearman extension.
|
||||||
add_gearman() {
|
add_gearman() {
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
add_gearman_helper >/dev/null 2>&1
|
add_gearman_helper
|
||||||
if check_extension gearman; then
|
if check_extension gearman; then
|
||||||
add_log "${tick:?}" "gearman" "$status"
|
add_log "${tick:?}" "gearman" "$status"
|
||||||
fi
|
fi
|
||||||
|
@ -13,7 +13,7 @@ add_log() {
|
|||||||
# Function to update php ppa
|
# Function to update php ppa
|
||||||
update_ppa() {
|
update_ppa() {
|
||||||
if [ "$ppa_updated" = "false" ]; then
|
if [ "$ppa_updated" = "false" ]; then
|
||||||
find /etc/apt/sources.list.d -type f -name 'ondrej-ubuntu-php*.list' -exec sudo DEBIAN_FRONTEND=noninteractive apt-get update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
|
find /etc/apt/sources.list.d -type f -name 'ondrej-ubuntu-php*.list' -exec sudo DEBIAN_FRONTEND=noninteractive apt-get update -o Dir::Etc::sourcelist="{}" ';'
|
||||||
ppa_updated="true"
|
ppa_updated="true"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ update_ppa() {
|
|||||||
install_phalcon() {
|
install_phalcon() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
version=$2
|
version=$2
|
||||||
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-psr" "php$version-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
|
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-psr" "php$version-$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ cross="✗"
|
|||||||
|
|
||||||
if [ "$extension_major_version" = "4" ]; then
|
if [ "$extension_major_version" = "4" ]; then
|
||||||
if [ -e "$ext_dir/psr.so" ] && ! php -m | grep -i -q -w psr; then
|
if [ -e "$ext_dir/psr.so" ] && ! php -m | grep -i -q -w psr; then
|
||||||
echo "extension=psr.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
echo "extension=psr.so" | sudo tee -a "$ini_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$ext_dir/phalcon.so" ]; then
|
if [ -e "$ext_dir/phalcon.so" ]; then
|
||||||
@ -45,7 +45,7 @@ if [ "$extension_major_version" = "4" ]; then
|
|||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
install_phalcon "$1" "$2"
|
install_phalcon "$1" "$2"
|
||||||
else
|
else
|
||||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
echo "extension=phalcon.so" | sudo tee -a "$ini_file"
|
||||||
add_log "$tick" "$1" "Enabled"
|
add_log "$tick" "$1" "Enabled"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -62,7 +62,7 @@ if [ "$extension_major_version" = "3" ]; then
|
|||||||
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
if [ "$phalcon_version" != "$extension_major_version" ]; then
|
||||||
install_phalcon "$1" "$2"
|
install_phalcon "$1" "$2"
|
||||||
else
|
else
|
||||||
echo "extension=phalcon.so" | sudo tee -a "$ini_file" >/dev/null 2>&1
|
echo "extension=phalcon.so" | sudo tee -a "$ini_file"
|
||||||
add_log "$tick" "$1" "Enabled"
|
add_log "$tick" "$1" "Enabled"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -39,10 +39,10 @@ add_ppa() {
|
|||||||
# Function to update the package lists.
|
# Function to update the package lists.
|
||||||
update_lists() {
|
update_lists() {
|
||||||
if [ ! -e /tmp/setup_php ]; then
|
if [ ! -e /tmp/setup_php ]; then
|
||||||
add_ppa ondrej/php >/dev/null 2>&1
|
add_ppa ondrej/php
|
||||||
cleanup_lists
|
cleanup_lists
|
||||||
sudo "$debconf_fix" apt-get update >/dev/null 2>&1
|
sudo "$debconf_fix" apt-get update
|
||||||
echo '' | sudo tee /tmp/setup_php >/dev/null 2>&1
|
echo '' | sudo tee /tmp/setup_php
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,13 +50,13 @@ update_lists() {
|
|||||||
configure_pecl() {
|
configure_pecl() {
|
||||||
if ! [ -e /tmp/pecl_config ]; then
|
if ! [ -e /tmp/pecl_config ]; then
|
||||||
if ! command -v pecl >/dev/null || ! command -v pear >/dev/null; then
|
if ! command -v pecl >/dev/null || ! command -v pear >/dev/null; then
|
||||||
add_pecl >/dev/null 2>&1
|
add_pecl
|
||||||
fi
|
fi
|
||||||
for script in pear pecl; do
|
for script in pear pecl; do
|
||||||
sudo "$script" config-set php_ini "${pecl_file:-$ini_file}" >/dev/null 2>&1
|
sudo "$script" config-set php_ini "${pecl_file:-$ini_file}"
|
||||||
sudo "$script" channel-update "$script".php.net >/dev/null 2>&1
|
sudo "$script" channel-update "$script".php.net
|
||||||
done
|
done
|
||||||
echo '' | sudo tee /tmp/pecl_config >/dev/null 2>&1
|
echo '' | sudo tee /tmp/pecl_config
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ get_pecl_version() {
|
|||||||
# Function to install PECL extensions and accept default options
|
# Function to install PECL extensions and accept default options
|
||||||
pecl_install() {
|
pecl_install() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
yes '' | sudo pecl install -f "$extension" >/dev/null 2>&1
|
yes '' | sudo pecl install -f "$extension"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to enable existing extensions.
|
# Function to enable existing extensions.
|
||||||
@ -102,8 +102,8 @@ delete_extension() {
|
|||||||
local extension=$1
|
local extension=$1
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$ini_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$ini_file"
|
||||||
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$pecl_file"
|
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$pecl_file"
|
||||||
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
sudo rm -rf "$scan_dir"/*"$extension"*
|
||||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
sudo rm -rf "$ext_dir"/"$extension".so
|
||||||
sudo sed -i "/Package: php$version-$extension/,/^$/d" /var/lib/dpkg/status
|
sudo sed -i "/Package: php$version-$extension/,/^$/d" /var/lib/dpkg/status
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,8 +125,8 @@ add_extension() {
|
|||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
elif ! check_extension "$extension"; then
|
elif ! check_extension "$extension"; then
|
||||||
eval "$install_command" >/dev/null 2>&1 ||
|
eval "$install_command" ||
|
||||||
(update_lists && eval "$install_command" >/dev/null 2>&1) || pecl_install "$extension"
|
(update_lists && eval "$install_command" ) || pecl_install "$extension"
|
||||||
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
fi
|
fi
|
||||||
@ -149,7 +149,7 @@ add_pecl_extension() {
|
|||||||
else
|
else
|
||||||
delete_extension "$extension"
|
delete_extension "$extension"
|
||||||
(
|
(
|
||||||
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
|
sudo pecl install -f "$extension-$pecl_version" &&
|
||||||
check_extension "$extension" &&
|
check_extension "$extension" &&
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
add_log "$tick" "$extension" "Installed and enabled"
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
||||||
@ -216,9 +216,9 @@ add_tool() {
|
|||||||
elif [ "$tool" = "cs2pr" ]; then
|
elif [ "$tool" = "cs2pr" ]; then
|
||||||
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
|
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
|
||||||
elif [ "$tool" = "phive" ]; then
|
elif [ "$tool" = "phive" ]; then
|
||||||
add_extension curl "$apt_install php$version-curl" extension >/dev/null 2>&1
|
add_extension curl "$apt_install php$version-curl" extension
|
||||||
add_extension mbstring "$apt_install php$version-mbstring" extension >/dev/null 2>&1
|
add_extension mbstring "$apt_install php$version-mbstring" extension
|
||||||
add_extension xml "$apt_install php$version-xml" extension >/dev/null 2>&1
|
add_extension xml "$apt_install php$version-xml" extension
|
||||||
fi
|
fi
|
||||||
add_log "$tick" "$tool" "Added"
|
add_log "$tick" "$tool" "Added"
|
||||||
else
|
else
|
||||||
@ -233,8 +233,8 @@ add_composertool() {
|
|||||||
release=$2
|
release=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
(
|
(
|
||||||
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
sudo rm -f "$composer_lock" || true
|
||||||
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
composer global require "$prefix$release" &&
|
||||||
add_log "$tick" "$tool" "Added"
|
add_log "$tick" "$tool" "Added"
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
if [ -e "$composer_bin/composer" ]; then
|
if [ -e "$composer_bin/composer" ]; then
|
||||||
@ -248,10 +248,10 @@ add_composertool() {
|
|||||||
# Function to setup phpize and php-config
|
# Function to setup phpize and php-config
|
||||||
add_devtools() {
|
add_devtools() {
|
||||||
if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then
|
if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then
|
||||||
update_lists && $apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1
|
update_lists && $apt_install php"$version"-dev php"$version"-xml
|
||||||
fi
|
fi
|
||||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
sudo update-alternatives --set php-config /usr/bin/php-config"$version"
|
||||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
sudo update-alternatives --set phpize /usr/bin/phpize"$version"
|
||||||
configure_pecl
|
configure_pecl
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ add_packaged_php() {
|
|||||||
add_pecl() {
|
add_pecl() {
|
||||||
add_devtools
|
add_devtools
|
||||||
if [ ! -e /usr/bin/pecl ]; then
|
if [ ! -e /usr/bin/pecl ]; then
|
||||||
$apt_install php-pear >/dev/null 2>&1
|
$apt_install php-pear
|
||||||
fi
|
fi
|
||||||
configure_pecl
|
configure_pecl
|
||||||
add_log "$tick" "PECL" "Added"
|
add_log "$tick" "PECL" "Added"
|
||||||
@ -330,16 +330,16 @@ sudo mkdir -m 777 -p "$HOME/.composer" /var/run /run/php
|
|||||||
if [ "$existing_version" != "$version" ]; then
|
if [ "$existing_version" != "$version" ]; then
|
||||||
if [ ! -e "/usr/bin/php$version" ]; then
|
if [ ! -e "/usr/bin/php$version" ]; then
|
||||||
if [ "$version" = "8.0" ]; then
|
if [ "$version" = "8.0" ]; then
|
||||||
setup_master >/dev/null 2>&1
|
setup_master
|
||||||
else
|
else
|
||||||
add_packaged_php >/dev/null 2>&1
|
add_packaged_php
|
||||||
fi
|
fi
|
||||||
status="Installed"
|
status="Installed"
|
||||||
else
|
else
|
||||||
status="Switched to"
|
status="Switched to"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
switch_version >/dev/null 2>&1
|
switch_version
|
||||||
else
|
else
|
||||||
status="Found"
|
status="Found"
|
||||||
fi
|
fi
|
||||||
@ -353,9 +353,9 @@ scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
|||||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||||
pecl_file="$scan_dir"/99-pecl.ini
|
pecl_file="$scan_dir"/99-pecl.ini
|
||||||
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
echo '' | sudo tee "$pecl_file"
|
||||||
configure_php
|
configure_php
|
||||||
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
sudo rm -rf /usr/local/bin/phpunit
|
||||||
sudo chmod 777 "$ini_file" "$pecl_file" "$tool_path_dir"
|
sudo chmod 777 "$ini_file" "$pecl_file" "$tool_path_dir"
|
||||||
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
add_log "$tick" "PHP" "$status PHP $semver"
|
add_log "$tick" "PHP" "$status PHP $semver"
|
||||||
|
@ -188,7 +188,7 @@ Function Add-Tool() {
|
|||||||
if($url.Count -gt 1) { $url = $url[0] }
|
if($url.Count -gt 1) { $url = $url[0] }
|
||||||
if ($tool -eq "symfony") {
|
if ($tool -eq "symfony") {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe
|
||||||
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.exe" >$null 2>&1
|
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.exe"
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
|
||||||
@ -208,16 +208,16 @@ Function Add-Tool() {
|
|||||||
$bat_content += "SET BIN_TARGET=%~dp0/" + $tool
|
$bat_content += "SET BIN_TARGET=%~dp0/" + $tool
|
||||||
$bat_content += "php %BIN_TARGET% %*"
|
$bat_content += "php %BIN_TARGET% %*"
|
||||||
Set-Content -Path $php_dir\$tool.bat -Value $bat_content
|
Set-Content -Path $php_dir\$tool.bat -Value $bat_content
|
||||||
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.bat" >$null 2>&1
|
Add-ToProfile $current_profile $tool "New-Alias $tool $php_dir\$tool.bat"
|
||||||
if($tool -eq "composer") {
|
if($tool -eq "composer") {
|
||||||
Edit-ComposerConfig $php_dir\$tool
|
Edit-ComposerConfig $php_dir\$tool
|
||||||
} elseif($tool -eq "cs2pr") {
|
} elseif($tool -eq "cs2pr") {
|
||||||
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
|
(Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr
|
||||||
} elseif($tool -eq "phan") {
|
} elseif($tool -eq "phan") {
|
||||||
Add-Extension fileinfo >$null 2>&1
|
Add-Extension fileinfo
|
||||||
Add-Extension ast >$null 2>&1
|
Add-Extension ast
|
||||||
} elseif($tool -eq "phive") {
|
} elseif($tool -eq "phive") {
|
||||||
Add-Extension xml >$null 2>&1
|
Add-Extension xml
|
||||||
} elseif($tool -eq "wp-cli") {
|
} elseif($tool -eq "wp-cli") {
|
||||||
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
|
Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat
|
||||||
}
|
}
|
||||||
@ -286,12 +286,12 @@ if($env:PHPTS -ne 'ts') {
|
|||||||
$env:PHPTS = 'nts'
|
$env:PHPTS = 'nts'
|
||||||
}
|
}
|
||||||
if(-not(Test-Path -LiteralPath $current_profile)) {
|
if(-not(Test-Path -LiteralPath $current_profile)) {
|
||||||
New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1
|
New-Item -Path $current_profile -ItemType "file" -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
Add-Printf >$null 2>&1
|
Add-Printf
|
||||||
Step-Log "Setup PhpManager"
|
Step-Log "Setup PhpManager"
|
||||||
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php >$null 2>&1
|
Install-PSPackage PhpManager PhpManager\PhpManager "$github/mlocati/powershell-phpmanager/releases/latest/download/PhpManager.zip" Get-Php
|
||||||
Add-Log $tick "PhpManager" "Installed"
|
Add-Log $tick "PhpManager" "Installed"
|
||||||
|
|
||||||
Step-Log "Setup PHP"
|
Step-Log "Setup PHP"
|
||||||
@ -304,7 +304,7 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
|
|||||||
$status = "Installed"
|
$status = "Installed"
|
||||||
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
||||||
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
if ($version -lt '7.0' -and ($null -eq (Get-Module -ListAvailable -Name VcRedist))) {
|
||||||
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
|
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
||||||
|
@ -245,8 +245,11 @@ export async function addComposer(tools_list: string[]): Promise<string[]> {
|
|||||||
*
|
*
|
||||||
* @param version
|
* @param version
|
||||||
*/
|
*/
|
||||||
export async function getComposerUrl(version: string): Promise<string> {
|
export async function getComposerUrl(
|
||||||
let cache_url = `https://github.com/shivammathur/composer-cache/releases/latest/download/composer-${version.replace(
|
version: string,
|
||||||
|
php_version: string
|
||||||
|
): Promise<string> {
|
||||||
|
let cache_url = `https://github.com/shivammathur/composer-cache/releases/latest/download/composer-${php_version}-${version.replace(
|
||||||
'latest',
|
'latest',
|
||||||
'stable'
|
'stable'
|
||||||
)}.phar`;
|
)}.phar`;
|
||||||
@ -415,7 +418,7 @@ export async function addTools(
|
|||||||
script += await addArchive(tool, url, os_version);
|
script += await addArchive(tool, url, os_version);
|
||||||
break;
|
break;
|
||||||
case 'composer':
|
case 'composer':
|
||||||
url = await getComposerUrl(version);
|
url = await getComposerUrl(version, php_version);
|
||||||
script += await addArchive('composer', url, os_version);
|
script += await addArchive('composer', url, os_version);
|
||||||
break;
|
break;
|
||||||
case 'codeception':
|
case 'codeception':
|
||||||
|
@ -305,10 +305,10 @@ export async function getExtensionPrefix(extension: string): Promise<string> {
|
|||||||
export async function suppressOutput(os_version: string): Promise<string> {
|
export async function suppressOutput(os_version: string): Promise<string> {
|
||||||
switch (os_version) {
|
switch (os_version) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return ' >$null 2>&1';
|
return ' ';
|
||||||
case 'linux':
|
case 'linux':
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return ' >/dev/null 2>&1';
|
return ' ';
|
||||||
default:
|
default:
|
||||||
return await log(
|
return await log(
|
||||||
'Platform ' + os_version + ' is not supported',
|
'Platform ' + os_version + ' is not supported',
|
||||||
|
Reference in New Issue
Block a user