mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-07 15:40:33 +07:00
Compare commits
35 Commits
Author | SHA1 | Date | |
---|---|---|---|
d384d9fe7e | |||
4eeaf5f99e | |||
fd2392db56 | |||
494dde7189 | |||
706dfca1e6 | |||
d613c975f6 | |||
fbe1419ce4 | |||
c844c7b6e4 | |||
8e5cc09df9 | |||
f4f8aec1f2 | |||
b44b7344e0 | |||
e01b2f0bf7 | |||
f7f8ecb931 | |||
4f0d810cbc | |||
47335179aa | |||
63c4aea452 | |||
898b6fa1f9 | |||
747c8838bc | |||
9d6b61c5af | |||
5108c81610 | |||
e58c704985 | |||
e9c783eef0 | |||
b44e5e009f | |||
8489dbf4de | |||
f23ae2e6f7 | |||
d2b233e45f | |||
320474a245 | |||
65ccfb36dc | |||
88fb99b592 | |||
9e7bc5c91f | |||
ca2f547a35 | |||
9f21c80d24 | |||
c4317135df | |||
a2dd688679 | |||
bd214a2dca |
4
.github/workflows/experimental-workflow.yml
vendored
4
.github/workflows/experimental-workflow.yml
vendored
@ -25,13 +25,11 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['8.0']
|
php-versions: ['8.0']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Setup Node.js 12.x
|
- name: Setup Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
|
4
.github/workflows/workflow.yml
vendored
4
.github/workflows/workflow.yml
vendored
@ -23,13 +23,11 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
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']
|
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Setup Node.js 12.x
|
- name: Setup Node.js 12.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
|
45
README.md
45
README.md
@ -13,7 +13,7 @@
|
|||||||
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg"></a>
|
<a href="#tada-php-support" title="PHP Versions Supported"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
Setup PHP with required extensions, php.ini configuration, code-coverage support and tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross platform interface to setup the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
|
Setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action gives you a cross platform interface to setup the PHP environment you need to test your application. Refer to [Usage](#memo-usage "How to use this") section and [examples](#examples "Examples of use") to see how to use this.
|
||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
@ -28,7 +28,8 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
- [Usage](#memo-usage)
|
- [Usage](#memo-usage)
|
||||||
- [Basic Setup](#basic-setup)
|
- [Basic Setup](#basic-setup)
|
||||||
- [Matrix Setup](#matrix-setup)
|
- [Matrix Setup](#matrix-setup)
|
||||||
- [Experimental Setup](#experimental-setup)
|
- [Experimental Setup](#experimental-setup)
|
||||||
|
- [Thread Safe Setup](#thread-safe-setup)
|
||||||
- [Cache dependencies](#cache-dependencies)
|
- [Cache dependencies](#cache-dependencies)
|
||||||
- [Problem Matchers](#problem-matchers)
|
- [Problem Matchers](#problem-matchers)
|
||||||
- [Examples](#examples)
|
- [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`|
|
|Windows Server 2019|`windows-latest` or `windows-2019`|
|
||||||
|Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|
|
|Ubuntu 18.04|`ubuntu-latest` or `ubuntu-18.04`|
|
||||||
|Ubuntu 16.04|`ubuntu-16.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
|
## :heavy_plus_sign: PHP Extension Support
|
||||||
- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
|
- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
|
||||||
- On `windows` extensions which have `windows` binary on `PECL` can be installed.
|
- On `windows` extensions which have `windows` binary on `PECL` can be installed.
|
||||||
- On `macOS` extensions which are on `PECL` can be installed.
|
- On `macOS` extensions which are on `PECL` can be installed.
|
||||||
- Extensions which are installed along with PHP if specified are enabled.
|
- Extensions which are installed along with PHP if specified are enabled.
|
||||||
|
- Extensions on `PECL` which do not have a latest stable version, their pre-release versions can be installed by suffixing the extension with its state i.e `alpha`, `beta`, `devel` or `snapshot` separated by a `-` like `msgpack-beta`.
|
||||||
- Extensions which cannot be installed gracefully leave an error message in the logs, the action is not interrupted.
|
- Extensions which cannot be installed gracefully leave an error message in the logs, the action is not interrupted.
|
||||||
|
|
||||||
## :wrench: Tools Support
|
## :wrench: Tools Support
|
||||||
|
|
||||||
These tools can be setup globally using the `tools` input.
|
These tools can be setup globally using the `tools` input.
|
||||||
|
|
||||||
`codeception`, `composer`, `composer-prefetcher`, `deployer`, `pecl`, `phinx`, `phpcbf`, `phpcpd`, `php-cs-fixer`, `phpcs`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`
|
`codeception`, `composer`, `composer-prefetcher`, `deployer`, `pecl`, `phinx`, `phive`, `phpcbf`, `phpcpd`, `php-config`, `php-cs-fixer`, `phpcs`, `phpize`, `phpmd`, `phpstan`, `phpunit`, `prestissimo`, `psalm`, `symfony`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v1
|
uses: shivammathur/setup-php@v1
|
||||||
@ -184,7 +186,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
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']
|
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
|
||||||
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
|
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
@ -226,6 +228,29 @@ steps:
|
|||||||
tools: php-cs-fixer, phpunit #optional, setup tools globally
|
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
|
### 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.
|
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
|
### Problem Matchers
|
||||||
|
|
||||||
You can setup problem matchers for your `PHPUnit` output. This will scan the errors in your tests and surface that information prominently in the GitHub Actions UI by creating annotations and log file decorations.
|
You can setup problem matchers for your `PHPUnit` output by adding this step after the `setup-php` step. This will scan the logs for failing tests and surface that information prominently in the GitHub Actions UI by creating annotations and log file decorations.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup Problem Matchers for PHPUnit
|
- name: Setup Problem Matchers for PHPUnit
|
||||||
@ -303,10 +328,10 @@ Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "sh
|
|||||||
|
|
||||||
If this action helped you.
|
If this action helped you.
|
||||||
|
|
||||||
- Please star the project and share it, this helps reach more people.
|
- Please star the project and share it with the community.
|
||||||
- If you blog, write about your experience using this.
|
- If you blog, write about your experience while using this action.
|
||||||
- Support this project on <a href="https://www.patreon.com/shivammathur"><img alt="Patreon" src="https://shivammathur.com/badges/patreon.svg"></a> or using <a href="https://www.paypal.me/shivammathur"><img alt="Paypal" src="https://shivammathur.com/badges/paypal.svg"></a>.
|
- I maintain this in my free time, please support me with a [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon") subscription or a one time contribution using [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal").
|
||||||
- If you need any help using this, reach out here <a href="https://www.codementor.io/shivammathur?utm_source=github&utm_medium=button&utm_term=shivammathur&utm_campaign=github" title="Contact Shivam Mathur on Codementor"><img alt="Contact me on Codementor" src="https://cdn.codementor.io/badges/contact_me_github.svg"></a>
|
- If you need any help using this, please contact me using [Codementor](https://www.codementor.io/shivammathur "Shivam Mathur Codementor")
|
||||||
|
|
||||||
## :bookmark: This action uses the following works
|
## :bookmark: This action uses the following works
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ jest.mock('../src/extensions', () => ({
|
|||||||
|
|
||||||
describe('Config tests', () => {
|
describe('Config tests', () => {
|
||||||
it('checking addCoverage with PCOV on windows', async () => {
|
it('checking addCoverage with PCOV on windows', async () => {
|
||||||
let win32: string = await coverage.addCoverage('pcov', '7.4', 'win32');
|
let win32: string = await coverage.addCoverage('PCOV', '7.4', 'win32');
|
||||||
expect(win32).toContain('add_extension pcov');
|
expect(win32).toContain('add_extension pcov');
|
||||||
expect(win32).toContain('Remove-Extension xdebug');
|
expect(win32).toContain('Remove-Extension xdebug');
|
||||||
|
|
||||||
|
@ -3,13 +3,14 @@ import * as extensions from '../src/extensions';
|
|||||||
describe('Extension tests', () => {
|
describe('Extension tests', () => {
|
||||||
it('checking addExtensionOnWindows', async () => {
|
it('checking addExtensionOnWindows', async () => {
|
||||||
let win32: string = await extensions.addExtension(
|
let win32: string = await extensions.addExtension(
|
||||||
'xdebug, pcov, phalcon4',
|
'xdebug, pcov, phalcon4, ast-beta',
|
||||||
'7.4',
|
'7.4',
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
expect(win32).toContain('Add-Extension xdebug');
|
expect(win32).toContain('Add-Extension xdebug');
|
||||||
expect(win32).toContain('Add-Extension pcov');
|
expect(win32).toContain('Add-Extension pcov');
|
||||||
expect(win32).toContain('phalcon.ps1 phalcon4');
|
expect(win32).toContain('phalcon.ps1 phalcon4');
|
||||||
|
expect(win32).toContain('Add-Extension ast beta');
|
||||||
|
|
||||||
win32 = await extensions.addExtension(
|
win32 = await extensions.addExtension(
|
||||||
'phalcon3, does_not_exist',
|
'phalcon3, does_not_exist',
|
||||||
@ -26,58 +27,48 @@ describe('Extension tests', () => {
|
|||||||
|
|
||||||
it('checking addExtensionOnLinux', async () => {
|
it('checking addExtensionOnLinux', async () => {
|
||||||
let linux: string = await extensions.addExtension(
|
let linux: string = await extensions.addExtension(
|
||||||
'xdebug, pcov',
|
'xdebug, pcov, ast-beta',
|
||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
expect(linux).toContain(
|
expect(linux).toContain('update_extension xdebug 2.9.0');
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-xdebug'
|
|
||||||
);
|
|
||||||
expect(linux).toContain('pecl install xdebug');
|
|
||||||
expect(linux).toContain(
|
expect(linux).toContain(
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
|
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
|
||||||
);
|
);
|
||||||
expect(linux).toContain('pecl install pcov');
|
expect(linux).toContain('pecl install -f pcov');
|
||||||
|
expect(linux).toContain('install_extension ast-beta');
|
||||||
|
|
||||||
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
linux = await extensions.addExtension('gearman', '7.0', 'linux');
|
||||||
expect(linux).toContain('gearman.sh 7.0');
|
expect(linux).toContain('gearman.sh 7.0');
|
||||||
linux = await extensions.addExtension('gearman', '7.1', 'linux');
|
linux = await extensions.addExtension('gearman', '7.1', 'linux');
|
||||||
expect(linux).toContain('gearman.sh 7.1');
|
expect(linux).toContain('gearman.sh 7.1');
|
||||||
|
|
||||||
linux = await extensions.addExtension(
|
linux = await extensions.addExtension('gearman', '7.2', 'linux');
|
||||||
'phalcon3, phalcon4, gearman',
|
|
||||||
'7.2',
|
|
||||||
'linux'
|
|
||||||
);
|
|
||||||
expect(linux).toContain('phalcon.sh phalcon3 7.2');
|
|
||||||
expect(linux).toContain('phalcon.sh phalcon4 7.2');
|
|
||||||
expect(linux).toContain('gearman.sh 7.2');
|
expect(linux).toContain('gearman.sh 7.2');
|
||||||
|
|
||||||
linux = await extensions.addExtension(
|
linux = await extensions.addExtension('gearman', '7.3', 'linux');
|
||||||
'phalcon3, phalcon4, gearman',
|
|
||||||
'7.3',
|
|
||||||
'linux'
|
|
||||||
);
|
|
||||||
expect(linux).toContain('phalcon.sh phalcon3 7.3');
|
|
||||||
expect(linux).toContain('phalcon.sh phalcon4 7.3');
|
|
||||||
expect(linux).toContain('gearman.sh 7.3');
|
expect(linux).toContain('gearman.sh 7.3');
|
||||||
|
|
||||||
linux = await extensions.addExtension('phalcon4, gearman', '7.4', 'linux');
|
linux = await extensions.addExtension('gearman', '7.4', 'linux');
|
||||||
expect(linux).toContain('phalcon.sh phalcon4 7.4');
|
|
||||||
expect(linux).toContain('gearman.sh 7.4');
|
expect(linux).toContain('gearman.sh 7.4');
|
||||||
|
|
||||||
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||||
expect(linux).toContain('Platform fedora is not supported');
|
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 () => {
|
it('checking addExtensionOnDarwin', async () => {
|
||||||
let darwin: string = await extensions.addExtension(
|
let darwin: string = await extensions.addExtension(
|
||||||
'xdebug, pcov',
|
'xdebug, pcov, ast-beta',
|
||||||
'7.2',
|
'7.2',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
expect(darwin).toContain('sudo pecl install xdebug');
|
expect(darwin).toContain('sudo pecl install -f xdebug');
|
||||||
expect(darwin).toContain('sudo pecl install pcov');
|
expect(darwin).toContain('sudo pecl install -f pcov');
|
||||||
|
expect(darwin).toContain('install_extension ast-beta');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
darwin = await extensions.addExtension('phalcon3', '7.0', 'darwin');
|
||||||
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
|
expect(darwin).toContain('phalcon_darwin.sh phalcon3 7.0');
|
||||||
@ -86,22 +77,33 @@ describe('Extension tests', () => {
|
|||||||
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
|
expect(darwin).toContain('phalcon_darwin.sh phalcon4 7.3');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
darwin = await extensions.addExtension('pcov', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install pcov');
|
expect(darwin).toContain('sudo pecl install -f pcov');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
darwin = await extensions.addExtension('pcov', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install pcov');
|
expect(darwin).toContain('sudo pecl install -f pcov');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
darwin = await extensions.addExtension('xdebug', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install xdebug-2.5.5');
|
expect(darwin).toContain('sudo pecl install -f xdebug-2.5.5');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('xdebug', '7.0', 'darwin');
|
||||||
|
expect(darwin).toContain('sudo pecl install -f xdebug-2.9.0');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
darwin = await extensions.addExtension('xdebug', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install xdebug');
|
expect(darwin).toContain('sudo pecl install -f xdebug');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install redis-2.2.8');
|
expect(darwin).toContain('sudo pecl install -f redis-2.2.8');
|
||||||
|
|
||||||
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
|
||||||
expect(darwin).toContain('sudo pecl install redis');
|
expect(darwin).toContain('sudo pecl install -f redis');
|
||||||
|
|
||||||
|
darwin = await extensions.addExtension('imagick', '5.6', 'darwin');
|
||||||
|
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(
|
darwin = await extensions.addExtension(
|
||||||
'does_not_exist',
|
'does_not_exist',
|
||||||
|
@ -23,7 +23,7 @@ describe('Matchers', () => {
|
|||||||
|
|
||||||
it('Test Regex', async () => {
|
it('Test Regex', async () => {
|
||||||
const regex1 = /^\d+\)\s.*$/;
|
const regex1 = /^\d+\)\s.*$/;
|
||||||
const regex2 = /^(.*)$/;
|
const regex2 = /^(.*Failed\sasserting\sthat.*)$/;
|
||||||
const regex3 = /^\s*$/;
|
const regex3 = /^\s*$/;
|
||||||
const regex4 = /^(.*):(\d+)$/;
|
const regex4 = /^(.*):(\d+)$/;
|
||||||
expect(regex1.test('1) Tests\\Test::it_tests')).toBe(true);
|
expect(regex1.test('1) Tests\\Test::it_tests')).toBe(true);
|
||||||
|
@ -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 () => {
|
it('checking getPhpunitUri', async () => {
|
||||||
expect(await tools.getPhpunitUrl('tool', 'latest')).toBe(
|
expect(await tools.getPhpunitUrl('tool', 'latest')).toBe(
|
||||||
'https://phar.phpunit.de/tool.phar'
|
'https://phar.phpunit.de/tool.phar'
|
||||||
@ -194,6 +206,30 @@ describe('Tools tests', () => {
|
|||||||
).toStrictEqual(['composer', 'a', 'b']);
|
).toStrictEqual(['composer', 'a', 'b']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking getSymfonyUri', async () => {
|
||||||
|
expect(await tools.getSymfonyUri('latest', 'linux')).toContain(
|
||||||
|
'releases/latest/download/symfony_linux_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'linux')).toContain(
|
||||||
|
'releases/download/v1.2.3/symfony_linux_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('latest', 'darwin')).toContain(
|
||||||
|
'releases/latest/download/symfony_darwin_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'darwin')).toContain(
|
||||||
|
'releases/download/v1.2.3/symfony_darwin_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('latest', 'win32')).toContain(
|
||||||
|
'releases/latest/download/symfony_windows_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'win32')).toContain(
|
||||||
|
'releases/download/v1.2.3/symfony_windows_amd64'
|
||||||
|
);
|
||||||
|
expect(await tools.getSymfonyUri('1.2.3', 'fedora')).toContain(
|
||||||
|
'Platform fedora is not supported'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('checking getCleanedToolsList', async () => {
|
it('checking getCleanedToolsList', async () => {
|
||||||
const tools_list: string[] = await tools.getCleanedToolsList(
|
const tools_list: string[] = await tools.getCleanedToolsList(
|
||||||
'tool, composer:1.2.3, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher'
|
'tool, composer:1.2.3, robmorgan/phinx, hirak/prestissimo, narrowspark/automatic-composer-prefetcher'
|
||||||
@ -239,6 +275,35 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain('Platform fedora is not supported');
|
expect(script).toContain('Platform fedora is not supported');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('checking addDevTools', async () => {
|
||||||
|
let script: string = await tools.addDevTools('phpize', 'linux');
|
||||||
|
expect(script).toContain('add_devtools');
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('php-config', 'linux');
|
||||||
|
expect(script).toContain('add_devtools');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('phpize', 'darwin');
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('php-config', 'darwin');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
|
|
||||||
|
script = await tools.addDevTools('phpize', 'win32');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Log "$cross" "phpize" "phpize is not a windows tool"'
|
||||||
|
);
|
||||||
|
|
||||||
|
script = await tools.addDevTools('php-config', 'win32');
|
||||||
|
expect(script).toContain(
|
||||||
|
'Add-Log "$cross" "php-config" "php-config is not a windows tool"'
|
||||||
|
);
|
||||||
|
|
||||||
|
script = await tools.addDevTools('tool', 'fedora');
|
||||||
|
expect(script).toContain('Platform fedora is not supported');
|
||||||
|
});
|
||||||
|
|
||||||
it('checking addPackage', async () => {
|
it('checking addPackage', async () => {
|
||||||
let script: string = await tools.addPackage(
|
let script: string = await tools.addPackage(
|
||||||
'tool',
|
'tool',
|
||||||
@ -260,7 +325,7 @@ describe('Tools tests', () => {
|
|||||||
|
|
||||||
it('checking addTools on linux', async () => {
|
it('checking addTools on linux', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3',
|
'php-cs-fixer, phpstan, phpunit, pecl, phinx, phinx:1.2.3, phive, php-config, phpize, symfony',
|
||||||
'7.4',
|
'7.4',
|
||||||
'linux'
|
'linux'
|
||||||
);
|
);
|
||||||
@ -273,16 +338,25 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'add_tool https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar phpstan'
|
'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(
|
expect(script).toContain(
|
||||||
'add_tool https://phar.phpunit.de/phpunit.phar phpunit'
|
'add_tool https://phar.phpunit.de/phpunit.phar phpunit'
|
||||||
);
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_linux_amd64 symfony'
|
||||||
|
);
|
||||||
expect(script).toContain('add_pecl');
|
expect(script).toContain('add_pecl');
|
||||||
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
|
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
|
||||||
expect(script).toContain('add_composer_tool phinx phinx:1.2.3 robmorgan/');
|
expect(script).toContain('add_composer_tool phinx phinx:1.2.3 robmorgan/');
|
||||||
|
expect(script).toContain('add_devtools');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
});
|
});
|
||||||
it('checking addTools on darwin', async () => {
|
it('checking addTools on darwin', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, composer-prefetcher:1.2.3',
|
'phpcs, phpcbf, phpcpd, phpmd, psalm, phinx, phive:1.2.3, composer-prefetcher:1.2.3, phpize, php-config, symfony, symfony:1.2.3',
|
||||||
'7.4',
|
'7.4',
|
||||||
'darwin'
|
'darwin'
|
||||||
);
|
);
|
||||||
@ -305,13 +379,24 @@ describe('Tools tests', () => {
|
|||||||
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
|
'https://github.com/vimeo/psalm/releases/latest/download/psalm.phar psalm'
|
||||||
);
|
);
|
||||||
expect(script).toContain('add_composer_tool phinx phinx robmorgan/');
|
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(
|
expect(script).toContain(
|
||||||
'add_composer_tool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
|
'add_composer_tool composer-prefetcher composer-prefetcher:1.2.3 narrowspark/automatic-'
|
||||||
);
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/symfony/cli/releases/latest/download/symfony_darwin_amd64 symfony'
|
||||||
|
);
|
||||||
|
expect(script).toContain(
|
||||||
|
'add_tool https://github.com/symfony/cli/releases/download/v1.2.3/symfony_darwin_amd64 symfony'
|
||||||
|
);
|
||||||
|
expect(script).toContain('add_log "$tick" "phpize" "Added"');
|
||||||
|
expect(script).toContain('add_log "$tick" "php-config" "Added"');
|
||||||
});
|
});
|
||||||
it('checking addTools on windows', async () => {
|
it('checking addTools on windows', async () => {
|
||||||
const script: string = await tools.addTools(
|
const script: string = await tools.addTools(
|
||||||
'codeception, deployer, prestissimo, phpmd, phinx, does_not_exit',
|
'codeception, deployer, prestissimo, phpmd, phinx, phive:0.13.2, php-config, phpize, symfony, does_not_exit',
|
||||||
'7.4',
|
'7.4',
|
||||||
'win32'
|
'win32'
|
||||||
);
|
);
|
||||||
@ -324,7 +409,19 @@ describe('Tools tests', () => {
|
|||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
'Add-Composer-Tool prestissimo prestissimo hirak/'
|
'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-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');
|
||||||
expect(script).toContain('Tool does_not_exit is not supported');
|
expect(script).toContain('Tool does_not_exit is not supported');
|
||||||
});
|
});
|
||||||
it('checking addTools with composer tool using user/tool as input', async () => {
|
it('checking addTools with composer tool using user/tool as input', async () => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: 'Setup PHP Action'
|
name: 'Setup PHP Action'
|
||||||
author: shivammathur
|
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:
|
branding:
|
||||||
color: 'purple'
|
color: 'purple'
|
||||||
inputs:
|
inputs:
|
||||||
|
207
dist/index.js
vendored
207
dist/index.js
vendored
@ -1262,17 +1262,24 @@ module.exports = require("assert");
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = __webpack_require__(87);
|
const os = __importStar(__webpack_require__(87));
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
* Command Format:
|
* Command Format:
|
||||||
* ##[name key=value;key=value]message
|
* ::name key=value,key=value::message
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* ##[warning]This is the user warning message
|
* ::warning::This is the message
|
||||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
* ::set-env name=MY_VAR::some value
|
||||||
*/
|
*/
|
||||||
function issueCommand(command, properties, message) {
|
function issueCommand(command, properties, message) {
|
||||||
const cmd = new Command(command, properties, message);
|
const cmd = new Command(command, properties, message);
|
||||||
@ -1297,34 +1304,39 @@ class Command {
|
|||||||
let cmdStr = CMD_STRING + this.command;
|
let cmdStr = CMD_STRING + this.command;
|
||||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||||
cmdStr += ' ';
|
cmdStr += ' ';
|
||||||
|
let first = true;
|
||||||
for (const key in this.properties) {
|
for (const key in this.properties) {
|
||||||
if (this.properties.hasOwnProperty(key)) {
|
if (this.properties.hasOwnProperty(key)) {
|
||||||
const val = this.properties[key];
|
const val = this.properties[key];
|
||||||
if (val) {
|
if (val) {
|
||||||
// safely append the val - avoid blowing up when attempting to
|
if (first) {
|
||||||
// call .replace() if message is not a string for some reason
|
first = false;
|
||||||
cmdStr += `${key}=${escape(`${val || ''}`)},`;
|
}
|
||||||
|
else {
|
||||||
|
cmdStr += ',';
|
||||||
|
}
|
||||||
|
cmdStr += `${key}=${escapeProperty(val)}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmdStr += CMD_STRING;
|
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
||||||
// safely append the message - avoid blowing up when attempting to
|
|
||||||
// call .replace() if message is not a string for some reason
|
|
||||||
const message = `${this.message || ''}`;
|
|
||||||
cmdStr += escapeData(message);
|
|
||||||
return cmdStr;
|
return cmdStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function escapeData(s) {
|
function escapeData(s) {
|
||||||
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
return (s || '')
|
||||||
|
.replace(/%/g, '%25')
|
||||||
|
.replace(/\r/g, '%0D')
|
||||||
|
.replace(/\n/g, '%0A');
|
||||||
}
|
}
|
||||||
function escape(s) {
|
function escapeProperty(s) {
|
||||||
return s
|
return (s || '')
|
||||||
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A')
|
.replace(/\n/g, '%0A')
|
||||||
.replace(/]/g, '%5D')
|
.replace(/:/g, '%3A')
|
||||||
.replace(/;/g, '%3B');
|
.replace(/,/g, '%2C');
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=command.js.map
|
//# sourceMappingURL=command.js.map
|
||||||
|
|
||||||
@ -1344,10 +1356,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const command_1 = __webpack_require__(431);
|
const command_1 = __webpack_require__(431);
|
||||||
const os = __webpack_require__(87);
|
const os = __importStar(__webpack_require__(87));
|
||||||
const path = __webpack_require__(622);
|
const path = __importStar(__webpack_require__(622));
|
||||||
/**
|
/**
|
||||||
* The code to exit an action
|
* The code to exit an action
|
||||||
*/
|
*/
|
||||||
@ -1724,6 +1743,31 @@ function getCodeceptionUri(version, php_version) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getCodeceptionUri = getCodeceptionUri;
|
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
|
* Function to get the PHPUnit url
|
||||||
*
|
*
|
||||||
@ -1758,6 +1802,35 @@ function getDeployerUrl(version) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getDeployerUrl = getDeployerUrl;
|
exports.getDeployerUrl = getDeployerUrl;
|
||||||
|
/**
|
||||||
|
* Function to get the Deployer url
|
||||||
|
*
|
||||||
|
* @param version
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
function getSymfonyUri(version, os_version) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let filename = '';
|
||||||
|
switch (os_version) {
|
||||||
|
case 'linux':
|
||||||
|
case 'darwin':
|
||||||
|
filename = 'symfony_' + os_version + '_amd64';
|
||||||
|
break;
|
||||||
|
case 'win32':
|
||||||
|
filename = 'symfony_windows_amd64.exe';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||||
|
}
|
||||||
|
switch (version) {
|
||||||
|
case 'latest':
|
||||||
|
return 'releases/latest/download/' + filename;
|
||||||
|
default:
|
||||||
|
return 'releases/download/v' + version + '/' + filename;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.getSymfonyUri = getSymfonyUri;
|
||||||
/**
|
/**
|
||||||
* Function to add/move composer in the tools list
|
* Function to add/move composer in the tools list
|
||||||
*
|
*
|
||||||
@ -1813,6 +1886,29 @@ function addArchive(tool, version, url, os_version) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.addArchive = addArchive;
|
exports.addArchive = addArchive;
|
||||||
|
/**
|
||||||
|
* Function to get the script to setup php-config and phpize
|
||||||
|
*
|
||||||
|
* @param tool
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
function addDevTools(tool, os_version) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
switch (os_version) {
|
||||||
|
case 'linux':
|
||||||
|
return ('add_devtools' +
|
||||||
|
'\n' +
|
||||||
|
(yield utils.addLog('$tick', tool, 'Added', 'linux')));
|
||||||
|
case 'darwin':
|
||||||
|
return yield utils.addLog('$tick', tool, 'Added', 'darwin');
|
||||||
|
case 'win32':
|
||||||
|
return yield utils.addLog('$cross', tool, tool + ' is not a windows tool', 'win32');
|
||||||
|
default:
|
||||||
|
return yield utils.log('Platform ' + os_version + ' is not supported', os_version, 'error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.addDevTools = addDevTools;
|
||||||
/**
|
/**
|
||||||
* Helper function to get script to setup a tool using composer
|
* Helper function to get script to setup a tool using composer
|
||||||
*
|
*
|
||||||
@ -1858,6 +1954,9 @@ function addTools(tools_csv, php_version, os_version) {
|
|||||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||||
script += yield addArchive(tool, version, url, os_version);
|
script += yield addArchive(tool, version, url, os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'phive':
|
||||||
|
script += yield addPhive(version, os_version);
|
||||||
|
break;
|
||||||
case 'phpstan':
|
case 'phpstan':
|
||||||
url = github + 'phpstan/phpstan/' + uri;
|
url = github + 'phpstan/phpstan/' + uri;
|
||||||
script += yield addArchive(tool, version, url, os_version);
|
script += yield addArchive(tool, version, url, os_version);
|
||||||
@ -1902,6 +2001,16 @@ function addTools(tools_csv, php_version, os_version) {
|
|||||||
case 'pecl':
|
case 'pecl':
|
||||||
script += yield getPECLCommand(os_version);
|
script += yield getPECLCommand(os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'php-config':
|
||||||
|
case 'phpize':
|
||||||
|
script += yield addDevTools(tool, os_version);
|
||||||
|
break;
|
||||||
|
case 'symfony':
|
||||||
|
case 'symfony-cli':
|
||||||
|
uri = yield getSymfonyUri(version, os_version);
|
||||||
|
url = github + 'symfony/cli/' + uri;
|
||||||
|
script += yield addArchive('symfony', version, url, os_version);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
script += yield utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version);
|
script += yield utils.addLog('$cross', tool, 'Tool ' + tool + ' is not supported', os_version);
|
||||||
break;
|
break;
|
||||||
@ -2054,7 +2163,7 @@ exports.disableCoverage = disableCoverage;
|
|||||||
*/
|
*/
|
||||||
function addCoverage(coverage_driver, version, os_version) {
|
function addCoverage(coverage_driver, version, os_version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
coverage_driver.toLowerCase();
|
coverage_driver = coverage_driver.toLowerCase();
|
||||||
const script = '\n' + (yield utils.stepLog('Setup Coverage', os_version));
|
const script = '\n' + (yield utils.stepLog('Setup Coverage', os_version));
|
||||||
const pipe = yield utils.suppressOutput(os_version);
|
const pipe = yield utils.suppressOutput(os_version);
|
||||||
switch (coverage_driver) {
|
switch (coverage_driver) {
|
||||||
@ -2216,13 +2325,15 @@ function build(filename, version, os_version) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// taking inputs
|
// taking inputs
|
||||||
const extension_csv = (yield utils.getInput('extensions', false)) ||
|
const extension_csv = (yield utils.getInput('extensions', false)) ||
|
||||||
|
(yield utils.getInput('extension', false)) ||
|
||||||
(yield utils.getInput('extension-csv', false));
|
(yield utils.getInput('extension-csv', false));
|
||||||
const ini_values_csv = (yield utils.getInput('ini-values', false)) ||
|
const ini_values_csv = (yield utils.getInput('ini-values', false)) ||
|
||||||
(yield utils.getInput('ini-values-csv', false));
|
(yield utils.getInput('ini-values-csv', false));
|
||||||
const coverage_driver = yield utils.getInput('coverage', false);
|
const coverage_driver = yield utils.getInput('coverage', false);
|
||||||
const pecl = yield utils.getInput('pecl', false);
|
const pecl = yield utils.getInput('pecl', false);
|
||||||
let tools_csv = yield utils.getInput('tools', false);
|
let tools_csv = yield utils.getInput('tools', false);
|
||||||
if (pecl == 'true') {
|
if (pecl == 'true' ||
|
||||||
|
/.*-(beta|alpha|devel|snapshot).*/.test(extension_csv)) {
|
||||||
tools_csv = 'pecl, ' + tools_csv;
|
tools_csv = 'pecl, ' + tools_csv;
|
||||||
}
|
}
|
||||||
let script = yield utils.readScript(filename, version, os_version);
|
let script = yield utils.readScript(filename, version, os_version);
|
||||||
@ -2531,14 +2642,27 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
// add script to enable extension is already installed along with php
|
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
install_command = 'install_extension ' + extension + pipe;
|
||||||
|
break;
|
||||||
case /5\.6xdebug/.test(version_extension):
|
case /5\.6xdebug/.test(version_extension):
|
||||||
install_command = 'sudo pecl install xdebug-2.5.5' + pipe;
|
install_command = 'sudo pecl install -f xdebug-2.5.5' + pipe;
|
||||||
|
break;
|
||||||
|
case /7\.0xdebug/.test(version_extension):
|
||||||
|
install_command = 'sudo pecl install -f xdebug-2.9.0' + pipe;
|
||||||
break;
|
break;
|
||||||
case /5\.6redis/.test(version_extension):
|
case /5\.6redis/.test(version_extension):
|
||||||
install_command = 'sudo pecl install redis-2.2.8' + pipe;
|
install_command = 'sudo pecl install -f redis-2.2.8' + pipe;
|
||||||
|
break;
|
||||||
|
case /[5-9]\.\dimagick/.test(version_extension):
|
||||||
|
install_command =
|
||||||
|
'brew install pkg-config imagemagick' +
|
||||||
|
pipe +
|
||||||
|
' && sudo pecl install -f imagick' +
|
||||||
|
pipe;
|
||||||
break;
|
break;
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
install_command =
|
install_command =
|
||||||
@ -2551,7 +2675,7 @@ function addExtensionDarwin(extension_csv, version, pipe) {
|
|||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
install_command = 'sudo pecl install ' + extension + pipe;
|
install_command = 'sudo pecl install -f ' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
script +=
|
script +=
|
||||||
@ -2580,9 +2704,14 @@ function addExtensionWindows(extension_csv, version, pipe) {
|
|||||||
let script = '\n';
|
let script = '\n';
|
||||||
yield utils.asyncForEach(extensions, function (extension) {
|
yield utils.asyncForEach(extensions, function (extension) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// add script to enable extension is already installed along with php
|
extension = extension.toLowerCase();
|
||||||
|
const [extension_name, stability] = extension.split('-');
|
||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
script += '\nAdd-Extension ' + extension_name + ' ' + stability;
|
||||||
|
break;
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
script +=
|
script +=
|
||||||
@ -2618,10 +2747,13 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
yield utils.asyncForEach(extensions, function (extension) {
|
yield utils.asyncForEach(extensions, function (extension) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
// add script to enable extension is already installed along with php
|
|
||||||
const version_extension = version + extension;
|
const version_extension = version + extension;
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
install_command = 'install_extension ' + extension + pipe;
|
||||||
|
break;
|
||||||
// match 5.6gearman..7.4gearman
|
// match 5.6gearman..7.4gearman
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
install_command =
|
install_command =
|
||||||
@ -2631,17 +2763,24 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
version +
|
version +
|
||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
// 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):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
install_command =
|
script +=
|
||||||
'sh ' +
|
'\nsh ' +
|
||||||
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
||||||
' ' +
|
' ' +
|
||||||
extension +
|
extension +
|
||||||
' ' +
|
' ' +
|
||||||
version +
|
version;
|
||||||
pipe;
|
return;
|
||||||
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;
|
||||||
default:
|
default:
|
||||||
install_command =
|
install_command =
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
||||||
@ -2649,7 +2788,7 @@ function addExtensionLinux(extension_csv, version, pipe) {
|
|||||||
'-' +
|
'-' +
|
||||||
extension.replace('pdo_', '').replace('pdo-', '') +
|
extension.replace('pdo_', '').replace('pdo-', '') +
|
||||||
pipe +
|
pipe +
|
||||||
' || sudo pecl install ' +
|
' || sudo pecl install -f ' +
|
||||||
extension +
|
extension +
|
||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
|
@ -6,7 +6,7 @@ jobs:
|
|||||||
tests:
|
tests:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
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']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -5,7 +5,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
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']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -8,7 +8,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
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']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -8,7 +8,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
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']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -5,7 +5,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
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']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -8,7 +8,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
php-versions: ['7.3', '7.4']
|
php-versions: ['7.3', '7.4']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -5,7 +5,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
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']
|
php-versions: ['7.2', '7.3', '7.4']
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
steps:
|
steps:
|
||||||
|
1269
package-lock.json
generated
1269
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.7.2",
|
"version": "1.8.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Setup PHP for use with GitHub Actions",
|
"description": "Setup PHP for use with GitHub Actions",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -50,7 +50,7 @@
|
|||||||
"husky": {
|
"husky": {
|
||||||
"skipCI": true,
|
"skipCI": true,
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"pre-commit": "npm run build && npm run format && npm run release"
|
"pre-commit": "npm run format && npm run lint && npm run build && npm run release"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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.
@ -7,7 +7,7 @@
|
|||||||
"regexp": "^\\d+\\)\\s.*$"
|
"regexp": "^\\d+\\)\\s.*$"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"regexp": "^(.*)$",
|
"regexp": "^(.*Failed\\sasserting\\sthat.*)$",
|
||||||
"message": 1
|
"message": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ export async function addCoverage(
|
|||||||
version: string,
|
version: string,
|
||||||
os_version: string
|
os_version: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
coverage_driver.toLowerCase();
|
coverage_driver = coverage_driver.toLowerCase();
|
||||||
const script: string =
|
const script: string =
|
||||||
'\n' + (await utils.stepLog('Setup Coverage', os_version));
|
'\n' + (await utils.stepLog('Setup Coverage', os_version));
|
||||||
const pipe: string = await utils.suppressOutput(os_version);
|
const pipe: string = await utils.suppressOutput(os_version);
|
||||||
|
@ -18,14 +18,27 @@ export async function addExtensionDarwin(
|
|||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
// add script to enable extension is already installed along with php
|
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
install_command = 'install_extension ' + extension + pipe;
|
||||||
|
break;
|
||||||
case /5\.6xdebug/.test(version_extension):
|
case /5\.6xdebug/.test(version_extension):
|
||||||
install_command = 'sudo pecl install xdebug-2.5.5' + pipe;
|
install_command = 'sudo pecl install -f xdebug-2.5.5' + pipe;
|
||||||
|
break;
|
||||||
|
case /7\.0xdebug/.test(version_extension):
|
||||||
|
install_command = 'sudo pecl install -f xdebug-2.9.0' + pipe;
|
||||||
break;
|
break;
|
||||||
case /5\.6redis/.test(version_extension):
|
case /5\.6redis/.test(version_extension):
|
||||||
install_command = 'sudo pecl install redis-2.2.8' + pipe;
|
install_command = 'sudo pecl install -f redis-2.2.8' + pipe;
|
||||||
|
break;
|
||||||
|
case /[5-9]\.\dimagick/.test(version_extension):
|
||||||
|
install_command =
|
||||||
|
'brew install pkg-config imagemagick' +
|
||||||
|
pipe +
|
||||||
|
' && sudo pecl install -f imagick' +
|
||||||
|
pipe;
|
||||||
break;
|
break;
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
install_command =
|
install_command =
|
||||||
@ -38,7 +51,7 @@ export async function addExtensionDarwin(
|
|||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
install_command = 'sudo pecl install ' + extension + pipe;
|
install_command = 'sudo pecl install -f ' + extension + pipe;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
script +=
|
script +=
|
||||||
@ -67,9 +80,14 @@ export async function addExtensionWindows(
|
|||||||
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
const extensions: Array<string> = await utils.extensionArray(extension_csv);
|
||||||
let script = '\n';
|
let script = '\n';
|
||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
// add script to enable extension is already installed along with php
|
extension = extension.toLowerCase();
|
||||||
|
const [extension_name, stability]: string[] = extension.split('-');
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
script += '\nAdd-Extension ' + extension_name + ' ' + stability;
|
||||||
|
break;
|
||||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
script +=
|
script +=
|
||||||
@ -105,10 +123,13 @@ export async function addExtensionLinux(
|
|||||||
let script = '\n';
|
let script = '\n';
|
||||||
await utils.asyncForEach(extensions, async function(extension: string) {
|
await utils.asyncForEach(extensions, async function(extension: string) {
|
||||||
extension = extension.toLowerCase();
|
extension = extension.toLowerCase();
|
||||||
// add script to enable extension is already installed along with php
|
|
||||||
const version_extension: string = version + extension;
|
const version_extension: string = version + extension;
|
||||||
let install_command = '';
|
let install_command = '';
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// match pre-release versions
|
||||||
|
case /.*-(beta|alpha|devel|snapshot)/.test(version_extension):
|
||||||
|
install_command = 'install_extension ' + extension + pipe;
|
||||||
|
break;
|
||||||
// match 5.6gearman..7.4gearman
|
// match 5.6gearman..7.4gearman
|
||||||
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
|
||||||
install_command =
|
install_command =
|
||||||
@ -118,17 +139,24 @@ export async function addExtensionLinux(
|
|||||||
version +
|
version +
|
||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
// 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):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||||
install_command =
|
script +=
|
||||||
'sh ' +
|
'\nsh ' +
|
||||||
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
path.join(__dirname, '../src/scripts/ext/phalcon.sh') +
|
||||||
' ' +
|
' ' +
|
||||||
extension +
|
extension +
|
||||||
' ' +
|
' ' +
|
||||||
version +
|
version;
|
||||||
pipe;
|
return;
|
||||||
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;
|
||||||
default:
|
default:
|
||||||
install_command =
|
install_command =
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' +
|
||||||
@ -136,7 +164,7 @@ export async function addExtensionLinux(
|
|||||||
'-' +
|
'-' +
|
||||||
extension.replace('pdo_', '').replace('pdo-', '') +
|
extension.replace('pdo_', '').replace('pdo-', '') +
|
||||||
pipe +
|
pipe +
|
||||||
' || sudo pecl install ' +
|
' || sudo pecl install -f ' +
|
||||||
extension +
|
extension +
|
||||||
pipe;
|
pipe;
|
||||||
break;
|
break;
|
||||||
|
@ -22,6 +22,7 @@ export async function build(
|
|||||||
// taking inputs
|
// taking inputs
|
||||||
const extension_csv: string =
|
const extension_csv: string =
|
||||||
(await utils.getInput('extensions', false)) ||
|
(await utils.getInput('extensions', false)) ||
|
||||||
|
(await utils.getInput('extension', false)) ||
|
||||||
(await utils.getInput('extension-csv', false));
|
(await utils.getInput('extension-csv', false));
|
||||||
const ini_values_csv: string =
|
const ini_values_csv: string =
|
||||||
(await utils.getInput('ini-values', false)) ||
|
(await utils.getInput('ini-values', false)) ||
|
||||||
@ -29,7 +30,10 @@ export async function build(
|
|||||||
const coverage_driver: string = await utils.getInput('coverage', false);
|
const coverage_driver: string = await utils.getInput('coverage', false);
|
||||||
const pecl: string = await utils.getInput('pecl', false);
|
const pecl: string = await utils.getInput('pecl', false);
|
||||||
let tools_csv: string = await utils.getInput('tools', false);
|
let tools_csv: string = await utils.getInput('tools', false);
|
||||||
if (pecl == 'true') {
|
if (
|
||||||
|
pecl == 'true' ||
|
||||||
|
/.*-(beta|alpha|devel|snapshot).*/.test(extension_csv)
|
||||||
|
) {
|
||||||
tools_csv = 'pecl, ' + tools_csv;
|
tools_csv = 'pecl, ' + tools_csv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,20 +26,21 @@ add_extension() {
|
|||||||
elif php -m | grep -i -q -w "$extension"; then
|
elif php -m | grep -i -q -w "$extension"; then
|
||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
elif ! php -m | grep -i -q -w "$extension"; then
|
elif ! php -m | grep -i -q -w "$extension"; then
|
||||||
exists=$(curl -sL https://pecl.php.net/json.php?package="$extension" -w "%{http_code}" -o /dev/null)
|
(eval "$install_command" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
if [ "$exists" = "200" ] || [[ "$extension" == "phalcon"* ]]; then
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
(
|
|
||||||
eval "$install_command" && \
|
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
|
||||||
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
|
||||||
else
|
|
||||||
if ! php -m | grep -i -q -w "$extension"; then
|
|
||||||
add_log "$cross" "$extension" "Could not find $extension for PHP $semver on PECL"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to force install extensions using PECL
|
||||||
|
install_extension() {
|
||||||
|
extension=$1
|
||||||
|
extension_name="$(echo "$extension" | cut -d'-' -f 1)"
|
||||||
|
sudo sed -i "/$extension_name/d" "$ini_file"
|
||||||
|
sudo rm -rf /etc/php/"$version"/cli/conf.d/*"$extension_name"* >/dev/null 2>&1
|
||||||
|
sudo rm -rf "$ext_dir"/"$extension_name".so >/dev/null 2>&1
|
||||||
|
sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
# Function to remove extensions
|
# Function to remove extensions
|
||||||
remove_extension() {
|
remove_extension() {
|
||||||
extension=$1
|
extension=$1
|
||||||
@ -53,6 +54,8 @@ add_tool() {
|
|||||||
tool=$2
|
tool=$2
|
||||||
if [ "$tool" = "composer" ]; then
|
if [ "$tool" = "composer" ]; then
|
||||||
brew install composer >/dev/null 2>&1
|
brew install composer >/dev/null 2>&1
|
||||||
|
composer -q global config process-timeout 0
|
||||||
|
add_log "$tick" "$tool" "Added"
|
||||||
else
|
else
|
||||||
if [ ! -e /usr/local/bin/"$tool" ]; then
|
if [ ! -e /usr/local/bin/"$tool" ]; then
|
||||||
rm -rf /usr/local/bin/"${tool:?}"
|
rm -rf /usr/local/bin/"${tool:?}"
|
||||||
@ -65,6 +68,11 @@ add_tool() {
|
|||||||
add_log "$cross" "$tool" "Could not setup $tool"
|
add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
fi
|
fi
|
||||||
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() {
|
add_composer_tool() {
|
||||||
@ -72,13 +80,17 @@ add_composer_tool() {
|
|||||||
release=$2
|
release=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
(
|
(
|
||||||
composer global require "$prefix$release" >/dev/null 2>&1 && \
|
composer global require "$prefix$release" >/dev/null 2>&1 && \
|
||||||
sudo ln -sf "$(composer -q global config home)"/vendor/bin/"$tool" /usr/local/bin/"$tool" && \
|
sudo ln -sf "$(composer -q global config home)"/vendor/bin/"$tool" /usr/local/bin/"$tool" && \
|
||||||
add_log "$tick" "$tool" "Added"
|
add_log "$tick" "$tool" "Added"
|
||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
}
|
}
|
||||||
|
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
|
sudo pear config-set php_ini "$ini_file" >/dev/null 2>&1
|
||||||
|
sudo pear config-set auto_discover 1 >/dev/null 2>&1
|
||||||
|
sudo pear channel-update pear.php.net >/dev/null 2>&1
|
||||||
|
sudo pecl channel-update pecl.php.net >/dev/null 2>&1
|
||||||
add_log "$tick" "PECL" "Added"
|
add_log "$tick" "PECL" "Added"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +111,7 @@ version=$1
|
|||||||
step_log "Setup PHP"
|
step_log "Setup PHP"
|
||||||
setup_php_and_composer
|
setup_php_and_composer
|
||||||
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
echo "date.timezone=UTC" >> "$ini_file"
|
echo "date.timezone=UTC" >>"$ini_file"
|
||||||
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
||||||
sudo chmod 777 "$ini_file"
|
sudo chmod 777 "$ini_file"
|
||||||
mkdir -p "$(pecl config-get ext_dir)"
|
mkdir -p "$(pecl config-get ext_dir)"
|
||||||
|
@ -10,18 +10,47 @@ Param (
|
|||||||
[string]
|
[string]
|
||||||
$version
|
$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)
|
$tick = ([char]8730)
|
||||||
$domain = 'https://github.com'
|
$domain = 'https://github.com'
|
||||||
$php_dir = 'C:\tools\php'
|
$php_dir = 'C:\tools\php'
|
||||||
$ext_dir = $php_dir + '\ext'
|
$ext_dir = $php_dir + '\ext'
|
||||||
$installed = Get-Php -Path $php_dir
|
|
||||||
$extension_version = $extension.substring($extension.Length - 1)
|
$extension_version = $extension.substring($extension.Length - 1)
|
||||||
$nts = if(! $installed.ThreadSafe ) { "_nts" } else { "" }
|
|
||||||
$match = Invoke-WebRequest -UseBasicParsing -Uri $domain/phalcon/cphalcon/releases | Select-String -Pattern "href=`"(.*phalcon_x64_.*_php${version}_${extension_version}.*[0-9]${nts}.zip)`""
|
if($extension_version -eq '4') {
|
||||||
$zip_file = $match.Matches[0].Groups[1].Value
|
if (Test-Path $ext_dir\php_psr.dll) {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $domain/$zip_file -OutFile $ENV:RUNNER_TOOL_CACHE\phalcon.zip >$null 2>&1
|
Enable-PhpExtension -Extension psr -Path $php_dir
|
||||||
Expand-Archive -Path $ENV:RUNNER_TOOL_CACHE\phalcon.zip -DestinationPath $ENV:RUNNER_TOOL_CACHE\phalcon -Force >$null 2>&1
|
} else {
|
||||||
New-Item -ItemType SymbolicLink -Path $ext_dir\php_phalcon.dll -Target $ENV:RUNNER_TOOL_CACHE\phalcon\php_phalcon.dll >$null 2>&1
|
Install-Phpextension psr -MinimumStability stable -Path $php_dir
|
||||||
Install-Phpextension psr -MinimumStability stable -Path $php_dir
|
}
|
||||||
Enable-PhpExtension -Extension phalcon -Path $php_dir
|
}
|
||||||
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "32" $tick $extension "Installed and enabled"
|
|
||||||
|
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
|
||||||
|
}
|
@ -1,22 +1,82 @@
|
|||||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
# Function to log result of a operation
|
||||||
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
|
add_log() {
|
||||||
curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | sudo bash
|
mark=$1
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-psr
|
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
|
# Function to update php ppa
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-dev
|
update_ppa() {
|
||||||
for tool in php-config phpize; do
|
if [ "$ppa_updated" = "false" ]; then
|
||||||
if [ -e "/usr/bin/$tool$2" ]; 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
|
||||||
sudo update-alternatives --set $tool /usr/bin/"$tool$2"
|
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
|
fi
|
||||||
done
|
else
|
||||||
cd ~ && git clone --depth=1 https://github.com/jbboehr/php-psr.git
|
install_phalcon "$1" "$2"
|
||||||
cd php-psr && sudo /usr/bin/phpize"$2"
|
fi
|
||||||
./configure --with-php-config=/usr/bin/php-config"$2"
|
|
||||||
make -j2 && sudo make -j2 install
|
|
||||||
echo "extension=psr.so" >> "$ini_file"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
extension_major_version=$(echo "$1" | grep -i -Po '\d')
|
if [ "$extension_major_version" = "3" ]; then
|
||||||
extension_version=$(apt-cache policy -- *phalcon | grep -i -Po "$extension_major_version\.\d\.\d.*php$2" | head -n 1)
|
if [ -e "$ext_dir/phalcon.so" ]; then
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-fast -o Dpkg::Options::="--force-overwrite" install -y php"$2"-phalcon="$extension_version"
|
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=$1
|
||||||
extension_major=${extension: -1}
|
extension_major=${extension: -1}
|
||||||
php_version=$2
|
php_version=$2
|
||||||
brew tap shivammathur/homebrew-phalcon
|
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
brew install phalcon@"$php_version"_"$extension_major"
|
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
|
@ -38,6 +38,17 @@ add_extension() {
|
|||||||
(update_ppa && eval "$install_command" && add_log "$tick" "$extension" "Installed and enabled") ||
|
(update_ppa && eval "$install_command" && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||||
fi
|
fi
|
||||||
|
sudo chmod 777 "$ini_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to force install extensions using PECL
|
||||||
|
install_extension() {
|
||||||
|
extension=$1
|
||||||
|
extension_name="$(echo "$extension" | cut -d'-' -f 1)"
|
||||||
|
sudo sed -i "/$extension_name/d" "$ini_file"
|
||||||
|
sudo rm -rf /etc/php/"$version"/cli/conf.d/*"$extension_name"* >/dev/null 2>&1
|
||||||
|
sudo rm -rf "$ext_dir"/"$extension_name".so >/dev/null 2>&1
|
||||||
|
sudo pecl install -f "$extension" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to remove extensions
|
# Function to remove extensions
|
||||||
@ -51,6 +62,21 @@ remove_extension() {
|
|||||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to update extension
|
||||||
|
update_extension() {
|
||||||
|
extension=$1
|
||||||
|
latest_version=$2
|
||||||
|
current_version=$(php -r "echo phpversion('$extension');")
|
||||||
|
final_version=$(printf "%s\n%s" "$current_version" "$latest_version" | sort | tail -n 1)
|
||||||
|
if [ "$final_version" != "$current_version" ]; then
|
||||||
|
version_exists=$(apt-cache policy -- *"$extension" | grep "$final_version")
|
||||||
|
if [ -z "$version_exists" ]; then
|
||||||
|
update_ppa
|
||||||
|
fi
|
||||||
|
$apt_install php"$version"-"$extension"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup a remote tool
|
# Function to setup a remote tool
|
||||||
add_tool() {
|
add_tool() {
|
||||||
url=$1
|
url=$1
|
||||||
@ -65,6 +91,14 @@ add_tool() {
|
|||||||
else
|
else
|
||||||
add_log "$cross" "$tool" "Could not setup $tool"
|
add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
fi
|
fi
|
||||||
|
if [ "$tool" = "composer" ]; then
|
||||||
|
composer -q global config process-timeout 0
|
||||||
|
fi
|
||||||
|
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() {
|
add_composer_tool() {
|
||||||
@ -78,6 +112,15 @@ add_composer_tool() {
|
|||||||
) || add_log "$cross" "$tool" "Could not setup $tool"
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to setup phpize and php-config
|
||||||
|
add_devtools() {
|
||||||
|
if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then
|
||||||
|
$apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
||||||
|
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
# Function to setup the nightly build from master branch
|
# Function to setup the nightly build from master branch
|
||||||
setup_master() {
|
setup_master() {
|
||||||
tar_file=php_"$version"%2Bubuntu"$(lsb_release -r -s)".tar.xz
|
tar_file=php_"$version"%2Bubuntu"$(lsb_release -r -s)".tar.xz
|
||||||
@ -93,16 +136,12 @@ setup_master() {
|
|||||||
|
|
||||||
# Function to setup PECL
|
# Function to setup PECL
|
||||||
add_pecl() {
|
add_pecl() {
|
||||||
update_ppa
|
add_devtools
|
||||||
$apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1
|
$apt_install php-pear >/dev/null 2>&1
|
||||||
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
|
||||||
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
|
||||||
wget https://github.com/pear/pearweb_phars/raw/master/install-pear-nozlib.phar >/dev/null 2>&1
|
|
||||||
sudo php install-pear-nozlib.phar >/dev/null 2>&1
|
|
||||||
sudo rm -rf install-pear-nozlib.phar >/dev/null 2>&1
|
|
||||||
sudo pear config-set php_ini "$ini_file" >/dev/null 2>&1
|
sudo pear config-set php_ini "$ini_file" >/dev/null 2>&1
|
||||||
sudo pear config-set auto_discover 1 >/dev/null 2>&1
|
sudo pear config-set auto_discover 1 >/dev/null 2>&1
|
||||||
sudo pear channel-update pear.php.net >/dev/null 2>&1
|
sudo pear channel-update pear.php.net >/dev/null 2>&1
|
||||||
|
sudo pecl channel-update pecl.php.net >/dev/null 2>&1
|
||||||
add_log "$tick" "PECL" "Added"
|
add_log "$tick" "PECL" "Added"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ Function Add-Extension {
|
|||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension }
|
$extension_info = Get-PhpExtension -Path $php_dir | Where-Object { $_.Name -eq $extension -or $_.Handle -eq $extension }
|
||||||
if ($null -ne $extension_info) {
|
if ($null -ne $extension_info -and $mininum_stability -eq 'stable') {
|
||||||
switch ($extension_info.State) {
|
switch ($extension_info.State) {
|
||||||
'Builtin' {
|
'Builtin' {
|
||||||
Add-Log $tick $extension "Enabled"
|
Add-Log $tick $extension "Enabled"
|
||||||
@ -51,7 +51,11 @@ Function Add-Extension {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Install-PhpExtension -Extension $extension -MinimumStability $mininum_stability -Path $php_dir
|
Install-PhpExtension -Extension $extension -MinimumStability $mininum_stability -Path $php_dir
|
||||||
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 {
|
catch {
|
||||||
@ -75,7 +79,6 @@ Function Remove-Extension() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to setup a remote tool
|
|
||||||
Function Add-Tool() {
|
Function Add-Tool() {
|
||||||
Param (
|
Param (
|
||||||
[Parameter(Position = 0, Mandatory = $true)]
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
@ -89,13 +92,16 @@ Function Add-Tool() {
|
|||||||
[string]
|
[string]
|
||||||
$tool
|
$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
|
Install-Composer -Scope System -Path $php_dir -PhpPath $php_dir
|
||||||
Add-Log $tick $tool "Added"
|
composer -q global config process-timeout 0
|
||||||
|
} elseif ($tool -eq "symfony") {
|
||||||
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe
|
||||||
|
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.exe" > $null 2>&1
|
||||||
} else {
|
} else {
|
||||||
if (Test-Path $php_dir\$tool) {
|
|
||||||
Remove-Item $php_dir\$tool
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
|
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool
|
||||||
$bat_content = @()
|
$bat_content = @()
|
||||||
@ -105,14 +111,17 @@ Function Add-Tool() {
|
|||||||
$bat_content += "php %BIN_TARGET% %*"
|
$bat_content += "php %BIN_TARGET% %*"
|
||||||
Set-Content -Path $php_dir\$tool.bat -Value $bat_content
|
Set-Content -Path $php_dir\$tool.bat -Value $bat_content
|
||||||
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.bat" > $null 2>&1
|
Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.bat" > $null 2>&1
|
||||||
if (Test-Path $php_dir\$tool) {
|
} catch { }
|
||||||
Add-Log $tick $tool "Added"
|
}
|
||||||
} else {
|
if($tool -eq "phive") {
|
||||||
Add-Log $cross $tool "Could not add $tool"
|
Add-Extension curl >$null 2>&1
|
||||||
}
|
Add-Extension mbstring >$null 2>&1
|
||||||
} catch {
|
Add-Extension xml >$null 2>&1
|
||||||
Add-Log $cross $tool "Could not add $tool"
|
}
|
||||||
}
|
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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +154,7 @@ Function Add-Composer-Tool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Function Add-PECL() {
|
Function Add-PECL() {
|
||||||
Add-Log $tick "PECL" "Use extensions input or Install-PhpExtension to setup PECL extensions on windows"
|
Add-Log $tick "PECL" "Use extensions input to setup PECL extensions on windows"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
@ -155,7 +164,11 @@ $php_dir = 'C:\tools\php'
|
|||||||
$ext_dir = $php_dir + '\ext'
|
$ext_dir = $php_dir + '\ext'
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
$master_version = '8.0'
|
$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"
|
Step-Log "Setup PhpManager"
|
||||||
Install-Module -Name PhpManager -Force -Scope CurrentUser
|
Install-Module -Name PhpManager -Force -Scope CurrentUser
|
||||||
@ -170,7 +183,8 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Step-Log "Setup PHP"
|
Step-Log "Setup PHP"
|
||||||
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.')))) {
|
$status = "Installed"
|
||||||
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) {
|
||||||
if ($version -lt '7.0') {
|
if ($version -lt '7.0') {
|
||||||
Install-Module -Name VcRedist -Force
|
Install-Module -Name VcRedist -Force
|
||||||
$arch='x86'
|
$arch='x86'
|
||||||
@ -179,10 +193,12 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
$version = 'master'
|
$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 {
|
||||||
else {
|
$updated = Update-Php $php_dir >$null 2>&1
|
||||||
Update-Php $php_dir >$null 2>&1
|
if($updated -eq $False) {
|
||||||
|
$status = "Found"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$installed = Get-Php -Path $php_dir
|
$installed = Get-Php -Path $php_dir
|
||||||
@ -190,8 +206,12 @@ Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir
|
|||||||
Enable-PhpExtension -Extension openssl, curl, opcache -Path $php_dir
|
Enable-PhpExtension -Extension openssl, curl, opcache -Path $php_dir
|
||||||
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
|
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
|
||||||
if ($version -eq 'master') {
|
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_buffer_size' -Value '256M' -Path $php_dir
|
||||||
Set-PhpIniKey -Key 'opcache.jit' -Value '1235' -Path $php_dir
|
Set-PhpIniKey -Key 'opcache.jit' -Value '1235' -Path $php_dir
|
||||||
}
|
}
|
||||||
Add-Log $tick "PHP" "Installed PHP $($installed.FullVersion)"
|
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
||||||
|
112
src/tools.ts
112
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
|
* 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
|
* Function to add/move composer in the tools list
|
||||||
*
|
*
|
||||||
@ -269,6 +333,41 @@ export async function addArchive(
|
|||||||
return (await getArchiveCommand(os_version)) + url + ' ' + tool;
|
return (await getArchiveCommand(os_version)) + url + ' ' + tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to get the script to setup php-config and phpize
|
||||||
|
*
|
||||||
|
* @param tool
|
||||||
|
* @param os_version
|
||||||
|
*/
|
||||||
|
export async function addDevTools(
|
||||||
|
tool: string,
|
||||||
|
os_version: string
|
||||||
|
): Promise<string> {
|
||||||
|
switch (os_version) {
|
||||||
|
case 'linux':
|
||||||
|
return (
|
||||||
|
'add_devtools' +
|
||||||
|
'\n' +
|
||||||
|
(await utils.addLog('$tick', tool, 'Added', 'linux'))
|
||||||
|
);
|
||||||
|
case 'darwin':
|
||||||
|
return await utils.addLog('$tick', tool, 'Added', 'darwin');
|
||||||
|
case 'win32':
|
||||||
|
return await utils.addLog(
|
||||||
|
'$cross',
|
||||||
|
tool,
|
||||||
|
tool + ' is not a windows tool',
|
||||||
|
'win32'
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return await utils.log(
|
||||||
|
'Platform ' + os_version + ' is not supported',
|
||||||
|
os_version,
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get script to setup a tool using composer
|
* Helper function to get script to setup a tool using composer
|
||||||
*
|
*
|
||||||
@ -319,6 +418,9 @@ export async function addTools(
|
|||||||
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
url = github + 'squizlabs/PHP_CodeSniffer/' + uri;
|
||||||
script += await addArchive(tool, version, url, os_version);
|
script += await addArchive(tool, version, url, os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'phive':
|
||||||
|
script += await addPhive(version, os_version);
|
||||||
|
break;
|
||||||
case 'phpstan':
|
case 'phpstan':
|
||||||
url = github + 'phpstan/phpstan/' + uri;
|
url = github + 'phpstan/phpstan/' + uri;
|
||||||
script += await addArchive(tool, version, url, os_version);
|
script += await addArchive(tool, version, url, os_version);
|
||||||
@ -368,6 +470,16 @@ export async function addTools(
|
|||||||
case 'pecl':
|
case 'pecl':
|
||||||
script += await getPECLCommand(os_version);
|
script += await getPECLCommand(os_version);
|
||||||
break;
|
break;
|
||||||
|
case 'php-config':
|
||||||
|
case 'phpize':
|
||||||
|
script += await addDevTools(tool, os_version);
|
||||||
|
break;
|
||||||
|
case 'symfony':
|
||||||
|
case 'symfony-cli':
|
||||||
|
uri = await getSymfonyUri(version, os_version);
|
||||||
|
url = github + 'symfony/cli/' + uri;
|
||||||
|
script += await addArchive('symfony', version, url, os_version);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
script += await utils.addLog(
|
script += await utils.addLog(
|
||||||
'$cross',
|
'$cross',
|
||||||
|
Reference in New Issue
Block a user