mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
commit
d384d9fe7e
13
README.md
13
README.md
@ -67,13 +67,14 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
- On `windows` extensions which have `windows` binary on `PECL` can be installed.
|
- On `windows` extensions which have `windows` binary on `PECL` can be installed.
|
||||||
- On `macOS` extensions which are on `PECL` can be installed.
|
- On `macOS` extensions which are on `PECL` can be installed.
|
||||||
- Extensions which are installed along with PHP if specified are enabled.
|
- Extensions which are installed along with PHP if specified are enabled.
|
||||||
|
- Extensions on `PECL` which do not have a latest stable version, their pre-release versions can be installed by suffixing the extension with its state i.e `alpha`, `beta`, `devel` or `snapshot` separated by a `-` like `msgpack-beta`.
|
||||||
- Extensions which cannot be installed gracefully leave an error message in the logs, the action is not interrupted.
|
- Extensions which cannot be installed gracefully leave an error message in the logs, the action is not interrupted.
|
||||||
|
|
||||||
## :wrench: Tools Support
|
## :wrench: Tools 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`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`
|
`codeception`, `composer`, `composer-prefetcher`, `deployer`, `pecl`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`, `symfony`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v1
|
uses: shivammathur/setup-php@v1
|
||||||
@ -280,7 +281,7 @@ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
|||||||
|
|
||||||
### Problem Matchers
|
### Problem Matchers
|
||||||
|
|
||||||
You can setup problem matchers for your `PHPUnit` output. This will scan the errors in your tests and surface that information prominently in the GitHub Actions UI by creating annotations and log file decorations.
|
You can setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step. This will scan the logs for failing tests and surface that information prominently in the GitHub Actions UI by creating annotations and log file decorations.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup Problem Matchers for PHPUnit
|
- name: Setup Problem Matchers for PHPUnit
|
||||||
@ -327,10 +328,10 @@ Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "sh
|
|||||||
|
|
||||||
If this action helped you.
|
If this action helped you.
|
||||||
|
|
||||||
- Please star the project and share it, this helps reach more people.
|
- Please star the project and share it with the community.
|
||||||
- If you blog, write about your experience using this.
|
- If you blog, write about your experience while using this action.
|
||||||
- Support this project on <a href="https://www.patreon.com/shivammathur"><img alt="Patreon" src="https://shivammathur.com/badges/patreon.svg"></a> or using <a href="https://www.paypal.me/shivammathur"><img alt="Paypal" src="https://shivammathur.com/badges/paypal.svg"></a>.
|
- I maintain this in my free time, please support me with a [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon") subscription or a one time contribution using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal").
|
||||||
- If you need any help using this, reach out here <a href="https://www.codementor.io/shivammathur?utm_source=github&utm_medium=button&utm_term=shivammathur&utm_campaign=github" title="Contact Shivam Mathur on Codementor"><img alt="Contact me on Codementor" src="https://cdn.codementor.io/badges/contact_me_github.svg"></a>
|
- If you need any help using this, please contact me using [Codementor](https://www.codementor.io/shivammathur "Shivam Mathur Codementor")
|
||||||
|
|
||||||
## :bookmark: This action uses the following works
|
## :bookmark: This action uses the following works
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ jest.mock('../src/extensions', () => ({
|
|||||||
|
|
||||||
describe('Config tests', () => {
|
describe('Config tests', () => {
|
||||||
it('checking addCoverage with PCOV on windows', async () => {
|
it('checking addCoverage with PCOV on windows', async () => {
|
||||||
let win32: string = await coverage.addCoverage('pcov', '7.4', 'win32');
|
let win32: string = await coverage.addCoverage('PCOV', '7.4', 'win32');
|
||||||
expect(win32).toContain('add_extension pcov');
|
expect(win32).toContain('add_extension pcov');
|
||||||
expect(win32).toContain('Remove-Extension xdebug');
|
expect(win32).toContain('Remove-Extension xdebug');
|
||||||
|
|
||||||
|
@ -3,13 +3,14 @@ import * as extensions from '../src/extensions';
|
|||||||
describe('Extension tests', () => {
|
describe('Extension tests', () => {
|
||||||
it('checking addExtensionOnWindows', async () => {
|
it('checking addExtensionOnWindows', async () => {
|
||||||
let win32: string = await extensions.addExtension(
|
let win32: string = await extensions.addExtension(
|
||||||
'xdebug, pcov, phalcon4',
|
'xdebug, pcov, phalcon4, ast-beta',
|
||||||
'7.4',
|
'7.4',
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
expect(win32).toContain('Add-Extension xdebug');
|
expect(win32).toContain('Add-Extension xdebug');
|
||||||
expect(win32).toContain('Add-Extension pcov');
|
expect(win32).toContain('Add-Extension pcov');
|
||||||
expect(win32).toContain('phalcon.ps1 phalcon4');
|
expect(win32).toContain('phalcon.ps1 phalcon4');
|
||||||
|
expect(win32).toContain('Add-Extension ast beta');
|
||||||
|
|
||||||
win32 = await extensions.addExtension(
|
win32 = await extensions.addExtension(
|
||||||
'phalcon3, does_not_exist',
|
'phalcon3, does_not_exist',
|
||||||
@ -26,7 +27,7 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
it('checking addExtensionOnLinux', async () => {
|
it('checking addExtensionOnLinux', async () => {
|
||||||
let linux: string = await extensions.addExtension(
|
let linux: string = await extensions.addExtension(
|
||||||
'xdebug, pcov',
|
'xdebug, pcov, ast-beta',
|
||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
@ -34,7 +35,8 @@ describe('Extension tests', () => {
|
|||||||
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'
|
||||||
);
|
);
|
||||||
expect(linux).toContain('pecl install pcov');
|
expect(linux).toContain('pecl install -f pcov');
|
||||||
|
expect(linux).toContain('install_extension ast-beta');
|
||||||
|
|
||||||
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
||||||
expect(linux).toContain('gearman.sh 7.0');
|
expect(linux).toContain('gearman.sh 7.0');
|
||||||
@ -60,12 +62,13 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
it('checking addExtensionOnDarwin', async () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
let darwin: string = await extensions.addExtension(
|
let darwin: string = await extensions.addExtension(
|
||||||
'xdebug, pcov',
|
'xdebug, pcov, ast-beta',
|
||||||
'7.2',
|
'7.2',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(darwin).toContain('sudo pecl install xdebug');
|
expect(darwin).toContain('sudo pecl install -f xdebug');
|
||||||
expect(darwin).toContain('sudo pecl install pcov');
|
expect(darwin).toContain('sudo pecl install -f pcov');
|
||||||
|
expect(darwin).toContain('install_extension ast-beta');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
||||||
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
|
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
|
||||||
@ -74,33 +77,33 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
|
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install pcov');
|
expect(darwin).toContain('sudo pecl install -f pcov');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install pcov');
|
expect(darwin).toContain('sudo pecl install -f pcov');
|
||||||
|
|
||||||
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 -f xdebug-2.5.5');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
|
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install xdebug-2.9.0');
|
expect(darwin).toContain('sudo pecl install -f 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 -f xdebug');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install redis-2.2.8');
|
expect(darwin).toContain('sudo pecl install -f redis-2.2.8');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install redis');
|
expect(darwin).toContain('sudo pecl install -f redis');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
|
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('brew install pkg-config imagemagick');
|
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||||
expect(darwin).toContain('sudo pecl install imagick');
|
expect(darwin).toContain('sudo pecl install -f imagick');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
|
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
|
||||||
expect(darwin).toContain('brew install pkg-config imagemagick');
|
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||||
expect(darwin).toContain('sudo pecl install imagick');
|
expect(darwin).toContain('sudo pecl install -f imagick');
|
||||||
|
|
||||||
darwin = await extensions.addExtension(
|
darwin = await extensions.addExtension(
|
||||||
'does_not_exist',
|
'does_not_exist',
|
||||||
|
@ -23,7 +23,7 @@ describe('Matchers', () => {
|
|||||||
|
|
||||||
it('Test Regex', async () => {
|
it('Test Regex', async () => {
|
||||||
const regex1 = /^\d+\)\s.*$/;
|
const regex1 = /^\d+\)\s.*$/;
|
||||||
const regex2 = /^(.*)$/;
|
const regex2 = /^(.*Failed\sasserting\sthat.*)$/;
|
||||||
const regex3 = /^\s*$/;
|
const regex3 = /^\s*$/;
|
||||||
const regex4 = /^(.*):(\d+)$/;
|
const regex4 = /^(.*):(\d+)$/;
|
||||||
expect(regex1.test('1) Tests\\Test::it_tests')).toBe(true);
|
expect(regex1.test('1) Tests\\Test::it_tests')).toBe(true);
|
||||||
|
@ -206,6 +206,30 @@ describe('Tools tests', () => {
|
|||||||
).toStrictEqual(['composer', 'a', 'b']);
|
).toStrictEqual(['composer', 'a', 'b']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking getSymfonyUri', async () => {
|
||||||
|
expect(await tools.getSymfonyUri('latest', 'linux')).toContain(
|
||||||
|
'releases/latest/download/symfony_linux_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'linux')).toContain(
|
||||||
|
'releases/download/v1.2.3/symfony_linux_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('latest', 'darwin')).toContain(
|
||||||
|
'releases/latest/download/symfony_darwin_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'darwin')).toContain(
|
||||||
|
'releases/download/v1.2.3/symfony_darwin_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('latest', 'win32')).toContain(
|
||||||
|
'releases/latest/download/symfony_windows_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'win32')).toContain(
|
||||||
|
'releases/download/v1.2.3/symfony_windows_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'fedora')).toContain(
|
||||||
|
'Platform fedora is not supported'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('checking getCleanedToolsList', async () => {
|
it('checking getCleanedToolsList', async () => {
|
||||||
const tools_list: string[] = await tools.getCleanedToolsList(
|
const tools_list: string[] = await tools.getCleanedToolsList(
|
||||||
'tool, composer:1.2.3, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher'
|
'tool, composer:1.2.3, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher'
|
||||||
@ -301,7 +325,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, phive, php-config, phpize',
|
'php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony',
|
||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
@ -320,6 +344,9 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://phar.phpunit.de/phpunit.phar phpunit'
|
'add_tool https://phar.phpunit.de/phpunit.phar phpunit'
|
||||||
);
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony'
|
||||||
|
);
|
||||||
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/');
|
||||||
@ -329,7 +356,7 @@ describe('Tools tests', () => {
|
|||||||
});
|
});
|
||||||
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, phive:1.2.3, composer-prefetcher:1.2.3, phpize, php-config',
|
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, phive:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3',
|
||||||
'7.4',
|
'7.4',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
@ -358,12 +385,18 @@ 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_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony'
|
||||||
|
);
|
||||||
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
expect(script).toContain('add_log "$tick" "php-config" "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, phive:0.13.2, php-config, phpize, does_not_exit',
|
'codeception, deployer, prestissimo, phpmd, phinx, phive:0.13.2, php-config, phpize, symfony, does_not_exit',
|
||||||
'7.4',
|
'7.4',
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
@ -383,6 +416,9 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive'
|
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.2/phive-0.13.2.phar phive'
|
||||||
);
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Tool https://github.com/symfony/cli/releases/latest/download/symfony_windows_amd64.exe symfony'
|
||||||
|
);
|
||||||
expect(script).toContain('phpize is not a windows tool');
|
expect(script).toContain('phpize is not a windows tool');
|
||||||
expect(script).toContain('php-config 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');
|
||||||
|
120
dist/index.js
vendored
120
dist/index.js
vendored
@ -1262,17 +1262,24 @@ module.exports = require("assert");
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = __webpack_require__(87);
|
const os = __importStar(__webpack_require__(87));
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
* Command Format:
|
* Command Format:
|
||||||
* ##[name key=value;key=value]message
|
* ::name key=value,key=value::message
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* ##[warning]This is the user warning message
|
* ::warning::This is the message
|
||||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
* ::set-env name=MY_VAR::some value
|
||||||
*/
|
*/
|
||||||
function issueCommand(command, properties, message) {
|
function issueCommand(command, properties, message) {
|
||||||
const cmd = new Command(command, properties, message);
|
const cmd = new Command(command, properties, message);
|
||||||
@ -1308,30 +1315,28 @@ class Command {
|
|||||||
else {
|
else {
|
||||||
cmdStr += ',';
|
cmdStr += ',';
|
||||||
}
|
}
|
||||||
// safely append the val - avoid blowing up when attempting to
|
cmdStr += `${key}=${escapeProperty(val)}`;
|
||||||
// call .replace() if message is not a string for some reason
|
|
||||||
cmdStr += `${key}=${escape(`${val || ''}`)}`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmdStr += CMD_STRING;
|
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
||||||
// safely append the message - avoid blowing up when attempting to
|
|
||||||
// call .replace() if message is not a string for some reason
|
|
||||||
const message = `${this.message || ''}`;
|
|
||||||
cmdStr += escapeData(message);
|
|
||||||
return cmdStr;
|
return cmdStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function escapeData(s) {
|
function escapeData(s) {
|
||||||
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
return (s || '')
|
||||||
|
.replace(/%/g, '%25')
|
||||||
|
.replace(/\r/g, '%0D')
|
||||||
|
.replace(/\n/g, '%0A');
|
||||||
}
|
}
|
||||||
function escape(s) {
|
function escapeProperty(s) {
|
||||||
return s
|
return (s || '')
|
||||||
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A')
|
.replace(/\n/g, '%0A')
|
||||||
.replace(/]/g, '%5D')
|
.replace(/:/g, '%3A')
|
||||||
.replace(/;/g, '%3B');
|
.replace(/,/g, '%2C');
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=command.js.map
|
//# sourceMappingURL=command.js.map
|
||||||
|
|
||||||
@ -1351,10 +1356,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const command_1 = __webpack_require__(431);
|
const command_1 = __webpack_require__(431);
|
||||||
const os = __webpack_require__(87);
|
const os = __importStar(__webpack_require__(87));
|
||||||
const path = __webpack_require__(622);
|
const path = __importStar(__webpack_require__(622));
|
||||||
/**
|
/**
|
||||||
* The code to exit an action
|
* The code to exit an action
|
||||||
*/
|
*/
|
||||||
@ -1790,6 +1802,35 @@ function getDeployerUrl(version) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getDeployerUrl = getDeployerUrl;
|
exports.getDeployerUrl = getDeployerUrl;
|
||||||
|
/**
|
||||||
|
* Function to get the Deployer url
|
||||||
|
*
|
||||||
|
* @param version
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
function getSymfonyUri(version, os_version) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let filename = '';
|
||||||
|
switch (os_version) {
|
||||||
|
case 'linux':
|
||||||
|
case 'darwin':
|
||||||
|
filename = 'symfony_' + os_version + '_amd64';
|
||||||
|
break;
|
||||||
|
case 'win32':
|
||||||
|
filename = 'symfony_windows_amd64.exe';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||||
|
}
|
||||||
|
switch (version) {
|
||||||
|
case 'latest':
|
||||||
|
return 'releases/latest/download/' + filename;
|
||||||
|
default:
|
||||||
|
return 'releases/download/v' + version + '/' + filename;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.getSymfonyUri = getSymfonyUri;
|
||||||
/**
|
/**
|
||||||
* Function to add/move composer in the tools list
|
* Function to add/move composer in the tools list
|
||||||
*
|
*
|
||||||
@ -1964,6 +2005,12 @@ function addTools(tools_csv, php_version, os_version) {
|
|||||||
case 'phpize':
|
case 'phpize':
|
||||||
script += yield addDevTools(tool, os_version);
|
script += yield addDevTools(tool, os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'symfony':
|
||||||
|
case 'symfony-cli':
|
||||||
|
uri = yield getSymfonyUri(version, os_version);
|
||||||
|
url = github + 'symfony/cli/' + uri;
|
||||||
|
script += yield addArchive('symfony', version, url, 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;
|
||||||
@ -2116,7 +2163,7 @@ exports.disableCoverage = disableCoverage;
|
|||||||
*/
|
*/
|
||||||
function addCoverage(coverage_driver, version, os_version) {
|
function addCoverage(coverage_driver, version, os_version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
coverage_driver.toLowerCase();
|
coverage_driver = coverage_driver.toLowerCase();
|
||||||
const script = '\n' + (yield utils.stepLog('Setup Coverage', os_version));
|
const script = '\n' + (yield utils.stepLog('Setup Coverage', os_version));
|
||||||
const pipe = yield utils.suppressOutput(os_version);
|
const pipe = yield utils.suppressOutput(os_version);
|
||||||
switch (coverage_driver) {
|
switch (coverage_driver) {
|
||||||
@ -2278,13 +2325,15 @@ function build(filename, version, os_version) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// taking inputs
|
// taking inputs
|
||||||
const extension_csv = (yield utils.getInput('extensions', false)) ||
|
const extension_csv = (yield utils.getInput('extensions', false)) ||
|
||||||
|
(yield utils.getInput('extension', false)) ||
|
||||||
(yield utils.getInput('extension-csv', false));
|
(yield utils.getInput('extension-csv', false));
|
||||||
const ini_values_csv = (yield utils.getInput('ini-values', false)) ||
|
const ini_values_csv = (yield utils.getInput('ini-values', false)) ||
|
||||||
(yield utils.getInput('ini-values-csv', false));
|
(yield utils.getInput('ini-values-csv', false));
|
||||||
const coverage_driver = yield utils.getInput('coverage', false);
|
const coverage_driver = yield utils.getInput('coverage', false);
|
||||||
const pecl = yield utils.getInput('pecl', false);
|
const pecl = yield utils.getInput('pecl', false);
|
||||||
let tools_csv = yield utils.getInput('tools', false);
|
let tools_csv = yield utils.getInput('tools', false);
|
||||||
if (pecl == 'true') {
|
if (pecl == 'true' ||
|
||||||
|
/.*-(beta|alpha|devel|snapshot).*/.test(extension_csv)) {
|
||||||
tools_csv = 'pecl, ' + tools_csv;
|
tools_csv = 'pecl, ' + tools_csv;
|
||||||
}
|
}
|
||||||
let script = yield utils.readScript(filename, version, os_version);
|
let script = yield utils.readScript(filename, version, os_version);
|
||||||
@ -2593,23 +2642,26 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
// add script to enable extension is already installed along with php
|
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
install_command = 'install_extension ' + extension + pipe;
|
||||||
|
break;
|
||||||
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 -f xdebug-2.5.5' + pipe;
|
||||||
break;
|
break;
|
||||||
case /7\.0xdebug/.test(version_extension):
|
case /7\.0xdebug/.test(version_extension):
|
||||||
install_command = 'sudo pecl install xdebug-2.9.0' + pipe;
|
install_command = 'sudo pecl install -f xdebug-2.9.0' + pipe;
|
||||||
break;
|
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 -f redis-2.2.8' + pipe;
|
||||||
break;
|
break;
|
||||||
case /[5-9]\.\dimagick/.test(version_extension):
|
case /[5-9]\.\dimagick/.test(version_extension):
|
||||||
install_command =
|
install_command =
|
||||||
'brew install pkg-config imagemagick' +
|
'brew install pkg-config imagemagick' +
|
||||||
pipe +
|
pipe +
|
||||||
' && sudo pecl install imagick' +
|
' && sudo pecl install -f imagick' +
|
||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
@ -2623,7 +2675,7 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
install_command = 'sudo pecl install ' + extension + pipe;
|
install_command = 'sudo pecl install -f ' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
script +=
|
script +=
|
||||||
@ -2652,9 +2704,14 @@ function addExtensionWindows(extension_csv, version, pipe) {
|
|||||||
let script = '\n';
|
let script = '\n';
|
||||||
yield utils.asyncForEach(extensions, function (extension) {
|
yield utils.asyncForEach(extensions, function (extension) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// add script to enable extension is already installed along with php
|
extension = extension.toLowerCase();
|
||||||
|
const [extension_name, stability] = extension.split('-');
|
||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
script += '\nAdd-Extension ' + extension_name + ' ' + stability;
|
||||||
|
break;
|
||||||
// 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):
|
||||||
script +=
|
script +=
|
||||||
@ -2690,10 +2747,13 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
yield utils.asyncForEach(extensions, function (extension) {
|
yield utils.asyncForEach(extensions, function (extension) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
// add script to enable extension is already installed along with php
|
|
||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
install_command = 'install_extension ' + extension + pipe;
|
||||||
|
break;
|
||||||
// match 5.6gearman..7.4gearman
|
// match 5.6gearman..7.4gearman
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
install_command =
|
install_command =
|
||||||
@ -2728,7 +2788,7 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
'-' +
|
'-' +
|
||||||
extension.replace('pdo_', '').replace('pdo-', '') +
|
extension.replace('pdo_', '').replace('pdo-', '') +
|
||||||
pipe +
|
pipe +
|
||||||
' || sudo pecl install ' +
|
' || sudo pecl install -f ' +
|
||||||
extension +
|
extension +
|
||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
|
32
package-lock.json
generated
32
package-lock.json
generated
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.7.4",
|
"version": "1.8.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": {
|
"@actions/core": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
|
||||||
"integrity": "sha512-xD+CQd9p4lU7ZfRqmUcbJpqR+Ss51rJRVeXMyOLrZQImN9/8Sy/BEUBnHO/UKD3z03R686PVTLfEPmkropGuLw=="
|
"integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg=="
|
||||||
},
|
},
|
||||||
"@actions/exec": {
|
"@actions/exec": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
@ -710,9 +710,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/jest": {
|
"@types/jest": {
|
||||||
"version": "24.9.0",
|
"version": "24.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.9.1.tgz",
|
||||||
"integrity": "sha512-dXvuABY9nM1xgsXlOtLQXJKdacxZJd7AtvLsKZ/0b57ruMXDKCOXAC/M75GbllQX6o1pcZ5hAG4JzYy7Z/wM2w==",
|
"integrity": "sha512-Fb38HkXSVA4L8fGKEZ6le5bB8r6MRWlOCZbVuWZcmOMSCd2wCYOwN1ibj8daIoV9naq7aaOZjrLCoCMptKU/4Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"jest-diff": "^24.3.0"
|
"jest-diff": "^24.3.0"
|
||||||
@ -743,9 +743,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/yargs": {
|
"@types/yargs": {
|
||||||
"version": "13.0.5",
|
"version": "13.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.6.tgz",
|
||||||
"integrity": "sha512-CF/+sxTO7FOwbIRL4wMv0ZYLCRfMid2HQpzDRyViH7kSpfoAFiMdGqKIxb1PxWfjtQXQhnQuD33lvRHNwr809Q==",
|
"integrity": "sha512-IkltIncDQWv6fcAvnHtJ6KtkmY/vtR3bViOaCzpj/A3yNhlfZAgxNe6AEQD1cQrkYD+YsKVo08DSxvNKEsD7BA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/yargs-parser": "*"
|
"@types/yargs-parser": "*"
|
||||||
@ -3514,9 +3514,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"inquirer": {
|
"inquirer": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.4.tgz",
|
||||||
"integrity": "sha512-+OiOVeVydu4hnCGLCSX+wedovR/Yzskv9BFqUNNKq9uU2qg7LCcCo3R86S2E7WLo0y/x2pnEZfZe1CoYnORUAw==",
|
"integrity": "sha512-Bu5Td5+j11sCkqfqmUTiwv+tWisMtP0L7Q8WrqA2C/BbBhy1YTdFrvjjlrKq8oagA/tLQBski2Gcx/Sqyi2qSQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-escapes": "^4.2.1",
|
"ansi-escapes": "^4.2.1",
|
||||||
@ -5636,9 +5636,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"resolve": {
|
"resolve": {
|
||||||
"version": "1.14.2",
|
"version": "1.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.2.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz",
|
||||||
"integrity": "sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ==",
|
"integrity": "sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"path-parse": "^1.0.6"
|
"path-parse": "^1.0.6"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.7.4",
|
"version": "1.8.0",
|
||||||
"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",
|
||||||
@ -50,7 +50,7 @@
|
|||||||
"husky": {
|
"husky": {
|
||||||
"skipCI": true,
|
"skipCI": true,
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"pre-commit": "npm run build && npm run format && npm run release"
|
"pre-commit": "npm run format && npm run lint && npm run build && npm run release"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"regexp": "^\\d+\\)\\s.*$"
|
"regexp": "^\\d+\\)\\s.*$"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"regexp": "^(.*)$",
|
"regexp": "^(.*Failed\\sasserting\\sthat.*)$",
|
||||||
"message": 1
|
"message": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ export async function addCoverage(
|
|||||||
version: string,
|
version: string,
|
||||||
os_version: string
|
os_version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
coverage_driver.toLowerCase();
|
coverage_driver = coverage_driver.toLowerCase();
|
||||||
const script: string =
|
const script: string =
|
||||||
'\n' + (await utils.stepLog('Setup Coverage', os_version));
|
'\n' + (await utils.stepLog('Setup Coverage', os_version));
|
||||||
const pipe: string = await utils.suppressOutput(os_version);
|
const pipe: string = await utils.suppressOutput(os_version);
|
||||||
|
@ -18,23 +18,26 @@ export async function addExtensionDarwin(
|
|||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
// add script to enable extension is already installed along with php
|
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
install_command = 'install_extension ' + extension + pipe;
|
||||||
|
break;
|
||||||
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 -f xdebug-2.5.5' + pipe;
|
||||||
break;
|
break;
|
||||||
case /7\.0xdebug/.test(version_extension):
|
case /7\.0xdebug/.test(version_extension):
|
||||||
install_command = 'sudo pecl install xdebug-2.9.0' + pipe;
|
install_command = 'sudo pecl install -f xdebug-2.9.0' + pipe;
|
||||||
break;
|
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 -f redis-2.2.8' + pipe;
|
||||||
break;
|
break;
|
||||||
case /[5-9]\.\dimagick/.test(version_extension):
|
case /[5-9]\.\dimagick/.test(version_extension):
|
||||||
install_command =
|
install_command =
|
||||||
'brew install pkg-config imagemagick' +
|
'brew install pkg-config imagemagick' +
|
||||||
pipe +
|
pipe +
|
||||||
' && sudo pecl install imagick' +
|
' && sudo pecl install -f imagick' +
|
||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
@ -48,7 +51,7 @@ export async function addExtensionDarwin(
|
|||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
install_command = 'sudo pecl install ' + extension + pipe;
|
install_command = 'sudo pecl install -f ' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
script +=
|
script +=
|
||||||
@ -77,9 +80,14 @@ export async function addExtensionWindows(
|
|||||||
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
||||||
let script = '\n';
|
let script = '\n';
|
||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
// add script to enable extension is already installed along with php
|
extension = extension.toLowerCase();
|
||||||
|
const [extension_name, stability]: string[] = extension.split('-');
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
script += '\nAdd-Extension ' + extension_name + ' ' + stability;
|
||||||
|
break;
|
||||||
// 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):
|
||||||
script +=
|
script +=
|
||||||
@ -115,10 +123,13 @@ export async function addExtensionLinux(
|
|||||||
let script = '\n';
|
let script = '\n';
|
||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
// add script to enable extension is already installed along with php
|
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
install_command = 'install_extension ' + extension + pipe;
|
||||||
|
break;
|
||||||
// match 5.6gearman..7.4gearman
|
// match 5.6gearman..7.4gearman
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
install_command =
|
install_command =
|
||||||
@ -153,7 +164,7 @@ export async function addExtensionLinux(
|
|||||||
'-' +
|
'-' +
|
||||||
extension.replace('pdo_', '').replace('pdo-', '') +
|
extension.replace('pdo_', '').replace('pdo-', '') +
|
||||||
pipe +
|
pipe +
|
||||||
' || sudo pecl install ' +
|
' || sudo pecl install -f ' +
|
||||||
extension +
|
extension +
|
||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
|
@ -22,6 +22,7 @@ export async function build(
|
|||||||
// taking inputs
|
// taking inputs
|
||||||
const extension_csv: string =
|
const extension_csv: string =
|
||||||
(await utils.getInput('extensions', false)) ||
|
(await utils.getInput('extensions', false)) ||
|
||||||
|
(await utils.getInput('extension', false)) ||
|
||||||
(await utils.getInput('extension-csv', false));
|
(await utils.getInput('extension-csv', false));
|
||||||
const ini_values_csv: string =
|
const ini_values_csv: string =
|
||||||
(await utils.getInput('ini-values', false)) ||
|
(await utils.getInput('ini-values', false)) ||
|
||||||
@ -29,7 +30,10 @@ export async function build(
|
|||||||
const coverage_driver: string = await utils.getInput('coverage', false);
|
const coverage_driver: string = await utils.getInput('coverage', false);
|
||||||
const pecl: string = await utils.getInput('pecl', false);
|
const pecl: string = await utils.getInput('pecl', false);
|
||||||
let tools_csv: string = await utils.getInput('tools', false);
|
let tools_csv: string = await utils.getInput('tools', false);
|
||||||
if (pecl == 'true') {
|
if (
|
||||||
|
pecl == 'true' ||
|
||||||
|
/.*-(beta|alpha|devel|snapshot).*/.test(extension_csv)
|
||||||
|
) {
|
||||||
tools_csv = 'pecl, ' + tools_csv;
|
tools_csv = 'pecl, ' + tools_csv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,20 +26,21 @@ add_extension() {
|
|||||||
elif php -m | grep -i -q -w "$extension"; then
|
elif php -m | grep -i -q -w "$extension"; then
|
||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
elif ! php -m | grep -i -q -w "$extension"; then
|
elif ! php -m | grep -i -q -w "$extension"; then
|
||||||
exists=$(curl -sL https://pecl.php.net/json.php?package="$extension" -w "%{http_code}" -o /dev/null)
|
(eval "$install_command" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
if [ "$exists" = "200" ] || [[ "$extension" == "phalcon"* ]]; then
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
(
|
|
||||||
eval "$install_command" && \
|
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
|
||||||
else
|
|
||||||
if ! php -m | grep -i -q -w "$extension"; then
|
|
||||||
add_log "$cross" "$extension" "Could not find $extension for PHP $semver on PECL"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to force install extensions using PECL
|
||||||
|
install_extension() {
|
||||||
|
extension=$1
|
||||||
|
extension_name="$(echo "$extension" | cut -d'-' -f 1)"
|
||||||
|
sudo sed -i "/$extension_name/d" "$ini_file"
|
||||||
|
sudo rm -rf /etc/php/"$version"/cli/conf.d/*"$extension_name"* >/dev/null 2>&1
|
||||||
|
sudo rm -rf "$ext_dir"/"$extension_name".so >/dev/null 2>&1
|
||||||
|
sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
# Function to remove extensions
|
# Function to remove extensions
|
||||||
remove_extension() {
|
remove_extension() {
|
||||||
extension=$1
|
extension=$1
|
||||||
@ -86,6 +87,10 @@ add_composer_tool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
|
sudo pear config-set php_ini "$ini_file" >/dev/null 2>&1
|
||||||
|
sudo pear config-set auto_discover 1 >/dev/null 2>&1
|
||||||
|
sudo pear channel-update pear.php.net >/dev/null 2>&1
|
||||||
|
sudo pecl channel-update pecl.php.net >/dev/null 2>&1
|
||||||
add_log "$tick" "PECL" "Added"
|
add_log "$tick" "PECL" "Added"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +111,7 @@ version=$1
|
|||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
setup_php_and_composer
|
setup_php_and_composer
|
||||||
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
echo "date.timezone=UTC" >> "$ini_file"
|
echo "date.timezone=UTC" >>"$ini_file"
|
||||||
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
||||||
sudo chmod 777 "$ini_file"
|
sudo chmod 777 "$ini_file"
|
||||||
mkdir -p "$(pecl config-get ext_dir)"
|
mkdir -p "$(pecl config-get ext_dir)"
|
||||||
|
@ -38,6 +38,17 @@ add_extension() {
|
|||||||
(update_ppa && eval "$install_command" && add_log "$tick" "$extension" "Installed and enabled") ||
|
(update_ppa && eval "$install_command" && 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
|
||||||
|
sudo chmod 777 "$ini_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to force install extensions using PECL
|
||||||
|
install_extension() {
|
||||||
|
extension=$1
|
||||||
|
extension_name="$(echo "$extension" | cut -d'-' -f 1)"
|
||||||
|
sudo sed -i "/$extension_name/d" "$ini_file"
|
||||||
|
sudo rm -rf /etc/php/"$version"/cli/conf.d/*"$extension_name"* >/dev/null 2>&1
|
||||||
|
sudo rm -rf "$ext_dir"/"$extension_name".so >/dev/null 2>&1
|
||||||
|
sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to remove extensions
|
# Function to remove extensions
|
||||||
@ -125,14 +136,12 @@ setup_master() {
|
|||||||
|
|
||||||
# Function to setup PECL
|
# Function to setup PECL
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
update_ppa
|
|
||||||
add_devtools
|
add_devtools
|
||||||
wget https://github.com/pear/pearweb_phars/raw/master/install-pear-nozlib.phar >/dev/null 2>&1
|
$apt_install php-pear >/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 pear config-set php_ini "$ini_file" >/dev/null 2>&1
|
sudo pear config-set php_ini "$ini_file" >/dev/null 2>&1
|
||||||
sudo pear config-set auto_discover 1 >/dev/null 2>&1
|
sudo pear config-set auto_discover 1 >/dev/null 2>&1
|
||||||
sudo pear channel-update pear.php.net >/dev/null 2>&1
|
sudo pear channel-update pear.php.net >/dev/null 2>&1
|
||||||
|
sudo pecl channel-update pecl.php.net >/dev/null 2>&1
|
||||||
add_log "$tick" "PECL" "Added"
|
add_log "$tick" "PECL" "Added"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ Function Add-Extension {
|
|||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension }
|
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension }
|
||||||
if ($null -ne $extension_info) {
|
if ($null -ne $extension_info -and $mininum_stability -eq 'stable') {
|
||||||
switch ($extension_info.State) {
|
switch ($extension_info.State) {
|
||||||
'Builtin' {
|
'Builtin' {
|
||||||
Add-Log $tick $extension "Enabled"
|
Add-Log $tick $extension "Enabled"
|
||||||
@ -51,9 +51,13 @@ Function Add-Extension {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Install-PhpExtension -Extension $extension -MinimumStability $mininum_stability -Path $php_dir
|
Install-PhpExtension -Extension $extension -MinimumStability $mininum_stability -Path $php_dir
|
||||||
|
if($mininum_stability -ne 'stable') {
|
||||||
|
Add-Log $tick "$extension-$mininum_stability" "Installed and enabled"
|
||||||
|
} else {
|
||||||
Add-Log $tick $extension "Installed and enabled"
|
Add-Log $tick $extension "Installed and enabled"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch {
|
catch {
|
||||||
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
|
||||||
}
|
}
|
||||||
@ -75,7 +79,6 @@ Function Remove-Extension() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup a remote tool
|
|
||||||
Function Add-Tool() {
|
Function Add-Tool() {
|
||||||
Param (
|
Param (
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
@ -89,14 +92,16 @@ Function Add-Tool() {
|
|||||||
[string]
|
[string]
|
||||||
$tool
|
$tool
|
||||||
)
|
)
|
||||||
if($tool -eq "composer") {
|
|
||||||
Install-Composer -Scope System -Path $php_dir -PhpPath $php_dir
|
|
||||||
composer -q global config process-timeout 0
|
|
||||||
Add-Log $tick $tool "Added"
|
|
||||||
} else {
|
|
||||||
if (Test-Path $php_dir\$tool) {
|
if (Test-Path $php_dir\$tool) {
|
||||||
Remove-Item $php_dir\$tool
|
Remove-Item $php_dir\$tool
|
||||||
}
|
}
|
||||||
|
if ($tool -eq "composer") {
|
||||||
|
Install-Composer -Scope System -Path $php_dir -PhpPath $php_dir
|
||||||
|
composer -q global config process-timeout 0
|
||||||
|
} elseif ($tool -eq "symfony") {
|
||||||
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe
|
||||||
|
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.exe" > $null 2>&1
|
||||||
|
} else {
|
||||||
try {
|
try {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
|
||||||
$bat_content = @()
|
$bat_content = @()
|
||||||
@ -106,20 +111,18 @@ Function Add-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-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.bat" > $null 2>&1
|
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.bat" > $null 2>&1
|
||||||
if (Test-Path $php_dir\$tool) {
|
} catch { }
|
||||||
Add-Log $tick $tool "Added"
|
|
||||||
} else {
|
|
||||||
Add-Log $cross $tool "Could not add $tool"
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
Add-Log $cross $tool "Could not add $tool"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if($tool -eq "phive") {
|
if($tool -eq "phive") {
|
||||||
Add-Extension curl >$null 2>&1
|
Add-Extension curl >$null 2>&1
|
||||||
Add-Extension mbstring >$null 2>&1
|
Add-Extension mbstring >$null 2>&1
|
||||||
Add-Extension xml >$null 2>&1
|
Add-Extension xml >$null 2>&1
|
||||||
}
|
}
|
||||||
|
if (((Get-ChildItem -Path $php_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) {
|
||||||
|
Add-Log $tick $tool "Added"
|
||||||
|
} else {
|
||||||
|
Add-Log $cross $tool "Could not add $tool"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Function Add-Composer-Tool() {
|
Function Add-Composer-Tool() {
|
||||||
@ -151,7 +154,7 @@ Function Add-Composer-Tool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Function Add-PECL() {
|
Function Add-PECL() {
|
||||||
Add-Log $tick "PECL" "Use extensions input or Install-PhpExtension to setup PECL extensions on windows"
|
Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
|
40
src/tools.ts
40
src/tools.ts
@ -243,6 +243,40 @@ export async function getDeployerUrl(version: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to get the Deployer url
|
||||||
|
*
|
||||||
|
* @param version
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
export async function getSymfonyUri(
|
||||||
|
version: string,
|
||||||
|
os_version: string
|
||||||
|
): Promise<string> {
|
||||||
|
let filename = '';
|
||||||
|
switch (os_version) {
|
||||||
|
case 'linux':
|
||||||
|
case 'darwin':
|
||||||
|
filename = 'symfony_' + os_version + '_amd64';
|
||||||
|
break;
|
||||||
|
case 'win32':
|
||||||
|
filename = 'symfony_windows_amd64.exe';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return await utils.log(
|
||||||
|
'Platform ' + os_version + ' is not supported',
|
||||||
|
os_version,
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
switch (version) {
|
||||||
|
case 'latest':
|
||||||
|
return 'releases/latest/download/' + filename;
|
||||||
|
default:
|
||||||
|
return 'releases/download/v' + version + '/' + filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to add/move composer in the tools list
|
* Function to add/move composer in the tools list
|
||||||
*
|
*
|
||||||
@ -440,6 +474,12 @@ export async function addTools(
|
|||||||
case 'phpize':
|
case 'phpize':
|
||||||
script += await addDevTools(tool, os_version);
|
script += await addDevTools(tool, os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'symfony':
|
||||||
|
case 'symfony-cli':
|
||||||
|
uri = await getSymfonyUri(version, os_version);
|
||||||
|
url = github + 'symfony/cli/' + uri;
|
||||||
|
script += await addArchive('symfony', version, url, os_version);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
script += await utils.addLog(
|
script += await utils.addLog(
|
||||||
'$cross',
|
'$cross',
|
||||||
|
Loading…
Reference in New Issue
Block a user