mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
commit
4f0d810cbc
2
.github/workflows/experimental-workflow.yml
vendored
2
.github/workflows/experimental-workflow.yml
vendored
@ -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
|
||||
|
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
@ -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
|
||||
|
30
README.md
30
README.md
@ -29,6 +29,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
||||
- [Basic Setup](#basic-setup)
|
||||
- [Matrix Setup](#matrix-setup)
|
||||
- [Experimental Setup](#experimental-setup)
|
||||
- [Thread Safe Setup](#thread-safe-setup)
|
||||
- [Cache dependencies](#cache-dependencies)
|
||||
- [Problem Matchers](#problem-matchers)
|
||||
- [Examples](#examples)
|
||||
@ -59,7 +60,7 @@ 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.
|
||||
@ -72,7 +73,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage 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`
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@v1
|
||||
@ -184,7 +185,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 +227,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.
|
||||
|
@ -41,30 +41,21 @@ describe('Extension tests', () => {
|
||||
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 () => {
|
||||
@ -103,6 +94,14 @@ describe('Extension tests', () => {
|
||||
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
||||
expect(darwin).toContain('sudo pecl install redis');
|
||||
|
||||
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
|
||||
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||
expect(darwin).toContain('sudo pecl install imagick');
|
||||
|
||||
darwin = await extensions.addExtension('imagick', '7.4', 'darwin');
|
||||
expect(darwin).toContain('brew install pkg-config imagemagick');
|
||||
expect(darwin).toContain('sudo pecl install imagick');
|
||||
|
||||
darwin = await extensions.addExtension(
|
||||
'does_not_exist',
|
||||
'7.2',
|
||||
|
@ -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'
|
||||
@ -289,7 +301,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',
|
||||
'7.4',
|
||||
'linux'
|
||||
);
|
||||
@ -302,6 +314,9 @@ 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'
|
||||
);
|
||||
@ -314,7 +329,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',
|
||||
'7.4',
|
||||
'darwin'
|
||||
);
|
||||
@ -337,6 +352,9 @@ 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-'
|
||||
);
|
||||
@ -345,7 +363,7 @@ describe('Tools tests', () => {
|
||||
});
|
||||
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, does_not_exit',
|
||||
'7.4',
|
||||
'win32'
|
||||
);
|
||||
@ -358,7 +376,13 @@ 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('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');
|
||||
|
@ -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 in GitHub Actions with required extensions, php.ini configuration, code-coverage support and various tools like composer'
|
||||
branding:
|
||||
color: 'purple'
|
||||
inputs:
|
||||
|
54
dist/index.js
vendored
54
dist/index.js
vendored
@ -1731,6 +1731,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
|
||||
*
|
||||
@ -1888,6 +1913,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);
|
||||
@ -2577,6 +2605,13 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
||||
case /5\.6redis/.test(version_extension):
|
||||
install_command = 'sudo pecl install redis-2.2.8' + pipe;
|
||||
break;
|
||||
case /[5-9]\.\dimagick/.test(version_extension):
|
||||
install_command =
|
||||
'brew install pkg-config imagemagick' +
|
||||
pipe +
|
||||
' && sudo pecl install imagick' +
|
||||
pipe;
|
||||
break;
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
install_command =
|
||||
'sh ' +
|
||||
@ -2668,15 +2703,7 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
||||
version +
|
||||
pipe;
|
||||
break;
|
||||
// match 7.0xdebug..7.4xdebug
|
||||
case /^7\.[0-4]xdebug$/.test(version_extension):
|
||||
script +=
|
||||
'\nupdate_extension xdebug 2.9.0' +
|
||||
pipe +
|
||||
'\n' +
|
||||
(yield utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
||||
return;
|
||||
// match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
script +=
|
||||
'\nsh ' +
|
||||
@ -2684,10 +2711,15 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
||||
' ' +
|
||||
extension +
|
||||
' ' +
|
||||
version +
|
||||
version;
|
||||
return;
|
||||
// match 7.0xdebug..7.4xdebug
|
||||
case /^7\.[0-4]xdebug$/.test(version_extension):
|
||||
script +=
|
||||
'\nupdate_extension xdebug 2.9.0' +
|
||||
pipe +
|
||||
'\n' +
|
||||
(yield utils.addLog('$tick', extension, 'Installed and enabled', 'linux'));
|
||||
(yield utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
||||
return;
|
||||
default:
|
||||
install_command =
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
82
package-lock.json
generated
82
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-php",
|
||||
"version": "1.7.3",
|
||||
"version": "1.7.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -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": "*"
|
||||
@ -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": {
|
||||
@ -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": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-php",
|
||||
"version": "1.7.3",
|
||||
"version": "1.7.4",
|
||||
"private": false,
|
||||
"description": "Setup PHP for use with GitHub Actions",
|
||||
"main": "dist/index.js",
|
||||
|
Binary file not shown.
BIN
src/bin/php_ts_pcov.dll
Normal file
BIN
src/bin/php_ts_pcov.dll
Normal file
Binary file not shown.
@ -30,6 +30,13 @@ export async function addExtensionDarwin(
|
||||
case /5\.6redis/.test(version_extension):
|
||||
install_command = 'sudo pecl install redis-2.2.8' + pipe;
|
||||
break;
|
||||
case /[5-9]\.\dimagick/.test(version_extension):
|
||||
install_command =
|
||||
'brew install pkg-config imagemagick' +
|
||||
pipe +
|
||||
' && sudo pecl install imagick' +
|
||||
pipe;
|
||||
break;
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
install_command =
|
||||
'sh ' +
|
||||
@ -121,15 +128,7 @@ export async function addExtensionLinux(
|
||||
version +
|
||||
pipe;
|
||||
break;
|
||||
// match 7.0xdebug..7.4xdebug
|
||||
case /^7\.[0-4]xdebug$/.test(version_extension):
|
||||
script +=
|
||||
'\nupdate_extension xdebug 2.9.0' +
|
||||
pipe +
|
||||
'\n' +
|
||||
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
||||
return;
|
||||
// match 7.0phalcon3..7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
// match 7.0phalcon3...7.3phalcon3 or 7.2phalcon4...7.4phalcon4
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
script +=
|
||||
'\nsh ' +
|
||||
@ -137,15 +136,15 @@ export async function addExtensionLinux(
|
||||
' ' +
|
||||
extension +
|
||||
' ' +
|
||||
version +
|
||||
version;
|
||||
return;
|
||||
// match 7.0xdebug..7.4xdebug
|
||||
case /^7\.[0-4]xdebug$/.test(version_extension):
|
||||
script +=
|
||||
'\nupdate_extension xdebug 2.9.0' +
|
||||
pipe +
|
||||
'\n' +
|
||||
(await utils.addLog(
|
||||
'$tick',
|
||||
extension,
|
||||
'Installed and enabled',
|
||||
'linux'
|
||||
));
|
||||
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
|
||||
return;
|
||||
default:
|
||||
install_command =
|
||||
|
@ -67,6 +67,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() {
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
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"
|
@ -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
|
||||
|
@ -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
|
@ -83,6 +83,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() {
|
||||
|
@ -115,6 +115,11 @@ Function Add-Tool() {
|
||||
Add-Log $cross $tool "Could not add $tool"
|
||||
}
|
||||
}
|
||||
if($tool -eq "phive") {
|
||||
Add-Extension curl >$null 2>&1
|
||||
Add-Extension mbstring >$null 2>&1
|
||||
Add-Extension xml >$null 2>&1
|
||||
}
|
||||
}
|
||||
|
||||
Function Add-Composer-Tool() {
|
||||
@ -156,7 +161,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 +181,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 +190,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 +203,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
|
||||
}
|
||||
|
33
src/tools.ts
33
src/tools.ts
@ -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
|
||||
*
|
||||
@ -354,6 +384,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);
|
||||
|
Loading…
Reference in New Issue
Block a user