Compare commits

...

23 Commits
1.7.3 ... 1.8.0

Author SHA1 Message Date
d384d9fe7e Merge pull request #167 from shivammathur/develop
1.8.0
2020-01-26 18:21:58 +05:30
4eeaf5f99e Handle extensions input typo 2020-01-26 18:05:27 +05:30
fd2392db56 Fix check for testing tools setup 2020-01-26 17:21:04 +05:30
494dde7189 Bump version to 1.8.0 2020-01-26 16:25:58 +05:30
706dfca1e6 Add lint to pre-commit hook 2020-01-26 16:21:25 +05:30
d613c975f6 Fix lowercasing of coverage driver 2020-01-26 16:15:39 +05:30
fbe1419ce4 Update Readme for 1.8.0 2020-01-26 16:04:18 +05:30
c844c7b6e4 Add support for symfony in tools input 2020-01-26 12:06:55 +05:30
8e5cc09df9 Fix PHPUnit problem matchers 2020-01-26 04:59:20 +05:30
f4f8aec1f2 Fix php.ini permissions after extension setup 2020-01-26 03:23:41 +05:30
b44b7344e0 Add support for pre-release pecl extensions 2020-01-26 02:27:40 +05:30
e01b2f0bf7 Merge pull request #157 from shivammathur/develop
Fix description in actions.yml
2020-01-22 02:20:27 +05:30
f7f8ecb931 Fix description in actions.yml 2020-01-22 01:54:16 +05:30
4f0d810cbc Merge pull request #156 from shivammathur/develop
1.7.4
2020-01-22 01:48:36 +05:30
47335179aa Bump version to 1.7.4 2020-01-22 01:13:19 +05:30
63c4aea452 Refactor scripts to enable pre-existing ext-phalcon 2020-01-21 19:53:17 +05:30
898b6fa1f9 macOS-latest -> macos-latest 2020-01-21 08:25:14 +05:30
747c8838bc Add phive and ts support to readme 2020-01-21 08:24:33 +05:30
9d6b61c5af Add support for phive 2020-01-21 07:21:36 +05:30
5108c81610 Add support for ext-imagick on darwin 2020-01-21 01:06:31 +05:30
e58c704985 Use ppa:ondrej/php for phalcon4 on PHP7.4 2020-01-21 00:50:38 +05:30
e9c783eef0 Add support for specifying nts/ts builds on windows 2020-01-21 00:44:53 +05:30
b44e5e009f Use ppa:ondrej/php for phalcon except for PHP7.4 2020-01-20 21:07:51 +05:30
31 changed files with 660 additions and 260 deletions

View File

@ -25,7 +25,7 @@ jobs:
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['8.0']
steps:
- name: Checkout

View File

@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
steps:
- name: Checkout

View File

@ -28,7 +28,8 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
- [Usage](#memo-usage)
- [Basic Setup](#basic-setup)
- [Matrix Setup](#matrix-setup)
- [Experimental Setup](#experimental-setup)
- [Experimental Setup](#experimental-setup)
- [Thread Safe Setup](#thread-safe-setup)
- [Cache dependencies](#cache-dependencies)
- [Problem Matchers](#problem-matchers)
- [Examples](#examples)
@ -59,20 +60,21 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|Windows Server 2019|`windows-latest` or `windows-2019`|
|Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|
|Ubuntu 16.04|`ubuntu-16.04`|
|macOS X Catalina 10.15|`macOS-latest` or `macOS-10.15`|
|macOS X Catalina 10.15|`macos-latest` or `macOS-10.15`|
## :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 `windows` extensions which have `windows` binary 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 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.
## :wrench: Tools Support
These tools can be setup globally using the `tools` input.
`codeception`, `composer`, `composer-prefetcher`, `deployer`, `pecl`, `phinx`, `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
uses: shivammathur/setup-php@v1
@ -184,7 +186,7 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
@ -226,6 +228,29 @@ steps:
tools: php-cs-fixer, phpunit #optional, setup tools globally
```
### Thread Safe Setup
- `NTS` versions are setup by default.
- On `ubuntu` and `macOS` only NTS versions are supported.
- On `windows` both `TS` and `NTS` versions are supported.
```yaml
jobs:
run:
runs-on: windows-latest
name: Setup PHP TS on Windows
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: '7.4'
env:
PHPTS: ts # specify ts or nts
```
### Cache dependencies
You can persist composer's internal cache directory using the [`action/cache`](https://github.com/actions/cache "GitHub Action to cache files") GitHub Action. Dependencies cached are loaded directly instead of downloading them while installation. The files cached are available across check-runs and will reduce the workflow execution time.
@ -256,7 +281,7 @@ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
### 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
- name: Setup Problem Matchers for PHPUnit
@ -303,10 +328,10 @@ Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "sh
If this action helped you.
- Please star the project and share it, this helps reach more people.
- If you blog, write about your experience using this.
- 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>.
- 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>
- Please star the project and share it with the community.
- If you blog, write about your experience while using this action.
- 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, please contact me using [Codementor](https://www.codementor.io/shivammathur "Shivam Mathur Codementor")
## :bookmark: This action uses the following works

View File

@ -8,7 +8,7 @@ jest.mock('../src/extensions', () => ({
describe('Config tests', () => {
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('Remove-Extension xdebug');

View File

@ -3,13 +3,14 @@ import * as extensions from '../src/extensions';
describe('Extension tests', () => {
it('checking addExtensionOnWindows', async () => {
let win32: string = await extensions.addExtension(
'xdebug, pcov, phalcon4',
'xdebug, pcov, phalcon4, ast-beta',
'7.4',
'win32'
);
expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('Add-Extension pcov');
expect(win32).toContain('phalcon.ps1 phalcon4');
expect(win32).toContain('Add-Extension ast beta');
win32 = await extensions.addExtension(
'phalcon3, does_not_exist',
@ -26,7 +27,7 @@ describe('Extension tests', () => {
it('checking addExtensionOnLinux', async () => {
let linux: string = await extensions.addExtension(
'xdebug, pcov',
'xdebug, pcov, ast-beta',
'7.4',
'linux'
);
@ -34,47 +35,40 @@ describe('Extension tests', () => {
expect(linux).toContain(
'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');
expect(linux).toContain('gearman.sh 7.0');
linux = await extensions.addExtension('gearman', '7.1', 'linux');
expect(linux).toContain('gearman.sh 7.1');
linux = await extensions.addExtension(
'phalcon3, phalcon4, gearman',
'7.2',
'linux'
);
expect(linux).toContain('phalcon.sh phalcon3 7.2');
expect(linux).toContain('phalcon.sh phalcon4 7.2');
linux = await extensions.addExtension('gearman', '7.2', 'linux');
expect(linux).toContain('gearman.sh 7.2');
linux = await extensions.addExtension(
'phalcon3, phalcon4, gearman',
'7.3',
'linux'
);
expect(linux).toContain('phalcon.sh phalcon3 7.3');
expect(linux).toContain('phalcon.sh phalcon4 7.3');
linux = await extensions.addExtension('gearman', '7.3', 'linux');
expect(linux).toContain('gearman.sh 7.3');
linux = await extensions.addExtension('phalcon4, gearman', '7.4', 'linux');
expect(linux).toContain('phalcon.sh phalcon4 7.4');
linux = await extensions.addExtension('gearman', '7.4', 'linux');
expect(linux).toContain('gearman.sh 7.4');
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
expect(linux).toContain('Platform fedora is not supported');
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
expect(linux).toContain('phalcon.sh phalcon3 7.3');
expect(linux).toContain('phalcon.sh phalcon4 7.3');
});
it('checking addExtensionOnDarwin', async () => {
let darwin: string = await extensions.addExtension(
'xdebug, pcov',
'xdebug, pcov, ast-beta',
'7.2',
'darwin'
);
expect(darwin).toContain('sudo pecl install xdebug');
expect(darwin).toContain('sudo pecl install pcov');
expect(darwin).toContain('sudo pecl install -f xdebug');
expect(darwin).toContain('sudo pecl install -f pcov');
expect(darwin).toContain('install_extension ast-beta');
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
@ -83,25 +77,33 @@ describe('Extension tests', () => {
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
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');
expect(darwin).toContain('sudo pecl install pcov');
expect(darwin).toContain('sudo pecl install -f pcov');
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');
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');
expect(darwin).toContain('sudo pecl install xdebug');
expect(darwin).toContain('sudo pecl install -f xdebug');
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');
expect(darwin).toContain('sudo pecl install redis');
expect(darwin).toContain('sudo pecl install -f redis');
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
expect(darwin).toContain('brew install pkg-config imagemagick');
expect(darwin).toContain('sudo pecl install -f imagick');
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
expect(darwin).toContain('brew install pkg-config imagemagick');
expect(darwin).toContain('sudo pecl install -f imagick');
darwin = await extensions.addExtension(
'does_not_exist',

View File

@ -23,7 +23,7 @@ describe('Matchers', () => {
it('Test Regex', async () => {
const regex1 = /^\d+\)\s.*$/;
const regex2 = /^(.*)$/;
const regex2 = /^(.*Failed\sasserting\sthat.*)$/;
const regex3 = /^\s*$/;
const regex4 = /^(.*):(\d+)$/;
expect(regex1.test('1) Tests\\Test::it_tests')).toBe(true);

View File

@ -160,6 +160,18 @@ describe('Tools tests', () => {
);
});
it('checking addPhive', async () => {
let script: string = await tools.addPhive('1.2.3', 'linux');
expect(script).toContain(
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
);
script = await tools.addPhive('latest', 'win32');
expect(script).toContain(
'Add-Tool https://phar.io/releases/phive.phar phive'
);
});
it('checking getPhpunitUri', async () => {
expect(await tools.getPhpunitUrl('tool', 'latest')).toBe(
'https://phar.phpunit.de/tool.phar'
@ -194,6 +206,30 @@ describe('Tools tests', () => {
).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 () => {
const tools_list: string[] = await tools.getCleanedToolsList(
'tool, composer:1.2.3, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher'
@ -289,7 +325,7 @@ describe('Tools tests', () => {
it('checking addTools on linux', async () => {
const script: string = await tools.addTools(
'php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, php-config, phpize',
'php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony',
'7.4',
'linux'
);
@ -302,9 +338,15 @@ describe('Tools tests', () => {
expect(script).toContain(
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan'
);
expect(script).toContain(
'add_tool https://phar.io/releases/phive.phar phive'
);
expect(script).toContain(
'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_composer_tool phinx phinx robmorgan/');
expect(script).toContain('add_composer_tool phinx phinx:1.2.3 robmorgan/');
@ -314,7 +356,7 @@ describe('Tools tests', () => {
});
it('checking addTools on darwin', async () => {
const script: string = await tools.addTools(
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, 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',
'darwin'
);
@ -337,15 +379,24 @@ describe('Tools tests', () => {
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
);
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
expect(script).toContain(
'add_tool https://github.com/phar-io/phive/releases/download/1.2.3/phive-1.2.3.phar phive'
);
expect(script).toContain(
'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" "php-config" "Added"');
});
it('checking addTools on windows', async () => {
const script: string = await tools.addTools(
'codeception, deployer, prestissimo, phpmd, phinx, php-config, phpize, does_not_exit',
'codeception, deployer, prestissimo, phpmd, phinx, phive:0.13.2, php-config, phpize, symfony, does_not_exit',
'7.4',
'win32'
);
@ -358,7 +409,16 @@ describe('Tools tests', () => {
expect(script).toContain(
'Add-Composer-Tool prestissimo prestissimo hirak/'
);
expect(script).toContain(
'Add-Tool https://github.com/phpmd/phpmd/releases/latest/download/phpmd.phar phpmd'
);
expect(script).toContain('Add-Composer-Tool phinx phinx robmorgan/');
expect(script).toContain(
'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('php-config is not a windows tool');
expect(script).toContain('Tool does_not_exit is not supported');

View File

@ -1,6 +1,6 @@
name: 'Setup PHP Action'
author: shivammathur
description: 'GitHub action to setup PHP with required extensions, php.ini configuration, code-coverage support and composer'
description: 'Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer'
branding:
color: 'purple'
inputs:

176
dist/index.js vendored
View File

@ -1262,17 +1262,24 @@ module.exports = require("assert");
"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 });
const os = __webpack_require__(87);
const os = __importStar(__webpack_require__(87));
/**
* Commands
*
* Command Format:
* ##[name key=value;key=value]message
* ::name key=value,key=value::message
*
* Examples:
* ##[warning]This is the user warning message
* ##[set-secret name=mypassword]definitelyNotAPassword!
* ::warning::This is the message
* ::set-env name=MY_VAR::some value
*/
function issueCommand(command, properties, message) {
const cmd = new Command(command, properties, message);
@ -1308,30 +1315,28 @@ class Command {
else {
cmdStr += ',';
}
// safely append the val - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason
cmdStr += `${key}=${escape(`${val || ''}`)}`;
cmdStr += `${key}=${escapeProperty(val)}`;
}
}
}
}
cmdStr += CMD_STRING;
// 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);
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
return cmdStr;
}
}
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) {
return s
function escapeProperty(s) {
return (s || '')
.replace(/%/g, '%25')
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A')
.replace(/]/g, '%5D')
.replace(/;/g, '%3B');
.replace(/:/g, '%3A')
.replace(/,/g, '%2C');
}
//# 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());
});
};
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 });
const command_1 = __webpack_require__(431);
const os = __webpack_require__(87);
const path = __webpack_require__(622);
const os = __importStar(__webpack_require__(87));
const path = __importStar(__webpack_require__(622));
/**
* The code to exit an action
*/
@ -1731,6 +1743,31 @@ function getCodeceptionUri(version, php_version) {
});
}
exports.getCodeceptionUri = getCodeceptionUri;
/**
* Helper function to get script to setup phive
*
* @param tool
* @param version
* @param url
* @param os_version
*/
function addPhive(version, os_version) {
return __awaiter(this, void 0, void 0, function* () {
switch (version) {
case 'latest':
return ((yield getArchiveCommand(os_version)) +
'https://phar.io/releases/phive.phar phive');
default:
return ((yield getArchiveCommand(os_version)) +
'https://github.com/phar-io/phive/releases/download/' +
version +
'/phive-' +
version +
'.phar phive');
}
});
}
exports.addPhive = addPhive;
/**
* Function to get the PHPUnit url
*
@ -1765,6 +1802,35 @@ function getDeployerUrl(version) {
});
}
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
*
@ -1888,6 +1954,9 @@ function addTools(tools_csv, php_version, os_version) {
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
script += yield addArchive(tool, version, url, os_version);
break;
case 'phive':
script += yield addPhive(version, os_version);
break;
case 'phpstan':
url = github + 'phpstan/phpstan/' + uri;
script += yield addArchive(tool, version, url, os_version);
@ -1936,6 +2005,12 @@ function addTools(tools_csv, php_version, os_version) {
case 'phpize':
script += yield addDevTools(tool, os_version);
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:
script += yield utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version);
break;
@ -2088,7 +2163,7 @@ exports.disableCoverage = disableCoverage;
*/
function addCoverage(coverage_driver, version, os_version) {
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 pipe = yield utils.suppressOutput(os_version);
switch (coverage_driver) {
@ -2250,13 +2325,15 @@ function build(filename, version, os_version) {
return __awaiter(this, void 0, void 0, function* () {
// taking inputs
const extension_csv = (yield utils.getInput('extensions', false)) ||
(yield utils.getInput('extension', false)) ||
(yield utils.getInput('extension-csv', false));
const ini_values_csv = (yield utils.getInput('ini-values', false)) ||
(yield utils.getInput('ini-values-csv', false));
const coverage_driver = yield utils.getInput('coverage', false);
const pecl = yield utils.getInput('pecl', 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;
}
let script = yield utils.readScript(filename, version, os_version);
@ -2565,17 +2642,27 @@ function addExtensionDarwin(extension_csv, version, pipe) {
return __awaiter(this, void 0, void 0, function* () {
extension = extension.toLowerCase();
const version_extension = version + extension;
// add script to enable extension is already installed along with php
let install_command = '';
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):
install_command = 'sudo pecl install xdebug-2.5.5' + pipe;
install_command = 'sudo pecl install -f xdebug-2.5.5' + pipe;
break;
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;
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;
case /[5-9]\.\dimagick/.test(version_extension):
install_command =
'brew install pkg-config imagemagick' +
pipe +
' && sudo pecl install -f imagick' +
pipe;
break;
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
install_command =
@ -2588,7 +2675,7 @@ function addExtensionDarwin(extension_csv, version, pipe) {
pipe;
break;
default:
install_command = 'sudo pecl install ' + extension + pipe;
install_command = 'sudo pecl install -f ' + extension + pipe;
break;
}
script +=
@ -2617,9 +2704,14 @@ function addExtensionWindows(extension_csv, version, pipe) {
let script = '\n';
yield utils.asyncForEach(extensions, function (extension) {
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;
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
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
script +=
@ -2655,10 +2747,13 @@ function addExtensionLinux(extension_csv, version, pipe) {
yield utils.asyncForEach(extensions, function (extension) {
return __awaiter(this, void 0, void 0, function* () {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php
const version_extension = version + extension;
let install_command = '';
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
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
install_command =
@ -2668,6 +2763,16 @@ function addExtensionLinux(extension_csv, version, pipe) {
version +
pipe;
break;
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
script +=
'\nsh ' +
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
' ' +
extension +
' ' +
version;
return;
// match 7.0xdebug..7.4xdebug
case /^7\.[0-4]xdebug$/.test(version_extension):
script +=
@ -2676,19 +2781,6 @@ function addExtensionLinux(extension_csv, version, pipe) {
'\n' +
(yield utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
return;
// match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
script +=
'\nsh ' +
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
' ' +
extension +
' ' +
version +
pipe +
'\n' +
(yield utils.addLog('$tick', extension, 'Installed and enabled', 'linux'));
return;
default:
install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
@ -2696,7 +2788,7 @@ function addExtensionLinux(extension_csv, version, pipe) {
'-' +
extension.replace('pdo_', '').replace('pdo-', '') +
pipe +
' || sudo pecl install ' +
' || sudo pecl install -f ' +
extension +
pipe;
break;

View File

@ -6,7 +6,7 @@ jobs:
tests:
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
runs-on: ${{ matrix.operating-system }}
steps:

View File

@ -5,7 +5,7 @@ jobs:
build:
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
runs-on: ${{ matrix.operating-system }}
steps:

View File

@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
steps:
- name: Checkout

View File

@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
steps:
- name: Checkout

View File

@ -5,7 +5,7 @@ jobs:
build:
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
runs-on: ${{ matrix.operating-system }}
steps:

View File

@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.3', '7.4']
steps:
- name: Checkout

View File

@ -5,7 +5,7 @@ jobs:
build:
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['7.2', '7.3', '7.4']
runs-on: ${{ matrix.operating-system }}
steps:

112
package-lock.json generated
View File

@ -1,13 +1,13 @@
{
"name": "setup-php",
"version": "1.7.3",
"version": "1.8.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@actions/core": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.1.tgz",
"integrity": "sha512-xD+CQd9p4lU7ZfRqmUcbJpqR+Ss51rJRVeXMyOLrZQImN9/8Sy/BEUBnHO/UKD3z03R686PVTLfEPmkropGuLw=="
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
"integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg=="
},
"@actions/exec": {
"version": "1.0.3",
@ -691,9 +691,9 @@
"dev": true
},
"@types/istanbul-lib-report": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz",
"integrity": "sha512-3BUTyMzbZa2DtDI2BkERNC6jJw2Mr2Y0oGI7mRxYNBPxppbtEK1F66u3bKwU2g+wxwWI7PAoRpJnOY1grJqzHg==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
"integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==",
"dev": true,
"requires": {
"@types/istanbul-lib-coverage": "*"
@ -710,9 +710,9 @@
}
},
"@types/jest": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.9.0.tgz",
"integrity": "sha512-dXvuABY9nM1xgsXlOtLQXJKdacxZJd7AtvLsKZ/0b57ruMXDKCOXAC/M75GbllQX6o1pcZ5hAG4JzYy7Z/wM2w==",
"version": "24.9.1",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.9.1.tgz",
"integrity": "sha512-Fb38HkXSVA4L8fGKEZ6le5bB8r6MRWlOCZbVuWZcmOMSCd2wCYOwN1ibj8daIoV9naq7aaOZjrLCoCMptKU/4Q==",
"dev": true,
"requires": {
"jest-diff": "^24.3.0"
@ -725,9 +725,9 @@
"dev": true
},
"@types/node": {
"version": "12.12.24",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.24.tgz",
"integrity": "sha512-1Ciqv9pqwVtW6FsIUKSZNB82E5Cu1I2bBTj1xuIHXLe/1zYLl3956Nbhg2MzSYHVfl9/rmanjbQIb7LibfCnug==",
"version": "12.12.25",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.25.tgz",
"integrity": "sha512-nf1LMGZvgFX186geVZR1xMZKKblJiRfiASTHw85zED2kI1yDKHDwTKMdkaCbTlXoRKlGKaDfYywt+V0As30q3w==",
"dev": true
},
"@types/normalize-package-data": {
@ -743,9 +743,9 @@
"dev": true
},
"@types/yargs": {
"version": "13.0.5",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.5.tgz",
"integrity": "sha512-CF/+sxTO7FOwbIRL4wMv0ZYLCRfMid2HQpzDRyViH7kSpfoAFiMdGqKIxb1PxWfjtQXQhnQuD33lvRHNwr809Q==",
"version": "13.0.6",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.6.tgz",
"integrity": "sha512-IkltIncDQWv6fcAvnHtJ6KtkmY/vtR3bViOaCzpj/A3yNhlfZAgxNe6AEQD1cQrkYD+YsKVo08DSxvNKEsD7BA==",
"dev": true,
"requires": {
"@types/yargs-parser": "*"
@ -758,12 +758,12 @@
"dev": true
},
"@typescript-eslint/eslint-plugin": {
"version": "2.16.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.16.0.tgz",
"integrity": "sha512-TKWbeFAKRPrvKiR9GNxErQ8sELKqg1ZvXi6uho07mcKShBnCnqNpDQWP01FEvWKf0bxM2g7uQEI5MNjSNqvUpQ==",
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.17.0.tgz",
"integrity": "sha512-tg/OMOtPeXlvk0ES8mZzEZ4gd1ruSE03nsKcK+teJhxYv5CPCXK6Mb/OK6NpB4+CqGTHs4MVeoSZXNFqpT1PyQ==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "2.16.0",
"@typescript-eslint/experimental-utils": "2.17.0",
"eslint-utils": "^1.4.3",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0",
@ -771,32 +771,32 @@
}
},
"@typescript-eslint/experimental-utils": {
"version": "2.16.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.16.0.tgz",
"integrity": "sha512-bXTmAztXpqxliDKZgvWkl+5dHeRN+jqXVZ16peKKFzSXVzT6mz8kgBpHiVzEKO2NZ8OCU7dG61K9sRS/SkUUFQ==",
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.17.0.tgz",
"integrity": "sha512-2bNf+mZ/3mj5/3CP56v+ldRK3vFy9jOvmCPs/Gr2DeSJh+asPZrhFniv4QmQsHWQFPJFWhFHgkGgJeRmK4m8iQ==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.16.0",
"@typescript-eslint/typescript-estree": "2.17.0",
"eslint-scope": "^5.0.0"
}
},
"@typescript-eslint/parser": {
"version": "2.16.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.16.0.tgz",
"integrity": "sha512-+w8dMaYETM9v6il1yYYkApMSiwgnqXWJbXrA94LAWN603vXHACsZTirJduyeBOJjA9wT6xuXe5zZ1iCUzoxCfw==",
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.17.0.tgz",
"integrity": "sha512-k1g3gRQ4fwfJoIfgUpz78AovicSWKFANmvTfkAHP24MgJHjWfZI6ya7tsQZt1sLczvP4G9BE5G5MgADHdmJB/w==",
"dev": true,
"requires": {
"@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "2.16.0",
"@typescript-eslint/typescript-estree": "2.16.0",
"@typescript-eslint/experimental-utils": "2.17.0",
"@typescript-eslint/typescript-estree": "2.17.0",
"eslint-visitor-keys": "^1.1.0"
}
},
"@typescript-eslint/typescript-estree": {
"version": "2.16.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.16.0.tgz",
"integrity": "sha512-hyrCYjFHISos68Bk5KjUAXw0pP/455qq9nxqB1KkT67Pxjcfw+r6Yhcmqnp8etFL45UexCHUMrADHH7dI/m2WQ==",
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.17.0.tgz",
"integrity": "sha512-g0eVRULGnEEUakxRfJO0s0Hr1LLQqsI6OrkiCLpdHtdJJek+wyd8mb00vedqAoWldeDcOcP8plqw8/jx9Gr3Lw==",
"dev": true,
"requires": {
"debug": "^4.1.1",
@ -857,12 +857,12 @@
"dev": true
},
"ajv": {
"version": "6.10.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
"integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz",
"integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==",
"dev": true,
"requires": {
"fast-deep-equal": "^2.0.1",
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
@ -1872,9 +1872,9 @@
}
},
"es-abstract": {
"version": "1.17.2",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.2.tgz",
"integrity": "sha512-YoKuru3Lyoy7yVTBSH2j7UxTqe/je3dWAruC0sHvZX1GNd5zX8SSLvQqEgO9b3Ex8IW+goFI9arEEsFIbulhOw==",
"version": "1.17.4",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz",
"integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==",
"dev": true,
"requires": {
"es-to-primitive": "^1.2.1",
@ -1908,24 +1908,16 @@
"dev": true
},
"escodegen": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.12.1.tgz",
"integrity": "sha512-Q8t2YZ+0e0pc7NRVj3B4tSQ9rim1oi4Fh46k2xhJ2qOiEwhQfdjyEQddWdj7ZFaKmU+5104vn1qrcjEPWq+bgQ==",
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.13.0.tgz",
"integrity": "sha512-eYk2dCkxR07DsHA/X2hRBj0CFAZeri/LyDMc0C8JT1Hqi6JnVpMhJ7XFITbb0+yZS3lVkaPL2oCkZ3AVmeVbMw==",
"dev": true,
"requires": {
"esprima": "^3.1.3",
"esprima": "^4.0.1",
"estraverse": "^4.2.0",
"esutils": "^2.0.2",
"optionator": "^0.8.1",
"source-map": "~0.6.1"
},
"dependencies": {
"esprima": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz",
"integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=",
"dev": true
}
}
},
"eslint": {
@ -2383,9 +2375,9 @@
"dev": true
},
"fast-deep-equal": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz",
"integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==",
"dev": true
},
"fast-diff": {
@ -3522,9 +3514,9 @@
"dev": true
},
"inquirer": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.3.tgz",
"integrity": "sha512-+OiOVeVydu4hnCGLCSX+wedovR/Yzskv9BFqUNNKq9uU2qg7LCcCo3R86S2E7WLo0y/x2pnEZfZe1CoYnORUAw==",
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.4.tgz",
"integrity": "sha512-Bu5Td5+j11sCkqfqmUTiwv+tWisMtP0L7Q8WrqA2C/BbBhy1YTdFrvjjlrKq8oagA/tLQBski2Gcx/Sqyi2qSQ==",
"dev": true,
"requires": {
"ansi-escapes": "^4.2.1",
@ -5644,9 +5636,9 @@
"dev": true
},
"resolve": {
"version": "1.14.2",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.2.tgz",
"integrity": "sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ==",
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz",
"integrity": "sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"

View File

@ -1,6 +1,6 @@
{
"name": "setup-php",
"version": "1.7.3",
"version": "1.8.0",
"private": false,
"description": "Setup PHP for use with GitHub Actions",
"main": "dist/index.js",
@ -50,7 +50,7 @@
"husky": {
"skipCI": true,
"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"
}
}
}

Binary file not shown.

BIN
src/bin/php_ts_pcov.dll Normal file

Binary file not shown.

View File

@ -7,7 +7,7 @@
"regexp": "^\\d+\\)\\s.*$"
},
{
"regexp": "^(.*)$",
"regexp": "^(.*Failed\\sasserting\\sthat.*)$",
"message": 1
},
{

View File

@ -143,7 +143,7 @@ export async function addCoverage(
version: string,
os_version: string
): Promise<string> {
coverage_driver.toLowerCase();
coverage_driver = coverage_driver.toLowerCase();
const script: string =
'\n' + (await utils.stepLog('Setup Coverage', os_version));
const pipe: string = await utils.suppressOutput(os_version);

View File

@ -18,17 +18,27 @@ export async function addExtensionDarwin(
await utils.asyncForEach(extensions, async function(extension: string) {
extension = extension.toLowerCase();
const version_extension: string = version + extension;
// add script to enable extension is already installed along with php
let install_command = '';
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):
install_command = 'sudo pecl install xdebug-2.5.5' + pipe;
install_command = 'sudo pecl install -f xdebug-2.5.5' + pipe;
break;
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;
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;
case /[5-9]\.\dimagick/.test(version_extension):
install_command =
'brew install pkg-config imagemagick' +
pipe +
' && sudo pecl install -f imagick' +
pipe;
break;
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
install_command =
@ -41,7 +51,7 @@ export async function addExtensionDarwin(
pipe;
break;
default:
install_command = 'sudo pecl install ' + extension + pipe;
install_command = 'sudo pecl install -f ' + extension + pipe;
break;
}
script +=
@ -70,9 +80,14 @@ export async function addExtensionWindows(
const extensions: Array<string> = await utils.extensionArray(extension_csv);
let script = '\n';
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;
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
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
script +=
@ -108,10 +123,13 @@ export async function addExtensionLinux(
let script = '\n';
await utils.asyncForEach(extensions, async function(extension: string) {
extension = extension.toLowerCase();
// add script to enable extension is already installed along with php
const version_extension: string = version + extension;
let install_command = '';
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
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
install_command =
@ -121,6 +139,16 @@ export async function addExtensionLinux(
version +
pipe;
break;
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
script +=
'\nsh ' +
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
' ' +
extension +
' ' +
version;
return;
// match 7.0xdebug..7.4xdebug
case /^7\.[0-4]xdebug$/.test(version_extension):
script +=
@ -129,24 +157,6 @@ export async function addExtensionLinux(
'\n' +
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
return;
// match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
script +=
'\nsh ' +
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
' ' +
extension +
' ' +
version +
pipe +
'\n' +
(await utils.addLog(
'$tick',
extension,
'Installed and enabled',
'linux'
));
return;
default:
install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
@ -154,7 +164,7 @@ export async function addExtensionLinux(
'-' +
extension.replace('pdo_', '').replace('pdo-', '') +
pipe +
' || sudo pecl install ' +
' || sudo pecl install -f ' +
extension +
pipe;
break;

View File

@ -22,6 +22,7 @@ export async function build(
// taking inputs
const extension_csv: string =
(await utils.getInput('extensions', false)) ||
(await utils.getInput('extension', false)) ||
(await utils.getInput('extension-csv', false));
const ini_values_csv: string =
(await utils.getInput('ini-values', false)) ||
@ -29,7 +30,10 @@ export async function build(
const coverage_driver: string = await utils.getInput('coverage', false);
const pecl: string = await utils.getInput('pecl', 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;
}

View File

@ -26,20 +26,21 @@ add_extension() {
elif php -m | grep -i -q -w "$extension"; then
add_log "$tick" "$extension" "Enabled"
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)
if [ "$exists" = "200" ] || [[ "$extension" == "phalcon"* ]]; then
(
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
(eval "$install_command" && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
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
remove_extension() {
extension=$1
@ -67,6 +68,11 @@ add_tool() {
add_log "$cross" "$tool" "Could not setup $tool"
fi
fi
if [ "$tool" = "phive" ]; then
add_extension curl >/dev/null 2>&1
add_extension mbstring >/dev/null 2>&1
add_extension xml >/dev/null 2>&1
fi
}
add_composer_tool() {
@ -74,13 +80,17 @@ add_composer_tool() {
release=$2
prefix=$3
(
composer global require "$prefix$release" >/dev/null 2>&1 && \
sudo ln -sf "$(composer -q global config home)"/vendor/bin/"$tool" /usr/local/bin/"$tool" && \
add_log "$tick" "$tool" "Added"
composer global require "$prefix$release" >/dev/null 2>&1 && \
sudo ln -sf "$(composer -q global config home)"/vendor/bin/"$tool" /usr/local/bin/"$tool" && \
add_log "$tick" "$tool" "Added"
) || add_log "$cross" "$tool" "Could not setup $tool"
}
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"
}
@ -101,7 +111,7 @@ version=$1
step_log "Setup PHP"
setup_php_and_composer
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*||")
sudo chmod 777 "$ini_file"
mkdir -p "$(pecl config-get ext_dir)"

View File

@ -10,22 +10,47 @@ Param (
[string]
$version
)
# Function to install phalcon
Function Install-Phalcon() {
if ($extension_version -eq '4') {
Install-Phpextension phalcon -MinimumStability stable -Path $php_dir
} else {
$installed = Get-Php -Path $php_dir
$nts = if (!$installed.ThreadSafe) { "_nts" } else { "" }
$match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
$zip_file = $match.Matches[0].Groups[1].Value
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip > $null 2>&1
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force > $null 2>&1
New-Item -ItemType SymbolicLink -Path $ext_dir\php_phalcon.dll -Target $ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll > $null 2>&1
Enable-PhpExtension -Extension phalcon -Path $php_dir
}
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Installed and enabled"
}
$tick = ([char]8730)
$domain = 'https://github.com'
$php_dir = 'C:\tools\php'
$ext_dir = $php_dir + '\ext'
Install-Phpextension psr -MinimumStability stable -Path $php_dir
if($extension -eq "phalcon4") {
Install-Phpextension phalcon -MinimumStability stable -Path $php_dir
} else {
$installed = Get-Php -Path $php_dir
$extension_version = $extension.substring($extension.Length - 1)
$nts = if(! $installed.ThreadSafe ) { "_nts" } else { "" }
$match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
$zip_file = $match.Matches[0].Groups[1].Value
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip >$null 2>&1
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force >$null 2>&1
New-Item -ItemType SymbolicLink -Path $ext_dir\php_phalcon.dll -Target $ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll >$null 2>&1
Enable-PhpExtension -Extension phalcon -Path $php_dir
$extension_version = $extension.substring($extension.Length - 1)
if($extension_version -eq '4') {
if (Test-Path $ext_dir\php_psr.dll) {
Enable-PhpExtension -Extension psr -Path $php_dir
} else {
Install-Phpextension psr -MinimumStability stable -Path $php_dir
}
}
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Installed and enabled"
if(Test-Path $ext_dir\php_phalcon.dll) {
$phalcon = Get-PhpExtension $ext_dir\php_phalcon.dll
if($phalcon.Version[0] -eq $extension_version) {
Enable-PhpExtension -Extension phalcon -Path $php_dir
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Enabled"
} else {
Remove-Item $ext_dir\php_phalcon.dll
Install-Phalcon
}
} else {
Install-Phalcon
}

View File

@ -1,22 +1,82 @@
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
find /etc/apt/sources.list.d -type f -name 'ondrej-ubuntu-php*.list' -exec sudo DEBIAN_FRONTEND=noninteractive apt-fast update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | sudo bash
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-psr
# Function to log result of a operation
add_log() {
mark=$1
subject=$2
message=$3
if [ "$mark" = "$tick" ]; then
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
else
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
fi
}
if [ ! "$(apt-cache search php"$2"-psr)" ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-dev
for tool in php-config phpize; do
if [ -e "/usr/bin/$tool$2" ]; then
sudo update-alternatives --set $tool /usr/bin/"$tool$2"
# Function to update php ppa
update_ppa() {
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
ppa_updated="true"
fi
}
# Function to install phalcon
install_phalcon() {
extension=$1
version=$2
(sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "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-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
}
# Function to remove an extensions
remove_extension() {
extension=$1
sudo sed -i "/$extension/d" "$ini_file"
rm -rf "$ext_dir/$extension.so"
}
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
semver=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')
extension_major_version=$(echo "$1" | grep -i -Po '\d')
ppa_updated="false"
tick="✓"
cross="✗"
if [ "$extension_major_version" = "4" ]; then
if [ -e "$ext_dir/psr.so" ]; then
echo "extension=psr" >>"$ini_file"
fi
if [ -e "$ext_dir/phalcon.so" ]; then
if php -m | grep -i -q -w psr; then
echo "extension=phalcon" >>"$ini_file"
phalcon_version=$(php -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
if [ "$phalcon_version" != "$extension_major_version" ]; then
remove_extension "psr" >/dev/null 2>&1
remove_extension "phalcon" >/dev/null 2>&1
install_phalcon "$1" "$2"
else
add_log "$tick" "$1" "Enabled"
fi
else
install_phalcon "$1" "$2"
fi
done
cd ~ && git clone --depth=1 https://github.com/jbboehr/php-psr.git
cd php-psr && sudo /usr/bin/phpize"$2"
./configure --with-php-config=/usr/bin/php-config"$2"
make -j2 && sudo make -j2 install
echo "extension=psr.so" >> "$ini_file"
else
install_phalcon "$1" "$2"
fi
fi
extension_major_version=$(echo "$1" | grep -i -Po '\d')
extension_version=$(apt-cache policy -- *phalcon | grep -i -Po "$extension_major_version\.\d\.\d.*php$2" | head -n 1)
sudo DEBIAN_FRONTEND=noninteractive apt-fast -o Dpkg::Options::="--force-overwrite" install -y php"$2"-phalcon="$extension_version"
if [ "$extension_major_version" = "3" ]; then
if [ -e "$ext_dir/phalcon.so" ]; then
echo "extension=phalcon" >>"$ini_file"
phalcon_version=$(php -r "echo phpversion('phalcon');" | cut -d'.' -f 1)
if [ "$phalcon_version" != "$extension_major_version" ]; then
remove_extension "phalcon" >/dev/null 2>&1
install_phalcon "$1" "$2"
else
add_log "$tick" "$1" "Enabled"
fi
else
install_phalcon "$1" "$2"
fi
fi

View File

@ -1,5 +1,22 @@
extension=$1
extension_major=${extension: -1}
php_version=$2
brew tap shivammathur/homebrew-phalcon
brew install phalcon@"$php_version"_"$extension_major"
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
if [ -e "$ext_dir/psr.so" ] && [ -e "$ext_dir/phalcon.so" ]; then
echo "extension=psr" >>"$ini_file"
echo "extension=phalcon" >>"$ini_file"
phalcon_semver=$(php -r "echo phpversion('phalcon');")
phalcon_version=$(echo "$phalcon_semver" | cut -d'.' -f 1)
if [ "$phalcon_version" != "$extension_major" ]; then
sudo sed -i '' "/psr/d" "$ini_file"
sudo sed -i '' "/phalcon/d" "$ini_file"
rm -rf "$ext_dir"/psr.so
rm -rf "$ext_dir"/phalcon.so
brew tap shivammathur/homebrew-phalcon
brew install phalcon@"$php_version"_"$extension_major"
fi
else
brew tap shivammathur/homebrew-phalcon
brew install phalcon@"$php_version"_"$extension_major"
fi

View File

@ -38,6 +38,17 @@ add_extension() {
(update_ppa && eval "$install_command" && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
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
@ -83,6 +94,11 @@ add_tool() {
if [ "$tool" = "composer" ]; then
composer -q global config process-timeout 0
fi
if [ "$tool" = "phive" ]; then
add_extension curl >/dev/null 2>&1
add_extension mbstring >/dev/null 2>&1
add_extension xml >/dev/null 2>&1
fi
}
add_composer_tool() {
@ -120,14 +136,12 @@ setup_master() {
# Function to setup PECL
add_pecl() {
update_ppa
add_devtools
wget https://github.com/pear/pearweb_phars/raw/master/install-pear-nozlib.phar >/dev/null 2>&1
sudo php install-pear-nozlib.phar >/dev/null 2>&1
sudo rm -rf install-pear-nozlib.phar >/dev/null 2>&1
$apt_install php-pear >/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 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"
}

View File

@ -35,7 +35,7 @@ Function Add-Extension {
)
try {
$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) {
'Builtin' {
Add-Log $tick $extension "Enabled"
@ -51,7 +51,11 @@ Function Add-Extension {
}
else {
Install-PhpExtension -Extension $extension -MinimumStability $mininum_stability -Path $php_dir
Add-Log $tick $extension "Installed and enabled"
if($mininum_stability -ne 'stable') {
Add-Log $tick "$extension-$mininum_stability" "Installed and enabled"
} else {
Add-Log $tick $extension "Installed and enabled"
}
}
}
catch {
@ -75,7 +79,6 @@ Function Remove-Extension() {
}
}
# Function to setup a remote tool
Function Add-Tool() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
@ -89,14 +92,16 @@ Function Add-Tool() {
[string]
$tool
)
if($tool -eq "composer") {
if (Test-Path $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
Add-Log $tick $tool "Added"
} 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 {
if (Test-Path $php_dir\$tool) {
Remove-Item $php_dir\$tool
}
try {
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
$bat_content = @()
@ -106,14 +111,17 @@ Function Add-Tool() {
$bat_content += "php %BIN_TARGET% %*"
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
if (Test-Path $php_dir\$tool) {
Add-Log $tick $tool "Added"
} else {
Add-Log $cross $tool "Could not add $tool"
}
} catch {
Add-Log $cross $tool "Could not add $tool"
}
} catch { }
}
if($tool -eq "phive") {
Add-Extension curl >$null 2>&1
Add-Extension mbstring >$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"
}
}
@ -146,7 +154,7 @@ Function Add-Composer-Tool() {
}
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
@ -156,7 +164,11 @@ $php_dir = 'C:\tools\php'
$ext_dir = $php_dir + '\ext'
$ProgressPreference = 'SilentlyContinue'
$master_version = '8.0'
$arch='x64'
$arch = 'x64'
$ts = $false
if((Test-Path env:PHPTS) -and $env:PHPTS -eq 'ts') {
$ts = $true
}
Step-Log "Setup PhpManager"
Install-Module -Name PhpManager -Force -Scope CurrentUser
@ -172,7 +184,7 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
}
Step-Log "Setup PHP"
$status = "Installed"
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.')))) {
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
if ($version -lt '7.0') {
Install-Module -Name VcRedist -Force
$arch='x86'
@ -181,7 +193,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
$version = 'master'
}
Install-Php -Version $version -Architecture $arch -ThreadSafe $true -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1
} else {
$updated = Update-Php $php_dir >$null 2>&1
if($updated -eq $False) {
@ -194,7 +206,11 @@ Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir
Enable-PhpExtension -Extension openssl, curl, opcache -Path $php_dir
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
if ($version -eq 'master') {
Copy-Item $dir"\..\src\bin\php_pcov.dll" -Destination $ext_dir"\php_pcov.dll"
if($installed.ThreadSafe) {
Copy-Item $dir"\..\src\bin\php_ts_pcov.dll" -Destination $ext_dir"\php_pcov.dll"
} else {
Copy-Item $dir"\..\src\bin\php_pcov.dll" -Destination $ext_dir"\php_pcov.dll"
}
Set-PhpIniKey -Key 'opcache.jit_buffer_size' -Value '256M' -Path $php_dir
Set-PhpIniKey -Key 'opcache.jit' -Value '1235' -Path $php_dir
}

View File

@ -180,6 +180,36 @@ export async function getCodeceptionUri(
}
}
/**
* Helper function to get script to setup phive
*
* @param tool
* @param version
* @param url
* @param os_version
*/
export async function addPhive(
version: string,
os_version: string
): Promise<string> {
switch (version) {
case 'latest':
return (
(await getArchiveCommand(os_version)) +
'https://phar.io/releases/phive.phar phive'
);
default:
return (
(await getArchiveCommand(os_version)) +
'https://github.com/phar-io/phive/releases/download/' +
version +
'/phive-' +
version +
'.phar phive'
);
}
}
/**
* Function to get the PHPUnit url
*
@ -213,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
*
@ -354,6 +418,9 @@ export async function addTools(
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
script += await addArchive(tool, version, url, os_version);
break;
case 'phive':
script += await addPhive(version, os_version);
break;
case 'phpstan':
url = github + 'phpstan/phpstan/' + uri;
script += await addArchive(tool, version, url, os_version);
@ -407,6 +474,12 @@ export async function addTools(
case 'phpize':
script += await addDevTools(tool, os_version);
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:
script += await utils.addLog(
'$cross',