Compare commits

...

42 Commits
1.5.5 ... 1.6.0

Author SHA1 Message Date
cfa7bc51cd Merge pull request #106 from shivammathur/develop
Fix coverage log for Xdebug on PHP 8.0
2019-12-09 15:30:42 +05:30
ade633f0da Fix coverage log for Xdebug on PHP 8.0 2019-12-09 14:58:42 +05:30
2cabcf2941 Merge pull request #105 from shivammathur/develop
1.6.0
2019-12-09 14:00:34 +05:30
9ce4bd6f1b Fix logs on linux 2019-12-09 13:17:02 +05:30
190ae49ac1 Improve README 2019-12-09 12:45:26 +05:30
032bc86056 Fix actions.yml 2019-12-09 12:32:55 +05:30
704c5180a4 Update examples 2019-12-09 12:20:03 +05:30
e4fc767f9c Deprecate extension-csv and ini-values-csv inputs 2019-12-09 11:14:07 +05:30
1cf6a369bb Add support for PHP 8.0.0-dev #104 2019-12-09 10:31:11 +05:30
14acb26bdc Merge pull request #103 from shivammathur/develop
1.5.8
2019-12-06 09:30:32 +05:30
3ff7f9cedc Bump version to 1.5.8 2019-12-06 09:13:56 +05:30
98e937751c Merge branch 'develop' of https://github.com/shivammathur/setup-php into develop 2019-12-06 09:11:34 +05:30
31b338b199 Install PCOV from pecl for PHP7.4 on windows 2019-12-06 09:10:20 +05:30
9e32964a24 Merge pull request #102 from shivammathur/dependabot/npm_and_yarn/develop/typescript-3.7.3
Bump typescript from 3.7.2 to 3.7.3
2019-12-05 04:57:13 +05:30
4dcf2b117f Bump typescript from 3.7.2 to 3.7.3
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.7.2 to 3.7.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v3.7.2...v3.7.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-04 23:19:02 +00:00
6d8250310d Update PHP release support 2019-12-05 02:07:21 +05:30
3164116a42 Merge pull request #101 from shivammathur/develop
1.5.7
2019-12-03 01:17:20 +05:30
747d45cb52 Bump version to 1.5.7 2019-12-03 00:53:35 +05:30
4b7ad1ca81 Merge pull request #100 from shivammathur/dependabot/npm_and_yarn/develop/typescript-eslint/parser-2.10.0
Bump @typescript-eslint/parser from 2.9.0 to 2.10.0
2019-12-03 00:43:15 +05:30
31ef16e586 Merge pull request #99 from shivammathur/dependabot/npm_and_yarn/develop/typescript-eslint/eslint-plugin-2.10.0
Bump @typescript-eslint/eslint-plugin from 2.9.0 to 2.10.0
2019-12-03 00:43:02 +05:30
dd1def7620 Merge pull request #97 from shivammathur/dependabot/npm_and_yarn/develop/eslint-6.7.2
Bump eslint from 6.7.1 to 6.7.2
2019-12-03 00:34:52 +05:30
693a73d8da Merge pull request #98 from shivammathur/dependabot/npm_and_yarn/develop/eslint-plugin-jest-23.1.1
Bump eslint-plugin-jest from 23.1.0 to 23.1.1
2019-12-03 00:34:43 +05:30
965eb91efd Bump @typescript-eslint/parser from 2.9.0 to 2.10.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 2.9.0 to 2.10.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.10.0/packages/parser)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-02 18:56:07 +00:00
db9f610623 Bump @typescript-eslint/eslint-plugin from 2.9.0 to 2.10.0
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.9.0 to 2.10.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.10.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-02 18:55:28 +00:00
24fb306a50 Bump eslint-plugin-jest from 23.1.0 to 23.1.1
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.1.0 to 23.1.1.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.1.0...v23.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-02 18:54:52 +00:00
919fe77b43 Bump eslint from 6.7.1 to 6.7.2
Bumps [eslint](https://github.com/eslint/eslint) from 6.7.1 to 6.7.2.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v6.7.1...v6.7.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-02 18:54:44 +00:00
914c51cfb6 Fix ext-redis 2019-12-03 00:12:29 +05:30
8d8c2bd524 Use shivammathur/homebrew-php for macOS 2019-12-02 17:24:50 +05:30
7ef437ee9d Update pre-commit hook 2019-12-02 07:00:41 +05:30
0871fbb11b Update action.yml 2019-11-30 23:30:48 +05:30
3039a720ed Merge pull request #95 from shivammathur/develop
1.5.6
2019-11-30 07:11:14 +05:30
7f32ab318e Show semantic versions on PHP install and correct logs 2019-11-30 06:57:39 +05:30
ddcacf4760 Improve readme and workflow 2019-11-30 05:30:17 +05:30
2f951ef5cd Use Homebrew for PHP 7.4 on macOS 2019-11-30 04:59:05 +05:30
5a081357b4 Merge pull request #94 from shivammathur/develop
Fix phpdbg and improve windows script.
2019-11-29 12:10:41 +05:30
c4a64dff61 Install phpdbg with PHP7.4 2019-11-29 11:41:25 +05:30
aad33a8e35 Update Update-PhpCAInfo command in win32.ps1 2019-11-29 10:52:07 +05:30
eae890b1b2 Fix phpdbg version 2019-11-29 10:14:53 +05:30
8fbd2ea6bb Merge pull request #92 from shivammathur/develop
Switch to v1 tag and stable PHP 7.4.0
2019-11-28 16:47:42 +05:30
46161660dc Bump to 7.4.0 stable on linux 2019-11-28 15:58:33 +05:30
de68427afb Bump to 7.4.0 stable on windows and macOS 2019-11-28 15:54:15 +05:30
4ba36c5432 Shift to rotating stable tags 2019-11-28 05:17:56 +05:30
37 changed files with 453 additions and 344 deletions

View File

@ -0,0 +1,92 @@
name: Experimental workflow
on:
pull_request:
branches:
- nightly
- master
- develop
- verbose
paths-ignore:
- '**.md'
- 'examples/**'
push:
branches:
- nightly
- master
- develop
- verbose
paths-ignore:
- '**.md'
- 'examples/**'
jobs:
run:
name: Run
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, ubuntu-16.04, macOS-latest]
php-versions: ['8.0']
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Setup Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm install
- name: Prettier Format Check
run: npm run format-check
- name: ESLint Check
run: npm run lint
- name: Run tests
run: npm test
- name: Send Coverage
continue-on-error: true
timeout-minutes: 1
run: curl -s https://codecov.io/bash | bash -s -- -t ${{secrets.CODECOV_TOKEN}} -f coverage/clover.xml -n github-actions-codecov-${{ matrix.operating-system }}-php${{ matrix.php-versions }}
- name: Setup PHP with extensions and custom config
run: node dist/index.js
env:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xdebug, pcov #optional
ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata #optional
coverage: xdebug
- name: Testing PHP version
run: |
php -v
php -r "if(strpos(phpversion(), '${{ matrix.php-versions }}') === false) {throw new Exception('Wrong PHP version Installed');}"
- name: Testing Composer version
run: |
composer -V
php -r "if(strpos(@exec('composer -V'), 'Composer version') === false) {throw new Exception('Composer not found');}"
- name: Testing Extensions
run: |
php -m
php -r "if(! extension_loaded('mbstring')) {throw new Exception('mbstring not found');}"
# php -r "if(! extension_loaded('Xdebug')) {throw new Exception('Xdebug not found');}"
php -r "if(! extension_loaded('pcov')) {throw new Exception('PCOV not found');}"
- name: Testing ini values
run: |
php -r "if(ini_get('post_max_size')!='256M') {throw new Exception('post_max_size not added');}"
php -r "if(ini_get('short_open_tag')!=1) {throw new Exception('short_open_tag not added');}"
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"
- name: Test and Benchmark JIT
run: |
php -r "if(! extension_loaded('Zend OPcache')) {throw new Exception('Zend OPcache not found');}"
php -r "if(ini_get('opcache.jit_buffer_size')!='256M') {throw new Exception('opcache.jit_buffer_size not set');}"
php -r "if(ini_get('opcache.jit')!=1235) {throw new Exception('opcache.jit not set');}"
php -r "if(ini_get('pcre.jit')!=1) {throw new Exception('pcre.jit not set');}"
curl https://raw.githubusercontent.com/php/php-src/master/Zend/bench.php | php

View File

@ -24,15 +24,15 @@ jobs:
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'] php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@master uses: actions/checkout@v1
with: with:
fetch-depth: 1 fetch-depth: 1
- name: Setup Node.js 12.x - name: Setup Node.js 12.x
uses: actions/setup-node@master uses: actions/setup-node@v1
with: with:
node-version: 12.x node-version: 12.x
@ -57,17 +57,26 @@ jobs:
run: node dist/index.js run: node dist/index.js
env: env:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, xdebug, pcov #optional extensions: mbstring, xdebug, pcov #optional
ini-values-csv: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata #optional ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata #optional
- name: Testing PHP version - name: Testing PHP version
run: php -v run: |
php -v
php -r "if(strpos(phpversion(), '${{ matrix.php-versions }}') === false) {throw new Exception('Wrong PHP version Installed');}"
- name: Testing Composer version - name: Testing Composer version
run: composer -V run: |
composer -V
php -r "if(strpos(@exec('composer -V'), 'Composer version') === false) {throw new Exception('Composer not found');}"
- name: Testing Extensions - name: Testing Extensions
run: php -m run: |
php -m
php -r "if(! extension_loaded('mbstring')) {throw new Exception('mbstring not found');}"
php -r "if(! extension_loaded('Xdebug')) {throw new Exception('Xdebug not found');}"
php -r "if(phpversion()>=7.1 && ! extension_loaded('pcov')) {throw new Exception('PCOV not found');}"
- name: Testing ini values - name: Testing ini values
run: | run: |
printf "post_max_size: %s\n" $(php -r "echo ini_get('post_max_size');") php -r "if(ini_get('post_max_size')!='256M') {throw new Exception('post_max_size not added');}"
printf "short_open_tag: %s\n" $(php -r "echo ini_get('short_open_tag');") php -r "if(ini_get('short_open_tag')!=1) {throw new Exception('short_open_tag not added');}"
printf "date.timezone: %s\n" $(php -r "echo ini_get('date.timezone');") php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"

View File

@ -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 and composer in [GitHub Actions](https://github.com/features/actions "GitHub Actions"). This action can be added as a step in your action workflow and it will 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 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
@ -41,10 +41,13 @@ Setup PHP with required extensions, php.ini configuration and composer in [GitHu
|--- |--- |--- | |--- |--- |--- |
|5.6|`Stable`|`End of life`| |5.6|`Stable`|`End of life`|
|7.0|`Stable`|`End of life`| |7.0|`Stable`|`End of life`|
|7.1|`Stable`|`Security fixes only`| |7.1|`Stable`|`End of life`|
|7.2|`Stable`|`Active`| |7.2|`Stable`|`Security fixes only`|
|7.3|`Stable`|`Active`| |7.3|`Stable`|`Active`|
|7.4|`RC6`|`Active`| |7.4|`Stable`|`Active`|
|8.0|`Experimental`|`In development`|
**Note:** Specifying `8.0` in `php-version` input installs `PHP 8.0.0-dev`. This is an experimental feature on this action available on `ubuntu` and `macOS`. Currently some extensions might not be available for this version.
## :cloud: OS/Platform Support ## :cloud: OS/Platform Support
@ -70,9 +73,9 @@ Specify `coverage: xdebug` to use `Xdebug`.
Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action") Runs on all [PHP versions supported](#tada-php-support "List of PHP versions supported on this GitHub Action")
```yaml ```yaml
uses: shivammathur/setup-php@master uses: shivammathur/setup-php@v1
with: with:
php-version: '7.3' php-version: '7.4'
coverage: xdebug coverage: xdebug
``` ```
@ -81,14 +84,14 @@ with:
Specify `coverage: pcov` to use `PCOV`. Specify `coverage: pcov` to use `PCOV`.
It is much faster than `Xdebug`. It is much faster than `Xdebug`.
`PCOV` needs `PHP >= 7.1`. `PCOV` needs `PHP >= 7.1`.
If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values-csv` input. If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values` input.
```yaml ```yaml
uses: shivammathur/setup-php@master uses: shivammathur/setup-php@v1
with: with:
php-version: '7.3' php-version: '7.4'
ini-values-csv: pcov.directory=api #optional, see above for usage. ini-values: pcov.directory=api #optional, see above for usage.
coverage: pcov coverage: pcov
``` ```
@ -102,9 +105,9 @@ Consider disabling the coverage using this PHP action for these reasons.
- You are using `phpdbg` for running your tests. - You are using `phpdbg` for running your tests.
```yaml ```yaml
uses: shivammathur/setup-php@master uses: shivammathur/setup-php@v1
with: with:
php-version: '7.3' php-version: '7.4'
coverage: none coverage: none
``` ```
@ -113,8 +116,8 @@ with:
Inputs supported by this GitHub Action. Inputs supported by this GitHub Action.
- php-version `required` - php-version `required`
- extension-csv `optional` - extension `optional`
- ini-values-csv `optional` - ini-values `optional`
- coverage `optional` - coverage `optional`
- pecl `optional` - pecl `optional`
@ -122,32 +125,27 @@ See [action.yml](action.yml "Metadata for this GitHub Action") and usage below f
### Basic Usage ### Basic Usage
> Setup a particular PHP version
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@master uses: actions/checkout@v1
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@master uses: shivammathur/setup-php@v1
with: with:
php-version: '7.3' php-version: '7.4'
extension-csv: mbstring, intl #optional, setup extensions extensions: mbstring, intl #optional, setup extensions
ini-values-csv: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
coverage: xdebug #optional, setup coverage driver coverage: xdebug #optional, setup coverage driver
pecl: false #optional, setup PECL pecl: false #optional, setup PECL
- name: Check PHP Version
run: php -v
- name: Check Composer Version
run: composer -V
- name: Check PHP Extensions
run: php -m
``` ```
### Matrix Testing ### Matrix Testing
> Setup multiple PHP versions
```yaml ```yaml
jobs: jobs:
run: run:
@ -155,29 +153,20 @@ jobs:
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'] 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:
- name: Checkout - name: Checkout
uses: actions/checkout@master uses: actions/checkout@v1
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@master uses: shivammathur/setup-php@v1
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, intl #optional, setup extensions extensions: mbstring, intl #optional, setup extensions
ini-values-csv: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
coverage: xdebug #optional, setup coverage driver coverage: xdebug #optional, setup coverage driver
pecl: false #optional, setup PECL pecl: false #optional, setup PECL
- name: Check PHP Version
run: php -v
- name: Check Composer Version
run: composer -V
- name: Check PHP Extensions
run: php -m
``` ```
### Cache dependencies ### Cache dependencies
@ -246,11 +235,10 @@ If this action helped you.
## :bookmark: This action uses the following works ## :bookmark: This action uses the following works
- [powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager "Package to handle PHP on windows")
- [Homebrew](https://brew.sh/ "MacOS package manager")
- [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "Pre-compiled ubuntu packages") - [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "Pre-compiled ubuntu packages")
- [exolnet/homebrew-deprecated](https://github.com/eXolnet/homebrew-deprecated "Pre-compiled deprecated PHP for macOS") - [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Pre-compiled nightly PHP builds")
- [phpbrew](https://github.com/phpbrew/phpbrew "PHP packages manager") - [mlocati/powershell-phpmanager](https://github.com/mlocati/powershell-phpmanager "Package to handle PHP on windows")
- [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds for MacOS")
## :bookmark_tabs: Further Reading ## :bookmark_tabs: Further Reading

View File

@ -34,15 +34,25 @@ describe('Config tests', () => {
}); });
it('checking addCoverage with Xdebug on windows', async () => { it('checking addCoverage with Xdebug on windows', async () => {
const win32: string = await coverage.addCoverage('xdebug', '7.3', 'win32'); const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32');
expect(win32).toContain('addExtension xdebug'); expect(win32).toContain('addExtension xdebug');
}); });
it('checking addCoverage with Xdebug on windows', async () => {
const win32: string = await coverage.addCoverage('xdebug', '8.0', 'win32');
expect(win32).toContain('Xdebug currently only supports PHP 7.4 or lower');
});
it('checking addCoverage with Xdebug on linux', async () => { it('checking addCoverage with Xdebug on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug', '7.4', 'linux'); const linux: string = await coverage.addCoverage('xdebug', '7.4', 'linux');
expect(linux).toContain('addExtension xdebug'); expect(linux).toContain('addExtension xdebug');
}); });
it('checking addCoverage with Xdebug on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
expect(linux).toContain('Xdebug currently only supports PHP 7.4 or lower');
});
it('checking addCoverage with Xdebug on darwin', async () => { it('checking addCoverage with Xdebug on darwin', async () => {
const darwin: string = await coverage.addCoverage( const darwin: string = await coverage.addCoverage(
'xdebug', 'xdebug',
@ -52,6 +62,15 @@ describe('Config tests', () => {
expect(darwin).toContain('addExtension xdebug'); expect(darwin).toContain('addExtension xdebug');
}); });
it('checking addCoverage with Xdebug on darwin', async () => {
const darwin: string = await coverage.addCoverage(
'xdebug',
'8.0',
'darwin'
);
expect(darwin).toContain('Xdebug currently only supports PHP 7.4 or lower');
});
it('checking disableCoverage windows', async () => { it('checking disableCoverage windows', async () => {
const win32 = await coverage.addCoverage('none', '7.4', 'win32'); const win32 = await coverage.addCoverage('none', '7.4', 'win32');
expect(win32).toContain('Disable-PhpExtension xdebug'); expect(win32).toContain('Disable-PhpExtension xdebug');

View File

@ -3,14 +3,13 @@ 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', 'xdebug, pcov, redis',
'7.2', '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');
win32 = await extensions.addExtension('xdebug, pcov', '7.4', 'win32'); expect(win32).toContain('Add-Extension redis beta');
expect(win32).toContain('Add-Extension xdebug');
win32 = await extensions.addExtension( win32 = await extensions.addExtension(
'does_not_exist', 'does_not_exist',
@ -26,18 +25,21 @@ 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, redis',
'7.2', '7.4',
'linux' 'linux'
); );
expect(linux).toContain( expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.2-xdebug' 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-xdebug'
); );
expect(linux).toContain('pecl install xdebug'); expect(linux).toContain('pecl install xdebug');
expect(linux).toContain( expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.2-pcov' 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
); );
expect(linux).toContain('pecl install pcov'); expect(linux).toContain('pecl install pcov');
expect(linux).toContain(
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis'
);
linux = await extensions.addExtension('phalcon3, phalcon4', '7.2', 'linux'); linux = await extensions.addExtension('phalcon3, phalcon4', '7.2', 'linux');
expect(linux).toContain('phalcon.sh master 7.2'); expect(linux).toContain('phalcon.sh master 7.2');
@ -47,6 +49,9 @@ describe('Extension tests', () => {
expect(linux).toContain('phalcon.sh master 7.3'); expect(linux).toContain('phalcon.sh master 7.3');
expect(linux).toContain('phalcon.sh 4.0.x 7.3'); expect(linux).toContain('phalcon.sh 4.0.x 7.3');
linux = await extensions.addExtension('phalcon4', '7.4', 'linux');
expect(linux).toContain('phalcon.sh 4.0.x 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');
}); });
@ -72,6 +77,12 @@ describe('Extension tests', () => {
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 xdebug');
darwin = await extensions.addExtension('redis', '5.6', 'darwin');
expect(darwin).toContain('sudo pecl install redis-2.2.8');
darwin = await extensions.addExtension('redis', '7.2', 'darwin');
expect(darwin).toContain('sudo pecl install redis');
darwin = await extensions.addExtension( darwin = await extensions.addExtension(
'does_not_exist', 'does_not_exist',
'7.2', '7.2',

View File

@ -10,8 +10,8 @@ jest.mock('../src/install', () => ({
version: string, version: string,
os_version: string os_version: string
): Promise<string> => { ): Promise<string> => {
const extension_csv: string = process.env['extension-csv'] || ''; const extension_csv: string = process.env['extensions'] || '';
const ini_values_csv: string = process.env['ini-values-csv'] || ''; const ini_values_csv: string = process.env['ini-values'] || '';
const coverage_driver: string = process.env['coverage'] || ''; const coverage_driver: string = process.env['coverage'] || '';
let script = 'initial script ' + filename + version + os_version; let script = 'initial script ' + filename + version + os_version;
@ -77,8 +77,8 @@ function setEnv(
): void { ): void {
process.env['php-version'] = version; process.env['php-version'] = version;
process.env['RUNNER_OS'] = os; process.env['RUNNER_OS'] = os;
process.env['extension-csv'] = extension_csv; process.env['extensions'] = extension_csv;
process.env['ini-values-csv'] = ini_values_csv; process.env['ini-values'] = ini_values_csv;
process.env['coverage'] = coverage_driver; process.env['coverage'] = coverage_driver;
process.env['pecl'] = pecl; process.env['pecl'] = pecl;
} }

View File

@ -26,23 +26,6 @@ describe('Utils tests', () => {
expect(await utils.getInput('DoesNotExist', false)).toBe(''); expect(await utils.getInput('DoesNotExist', false)).toBe('');
}); });
it('checking getVersion', async () => {
process.env['php-version'] = '7.3';
expect(await utils.getVersion()).toBe('7.3');
process.env['php-version'] = '7.4';
expect(await utils.getVersion()).toBe('7.4');
process.env['php-version'] = '8.0';
expect(await utils.getVersion()).toBe('7.4');
process.env['php-version'] = '8.0-dev';
expect(await utils.getVersion()).toBe('7.4');
process.env['php-version'] = '7.4nightly';
expect(await utils.getVersion()).toBe('7.4');
process.env['php-version'] = '7.4snapshot';
expect(await utils.getVersion()).toBe('7.4');
process.env['php-version'] = 'nightly';
expect(await utils.getVersion()).toBe('7.4');
});
it('checking asyncForEach', async () => { it('checking asyncForEach', async () => {
const array: Array<string> = ['a', 'b', 'c']; const array: Array<string> = ['a', 'b', 'c'];
let concat = ''; let concat = '';
@ -60,10 +43,6 @@ describe('Utils tests', () => {
}); });
it('checking readScripts', async () => { it('checking readScripts', async () => {
const rc: string = fs.readFileSync(
path.join(__dirname, '../src/scripts/7.4.sh'),
'utf8'
);
const darwin: string = fs.readFileSync( const darwin: string = fs.readFileSync(
path.join(__dirname, '../src/scripts/darwin.sh'), path.join(__dirname, '../src/scripts/darwin.sh'),
'utf8' 'utf8'
@ -76,15 +55,12 @@ describe('Utils tests', () => {
path.join(__dirname, '../src/scripts/win32.ps1'), path.join(__dirname, '../src/scripts/win32.ps1'),
'utf8' 'utf8'
); );
expect(await utils.readScript('darwin.sh', '7.4', 'darwin')).toBe(rc); expect(await utils.readScript('darwin.sh', '7.4', 'darwin')).toBe(darwin);
expect(await utils.readScript('darwin.sh', '7.3', 'darwin')).toBe(darwin); expect(await utils.readScript('darwin.sh', '7.3', 'darwin')).toBe(darwin);
expect(await utils.readScript('linux.sh', '7.4', 'linux')).toBe(linux); expect(await utils.readScript('linux.sh', '7.4', 'linux')).toBe(linux);
expect(await utils.readScript('linux.sh', '7.3', 'linux')).toBe(linux); expect(await utils.readScript('linux.sh', '7.3', 'linux')).toBe(linux);
expect(await utils.readScript('win32.ps1', '7.4', 'win32')).toBe(win32); expect(await utils.readScript('win32.ps1', '7.4', 'win32')).toBe(win32);
expect(await utils.readScript('win32.ps1', '7.3', 'win32')).toBe(win32); expect(await utils.readScript('win32.ps1', '7.3', 'win32')).toBe(win32);
expect(await utils.readScript('fedora.sh', '7.3', 'fedora')).toContain(
'Platform fedora is not supported'
);
}); });
it('checking writeScripts', async () => { it('checking writeScripts', async () => {

View File

@ -5,19 +5,29 @@ branding:
color: 'purple' color: 'purple'
inputs: inputs:
php-version: php-version:
description: 'PHP version you want to install.' description: 'Setup PHP version.'
default: '7.4'
required: true required: true
extension-csv: extensions:
description: '(Optional) PHP extensions you want to install.' description: 'Setup PHP extensions.'
required: false required: false
ini-values-csv: ini-values:
description: '(Optional) Custom values you want to set in php.ini.' description: 'Add values to php.ini.'
required: false required: false
coverage: coverage:
description: '(Optional) Code coverage driver you want to install. (Accepts: xdebug, pcov and none)' description: 'Setup code coverage driver.'
required: false required: false
pecl: pecl:
description: '(Optional) Setup PECL on ubuntu' description: 'Setup PECL on ubuntu'
required: false
# Deprecated options, do not use. Will not be supported after February 1, 2019.
extension-csv:
description: 'Deprecated! Use extensions instead.'
deprecationMessage: 'The extension-csv property will not be supported after February 1, 2020. Use extensions instead.'
required: false
ini-values-csv:
description: 'Deprecated! Use ini-values instead.'
deprecationMessage: 'The ini-values-csv property will not be supported after February 1, 2020. Use ini-values instead.'
required: false required: false
runs: runs:
using: 'node12' using: 'node12'

63
dist/index.js vendored
View File

@ -682,26 +682,6 @@ function getInput(name, mandatory) {
}); });
} }
exports.getInput = getInput; exports.getInput = getInput;
/**
* Function to read the PHP version.
*/
function getVersion() {
return __awaiter(this, void 0, void 0, function* () {
const version = yield getInput('php-version', true);
switch (version) {
case '8.0':
case '8.0-dev':
case '7.4':
case '7.4snapshot':
case '7.4nightly':
case 'nightly':
return '7.4';
default:
return version;
}
});
}
exports.getVersion = getVersion;
/** /**
* Async foreach loop * Async foreach loop
* *
@ -810,19 +790,7 @@ exports.addLog = addLog;
*/ */
function readScript(filename, version, os_version) { function readScript(filename, version, os_version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
switch (os_version) {
case 'darwin':
switch (version) {
case '7.4':
return fs.readFileSync(path.join(__dirname, '../src/scripts/7.4.sh'), 'utf8');
}
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8'); return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
case 'linux':
case 'win32':
return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8');
default:
return yield log('Platform ' + os_version + ' is not supported', os_version, 'error');
}
}); });
} }
exports.readScript = readScript; exports.readScript = readScript;
@ -1248,10 +1216,17 @@ const config = __importStar(__webpack_require__(641));
*/ */
function addCoverageXdebug(version, os_version) { function addCoverageXdebug(version, os_version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
switch (version) {
case '8.0':
return ('\n' +
(yield utils.addLog('$cross', 'xdebug', 'Xdebug currently only supports PHP 7.4 or lower', os_version)));
case '7.4':
default:
return ((yield extensions.addExtension('xdebug', version, os_version, true)) + return ((yield extensions.addExtension('xdebug', version, os_version, true)) +
(yield utils.suppressOutput(os_version)) + (yield utils.suppressOutput(os_version)) +
'\n' + '\n' +
(yield utils.addLog('$tick', 'xdebug', 'Xdebug enabled as coverage driver', os_version))); (yield utils.addLog('$tick', 'xdebug', 'Xdebug enabled as coverage driver', os_version)));
}
}); });
} }
exports.addCoverageXdebug = addCoverageXdebug; exports.addCoverageXdebug = addCoverageXdebug;
@ -1513,8 +1488,10 @@ const utils = __importStar(__webpack_require__(163));
function build(filename, version, os_version) { 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('extension-csv', false); const extension_csv = (yield utils.getInput('extensions', false)) ||
const ini_values_csv = yield utils.getInput('ini-values-csv', false); (yield utils.getInput('extension-csv', false));
const ini_values_csv = (yield utils.getInput('ini-values', false)) ||
(yield utils.getInput('ini-values-csv', false));
const coverage_driver = yield utils.getInput('coverage', false); const coverage_driver = yield utils.getInput('coverage', false);
let script = yield utils.readScript(filename, version, os_version); let script = yield utils.readScript(filename, version, os_version);
if (extension_csv) { if (extension_csv) {
@ -1537,7 +1514,7 @@ function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
const os_version = process.platform; const os_version = process.platform;
const version = yield utils.getVersion(); const version = yield utils.getInput('php-version', true);
// check the os version and run the respective script // check the os version and run the respective script
let script_path = ''; let script_path = '';
switch (os_version) { switch (os_version) {
@ -1553,7 +1530,7 @@ function run() {
} }
case 'win32': case 'win32':
script_path = yield build('win32.ps1', version, os_version); script_path = yield build('win32.ps1', version, os_version);
yield exec_1.exec('pwsh ' + script_path + ' -version ' + version + ' -dir ' + __dirname); yield exec_1.exec('pwsh ' + script_path + ' -version ' + version);
break; break;
} }
} }
@ -1619,6 +1596,9 @@ function addExtensionDarwin(extension_csv, version) {
case '5.6xdebug': case '5.6xdebug':
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1'; install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
break; break;
case '5.6redis':
install_command = 'sudo pecl install redis-2.2.8 >/dev/null 2>&1';
break;
default: default:
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1'; install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
break; break;
@ -1649,7 +1629,14 @@ function addExtensionWindows(extension_csv, version) {
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 // add script to enable extension is already installed along with php
switch (version + extension) {
case '7.4redis':
script += '\nAdd-Extension ' + extension + ' beta';
break;
default:
script += '\nAdd-Extension ' + extension; script += '\nAdd-Extension ' + extension;
break;
}
}); });
}); });
return script; return script;
@ -1672,6 +1659,10 @@ function addExtensionLinux(extension_csv, version) {
// add script to enable extension is already installed along with php // add script to enable extension is already installed along with php
let install_command = ''; let install_command = '';
switch (version + extension) { switch (version + extension) {
case '7.4redis':
install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis >/dev/null 2>&1';
break;
case '7.2phalcon3': case '7.2phalcon3':
case '7.3phalcon3': case '7.3phalcon3':
install_command = install_command =

View File

@ -13,7 +13,7 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
- name: Get composer cache directory - name: Get composer cache directory

View File

@ -6,16 +6,16 @@ jobs:
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'] php-versions: ['7.2', '7.3', '7.4']
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@master uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, intl, curl, dom extensions: mbstring, intl, curl, dom
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -36,10 +36,10 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo, mysql extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -38,10 +38,10 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo, pgsql extensions: mbstring, dom, fileinfo, pgsql
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -9,15 +9,15 @@ jobs:
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'] php-versions: ['7.2', '7.3', '7.4']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo extensions: mbstring, dom, fileinfo
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -31,15 +31,15 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.2', '7.3'] php-versions: ['7.2', '7.3', '7.4']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo, mysql extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -33,15 +33,15 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.2', '7.3'] php-versions: ['7.2', '7.3', '7.4']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo, pgsql extensions: mbstring, dom, fileinfo, pgsql
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -9,15 +9,15 @@ jobs:
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'] php-versions: ['7.2', '7.3', '7.4']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, fileinfo, mysql extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -34,10 +34,10 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, zip, phalcon4, mysql #use phalcon3 for the phalcon 3.x. extensions: mbstring, dom, zip, phalcon4, mysql #use phalcon3 for the phalcon 3.x.
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -35,10 +35,10 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, dom, zip, phalcon4, pgsql #use phalcon3 for the phalcon 3.x extensions: mbstring, dom, zip, phalcon4, pgsql #use phalcon3 for the phalcon 3.x
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -14,14 +14,14 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@master uses: actions/setup-node@v1
with: with:
node-version: ${{ matrix.node-versions }} node-version: ${{ matrix.node-versions }}
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring extensions: mbstring
- name: Check node versions - name: Check node versions
run: node -v run: node -v
- name: Get yarn cache - name: Get yarn cache

View File

@ -6,16 +6,16 @@ jobs:
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'] php-versions: ['7.2', '7.3', '7.4']
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@master uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, simplexml, dom extensions: mbstring, simplexml, dom
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -18,15 +18,15 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.3'] php-versions: ['7.3', '7.4']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, xml, ctype, iconv, mysql extensions: mbstring, xml, ctype, iconv, mysql
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -18,15 +18,15 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.3'] php-versions: ['7.3', '7.4']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, xml, ctype, iconv, pgsql extensions: mbstring, xml, ctype, iconv, pgsql
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -9,15 +9,15 @@ jobs:
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'] php-versions: ['7.3', '7.4']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, xml, ctype, iconv extensions: mbstring, xml, ctype, iconv
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -29,14 +29,14 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Set Node.js 10.x - name: Set Node.js 10.x
uses: actions/setup-node@master uses: actions/setup-node@v1
with: with:
node-version: 10.x node-version: 10.x
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, intl, gd, imagick, zip, dom, mysql extensions: mbstring, intl, gd, imagick, zip, dom, mysql
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -29,14 +29,14 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: Set Node.js 10.x - name: Set Node.js 10.x
uses: actions/setup-node@master uses: actions/setup-node@v1
with: with:
node-version: 10.x node-version: 10.x
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, intl, gd, imagick, zip, dom, pgsql extensions: mbstring, intl, gd, imagick, zip, dom, pgsql
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

View File

@ -6,16 +6,16 @@ jobs:
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'] php-versions: ['7.2', '7.3', '7.4']
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@master uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions - name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php uses: shivammathur/setup-php@v1 #https://github.com/shivammathur/setup-php
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, bcmath, curl, intl extensions: mbstring, bcmath, curl, intl
coverage: xdebug #optional coverage: xdebug #optional
- name: Get composer cache directory - name: Get composer cache directory
id: composer-cache id: composer-cache

98
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "1.5.5", "version": "1.6.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -543,12 +543,12 @@
"dev": true "dev": true
}, },
"@typescript-eslint/eslint-plugin": { "@typescript-eslint/eslint-plugin": {
"version": "2.9.0", "version": "2.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.9.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.10.0.tgz",
"integrity": "sha512-98rfOt3NYn5Gr9wekTB8TexxN6oM8ZRvYuphPs1Atfsy419SDLYCaE30aJkRiiTCwGEY98vOhFsEVm7Zs4toQQ==", "integrity": "sha512-rT51fNLW0u3fnDGnAHVC5nu+Das+y2CpW10yqvf6/j5xbuUV3FxA3mBaIbM24CXODXjbgUznNb4Kg9XZOUxKAw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/experimental-utils": "2.9.0", "@typescript-eslint/experimental-utils": "2.10.0",
"eslint-utils": "^1.4.3", "eslint-utils": "^1.4.3",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0", "regexpp": "^3.0.0",
@ -556,32 +556,32 @@
} }
}, },
"@typescript-eslint/experimental-utils": { "@typescript-eslint/experimental-utils": {
"version": "2.9.0", "version": "2.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.9.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.10.0.tgz",
"integrity": "sha512-0lOLFdpdJsCMqMSZT7l7W2ta0+GX8A3iefG3FovJjrX+QR8y6htFlFdU7aOVPL6pDvt6XcsOb8fxk5sq+girTw==", "integrity": "sha512-FZhWq6hWWZBP76aZ7bkrfzTMP31CCefVIImrwP3giPLcoXocmLTmr92NLZxuIcTL4GTEOE33jQMWy9PwelL+yQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/json-schema": "^7.0.3", "@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.9.0", "@typescript-eslint/typescript-estree": "2.10.0",
"eslint-scope": "^5.0.0" "eslint-scope": "^5.0.0"
} }
}, },
"@typescript-eslint/parser": { "@typescript-eslint/parser": {
"version": "2.9.0", "version": "2.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.9.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.10.0.tgz",
"integrity": "sha512-fJ+dNs3CCvEsJK2/Vg5c2ZjuQ860ySOAsodDPwBaVlrGvRN+iCNC8kUfLFL8cT49W4GSiLPa/bHiMjYXA7EhKQ==", "integrity": "sha512-wQNiBokcP5ZsTuB+i4BlmVWq6o+oAhd8en2eSm/EE9m7BgZUIfEeYFd6z3S+T7bgNuloeiHA1/cevvbBDLr98g==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/eslint-visitor-keys": "^1.0.0", "@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "2.9.0", "@typescript-eslint/experimental-utils": "2.10.0",
"@typescript-eslint/typescript-estree": "2.9.0", "@typescript-eslint/typescript-estree": "2.10.0",
"eslint-visitor-keys": "^1.1.0" "eslint-visitor-keys": "^1.1.0"
} }
}, },
"@typescript-eslint/typescript-estree": { "@typescript-eslint/typescript-estree": {
"version": "2.9.0", "version": "2.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.9.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.10.0.tgz",
"integrity": "sha512-v6btSPXEWCP594eZbM+JCXuFoXWXyF/z8kaSBSdCb83DF+Y7+xItW29SsKtSULgLemqJBT+LpT+0ZqdfH7QVmA==", "integrity": "sha512-oOYnplddQNm/LGVkqbkAwx4TIBuuZ36cAQq9v3nFIU9FmhemHuVzAesMSXNQDdAzCa5bFgCrfD3JWhYVKlRN2g==",
"dev": true, "dev": true,
"requires": { "requires": {
"debug": "^4.1.1", "debug": "^4.1.1",
@ -1558,9 +1558,9 @@
} }
}, },
"es-abstract": { "es-abstract": {
"version": "1.16.2", "version": "1.16.3",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.16.2.tgz", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.16.3.tgz",
"integrity": "sha512-jYo/J8XU2emLXl3OLwfwtuFfuF2w6DYPs+xy9ZfVyPkDcrauu6LYrw/q2TyCtrbc/KUdCiC5e9UajRhgNkVopA==", "integrity": "sha512-WtY7Fx5LiOnSYgF5eg/1T+GONaGmpvpPdCpSnYij+U2gDTL0UPfWrhDw7b2IYb+9NQJsYpCA0wOQvZfsd6YwRw==",
"dev": true, "dev": true,
"requires": { "requires": {
"es-to-primitive": "^1.2.1", "es-to-primitive": "^1.2.1",
@ -1614,9 +1614,9 @@
} }
}, },
"eslint": { "eslint": {
"version": "6.7.1", "version": "6.7.2",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-6.7.1.tgz", "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.7.2.tgz",
"integrity": "sha512-UWzBS79pNcsDSxgxbdjkmzn/B6BhsXMfUaOHnNwyE8nD+Q6pyT96ow2MccVayUTV4yMid4qLhMiQaywctRkBLA==", "integrity": "sha512-qMlSWJaCSxDFr8fBPvJM9kJwbazrhNcBU3+DszDW1OlEwKBBRWsJc7NJFelvwQpanHCR14cOLD41x8Eqvo3Nng==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/code-frame": "^7.0.0", "@babel/code-frame": "^7.0.0",
@ -1776,9 +1776,9 @@
} }
}, },
"eslint-plugin-jest": { "eslint-plugin-jest": {
"version": "23.0.5", "version": "23.1.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.0.5.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.1.1.tgz",
"integrity": "sha512-etxXrWsFWzxsrxKwJnFC38uppH/vlJ3oF7Wmp/cxedqxRIxVhXup8e5y5MmtVXelevgxrgA1QS1vo8j889iK5Q==", "integrity": "sha512-2oPxHKNh4j1zmJ6GaCBuGcb8FVZU7YjFUOJzGOPnl9ic7VA/MGAskArLJiRIlnFUmi1EUxY+UiATAy8dv8s5JA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/experimental-utils": "^2.5.0" "@typescript-eslint/experimental-utils": "^2.5.0"
@ -2249,12 +2249,14 @@
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -2269,17 +2271,20 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -2396,7 +2401,8 @@
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -2408,6 +2414,7 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -2422,6 +2429,7 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -2429,12 +2437,14 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -2453,6 +2463,7 @@
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -2533,7 +2544,8 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -2545,6 +2557,7 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -2666,6 +2679,7 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -4819,9 +4833,9 @@
} }
}, },
"psl": { "psl": {
"version": "1.4.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz", "resolved": "https://registry.npmjs.org/psl/-/psl-1.6.0.tgz",
"integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==", "integrity": "sha512-SYKKmVel98NCOYXpkwUqZqh0ahZeeKfmisiLIcEZdsb+WbLv02g/dI5BUmZnIyOe7RzZtLax81nnb2HbvC2tzA==",
"dev": true "dev": true
}, },
"pump": { "pump": {
@ -5954,15 +5968,15 @@
"dev": true "dev": true
}, },
"typescript": { "typescript": {
"version": "3.7.2", "version": "3.7.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.3.tgz",
"integrity": "sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==", "integrity": "sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==",
"dev": true "dev": true
}, },
"uglify-js": { "uglify-js": {
"version": "3.7.0", "version": "3.7.1",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.0.tgz", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.1.tgz",
"integrity": "sha512-PC/ee458NEMITe1OufAjal65i6lB58R1HWMRcxwvdz1UopW0DYqlRL3xdu3IcTvTXsB02CRHykidkTRL+A3hQA==", "integrity": "sha512-pnOF7jY82wdIhATVn87uUY/FHU+MDUdPLkmGFvGoclQmeu229eTkbG5gjGGBi3R7UuYYSEeYXY/TTY5j2aym2g==",
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {

View File

@ -1,13 +1,13 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "1.5.5", "version": "1.6.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",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"lint": "eslint **/*.ts --cache", "lint": "eslint **/*.ts --cache",
"format": "prettier --write **/*.ts", "format": "prettier --write **/*.ts && git add .",
"format-check": "prettier --check **/*.ts", "format-check": "prettier --check **/*.ts",
"release": "ncc build src/install.ts -o dist && git add -f dist/", "release": "ncc build src/install.ts -o dist && git add -f dist/",
"test": "jest" "test": "jest"
@ -44,7 +44,7 @@
"jest-circus": "^24.9.0", "jest-circus": "^24.9.0",
"prettier": "^1.17.1", "prettier": "^1.17.1",
"ts-jest": "^24.1.0", "ts-jest": "^24.1.0",
"typescript": "^3.6.4" "typescript": "^3.7.3"
}, },
"husky": { "husky": {
"skipCI": true, "skipCI": true,

View File

@ -12,6 +12,19 @@ export async function addCoverageXdebug(
version: string, version: string,
os_version: string os_version: string
): Promise<string> { ): Promise<string> {
switch (version) {
case '8.0':
return (
'\n' +
(await utils.addLog(
'$cross',
'xdebug',
'Xdebug currently only supports PHP 7.4 or lower',
os_version
))
);
case '7.4':
default:
return ( return (
(await extensions.addExtension('xdebug', version, os_version, true)) + (await extensions.addExtension('xdebug', version, os_version, true)) +
(await utils.suppressOutput(os_version)) + (await utils.suppressOutput(os_version)) +
@ -24,6 +37,7 @@ export async function addCoverageXdebug(
)) ))
); );
} }
}
/** /**
* Function to setup PCOV * Function to setup PCOV

View File

@ -21,6 +21,9 @@ export async function addExtensionDarwin(
case '5.6xdebug': case '5.6xdebug':
install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1'; install_command = 'sudo pecl install xdebug-2.5.5 >/dev/null 2>&1';
break; break;
case '5.6redis':
install_command = 'sudo pecl install redis-2.2.8 >/dev/null 2>&1';
break;
default: default:
install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1'; install_command = 'sudo pecl install ' + extension + ' >/dev/null 2>&1';
break; break;
@ -50,7 +53,14 @@ export async function addExtensionWindows(
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 // add script to enable extension is already installed along with php
switch (version + extension) {
case '7.4redis':
script += '\nAdd-Extension ' + extension + ' beta';
break;
default:
script += '\nAdd-Extension ' + extension; script += '\nAdd-Extension ' + extension;
break;
}
}); });
return script; return script;
} }
@ -73,6 +83,10 @@ export async function addExtensionLinux(
let install_command = ''; let install_command = '';
switch (version + extension) { switch (version + extension) {
case '7.4redis':
install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-igbinary php7.4-redis >/dev/null 2>&1';
break;
case '7.2phalcon3': case '7.2phalcon3':
case '7.3phalcon3': case '7.3phalcon3':
install_command = install_command =

View File

@ -18,8 +18,12 @@ export async function build(
os_version: string os_version: string
): Promise<string> { ): Promise<string> {
// taking inputs // taking inputs
const extension_csv: string = await utils.getInput('extension-csv', false); const extension_csv: string =
const ini_values_csv: string = await utils.getInput('ini-values-csv', false); (await utils.getInput('extensions', false)) ||
(await utils.getInput('extension-csv', false));
const ini_values_csv: string =
(await utils.getInput('ini-values', false)) ||
(await utils.getInput('ini-values-csv', false));
const coverage_driver: string = await utils.getInput('coverage', false); const coverage_driver: string = await utils.getInput('coverage', false);
let script: string = await utils.readScript(filename, version, os_version); let script: string = await utils.readScript(filename, version, os_version);
@ -42,7 +46,7 @@ export async function build(
export async function run(): Promise<void> { export async function run(): Promise<void> {
try { try {
const os_version: string = process.platform; const os_version: string = process.platform;
const version: string = await utils.getVersion(); const version: string = await utils.getInput('php-version', true);
// check the os version and run the respective script // check the os version and run the respective script
let script_path = ''; let script_path = '';
switch (os_version) { switch (os_version) {
@ -58,9 +62,7 @@ export async function run(): Promise<void> {
} }
case 'win32': case 'win32':
script_path = await build('win32.ps1', version, os_version); script_path = await build('win32.ps1', version, os_version);
await exec( await exec('pwsh ' + script_path + ' -version ' + version);
'pwsh ' + script_path + ' -version ' + version + ' -dir ' + __dirname
);
break; break;
} }
} catch (error) { } catch (error) {

View File

@ -16,7 +16,7 @@ add_log() {
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message" printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
fi fi
} }
version='7.4.0RC6' version='7.4.0'
step_log "Setup dependencies" step_log "Setup dependencies"
for package in pkg-config autoconf bison re2c openssl@1.1 krb5 enchant libffi freetype intltool icu4c libiconv t1lib gd libzip gmp tidyp libxml2 libxslt postgresql curl; for package in pkg-config autoconf bison re2c openssl@1.1 krb5 enchant libffi freetype intltool icu4c libiconv t1lib gd libzip gmp tidyp libxml2 libxslt postgresql curl;
do do
@ -78,13 +78,14 @@ source ~/.bash_profile >/dev/null 2>&1
source ~/.bashrc >/dev/null 2>&1 source ~/.bashrc >/dev/null 2>&1
step_log "Setup PHP and Composer" step_log "Setup PHP and Composer"
phpbrew install -j 6 $version +dev >/dev/null 2>&1 phpbrew install -j 6 github:php/php-src@PHP-$version as php-$version +dev >/dev/null 2>&1
phpbrew switch $version phpbrew switch $version
sudo ln -sf /opt/phpbrew/php/php-$version/bin/* /usr/local/bin/ sudo ln -sf /opt/phpbrew/php/php-$version/bin/* /usr/local/bin/
sudo ln -sf /opt/phpbrew/php/php-$version/etc/php.ini /etc/php.ini sudo ln -sf /opt/phpbrew/php/php-$version/etc/php.ini /etc/php.ini
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g") ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
ext_dir=$(php -i | grep "extension_dir => /opt" | sed -e "s|.*=> s*||") ext_dir=$(php -i | grep "extension_dir => /opt" | sed -e "s|.*=> s*||")
pecl config-set php_ini "$ini_file" >/dev/null 2>&1 pecl config-set php_ini "$ini_file" >/dev/null 2>&1
pear config-set php_ini "$ini_file" >/dev/null 2>&1
sudo chmod 777 "$ini_file" sudo chmod 777 "$ini_file"
brew install composer >/dev/null 2>&1 brew install composer >/dev/null 2>&1

View File

@ -17,13 +17,11 @@ add_log() {
fi fi
} }
step_log "Setup PHP and Composer"
version=$1 version=$1
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
if [ "$1" = "5.6" ] || [ "$1" = "7.0" ]; then brew tap shivammathur/homebrew-php >/dev/null 2>&1
brew tap exolnet/homebrew-deprecated >/dev/null 2>&1 brew install shivammathur/php/php@"$1" composer >/dev/null 2>&1
fi
step_log "Setup PHP and Composer"
brew install php@"$1" composer >/dev/null 2>&1
brew link --force --overwrite php@"$1" >/dev/null 2>&1 brew link --force --overwrite php@"$1" >/dev/null 2>&1
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"
@ -31,7 +29,8 @@ 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)"
composer global require hirak/prestissimo >/dev/null 2>&1 composer global require hirak/prestissimo >/dev/null 2>&1
add_log "$tick" "PHP" "Installed PHP$version" semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
add_log "$tick" "PHP" "Installed PHP $semver"
add_log "$tick" "Composer" "Installed" add_log "$tick" "Composer" "Installed"
add_extension() { add_extension() {
@ -48,10 +47,10 @@ add_extension() {
( (
eval "$install_command" && \ eval "$install_command" && \
add_log "$tick" "$extension" "Installed and enabled" add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension on PHP$version" ) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
else else
if ! php -m | grep -i -q "$extension"; then if ! php -m | grep -i -q "$extension"; then
add_log "$cross" "$extension" "Could not find $extension for PHP$version on PECL" add_log "$cross" "$extension" "Could not find $extension for PHP $semver on PECL"
fi fi
fi fi
fi fi

View File

@ -17,27 +17,49 @@ add_log() {
fi fi
} }
existing_version=$(php-config --version | cut -c 1-3) existing_version=$(php-config --version | cut -c 1-3)
version=$1 semver=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')
status="Switched to PHP$version"
step_log "Setup PHP and Composer" step_log "Setup PHP and Composer"
sudo mkdir -p /var/run sudo mkdir -p /var/run
sudo mkdir -p /run/php sudo mkdir -p /run/php
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 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
if [ "$existing_version" != "$1" ]; then if [ "$existing_version" != "$1" ]; then
if [ ! -e "/usr/bin/php$1" ]; then if [ ! -e "/usr/bin/php$1" ]; then
if [ "$1" != "7.4" ]; then if [ "$1" = "7.4" ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1" curl php"$1"-curl >/dev/null 2>&1 sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1" php"$1"-phpdbg php"$1"-xml curl php"$1"-curl >/dev/null 2>&1
elif [ "$1" = "8.0" ]; then
tar_file=php_"$1"%2Bubuntu"$(lsb_release -r -s)".tar.xz
install_dir=~/php/"$1"
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install libicu-dev >/dev/null 2>&1
curl -o "$tar_file" -L https://bintray.com/shivammathur/php/download_file?file_path="$tar_file" >/dev/null 2>&1
sudo mkdir -m 777 -p ~/php
sudo tar xf "$tar_file" -C ~/php >/dev/null 2>&1 && rm -rf "$tar_file"
sudo ln -sf -S "$1" "$install_dir"/bin/* /usr/bin/ && sudo ln -sf "$install_dir"/etc/php.ini /etc/php.ini
else else
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1" php"$1"-dev php"$1"-xml curl php"$1"-curl >/dev/null 2>&1 sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1" curl php"$1"-curl >/dev/null 2>&1
fi fi
status="Installed PHP$version" status="installed"
else
status="switched"
fi fi
for tool in php phar phar.phar php-cgi php-config phpize; do for tool in pear pecl php phar phar.phar php-cgi php-config phpize phpdbg; do
if [ -e "/usr/bin/$tool$1" ]; then if [ -e "/usr/bin/$tool$1" ]; then
sudo update-alternatives --set $tool /usr/bin/"$tool$1" >/dev/null 2>&1 sudo update-alternatives --set $tool /usr/bin/"$tool$1" >/dev/null 2>&1
fi fi
done done
semver=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')
if [ "$1" = "8.0" ]; then
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
fi
if [ "$status" != "switched" ]; then
status="Installed PHP $semver"
else
status="Switched to PHP $semver"
fi
else
status="PHP $semver Found"
fi fi
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g") ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
@ -45,9 +67,7 @@ ext_dir=$(php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
sudo chmod 777 "$ini_file" sudo chmod 777 "$ini_file"
add_log "$tick" "PHP" "$status" add_log "$tick" "PHP" "$status"
if [ "$2" = "true" ]; then if [ "$2" = "true" ]; then
if [ "$1" != "7.4" ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1"-dev php"$1"-xml >/dev/null 2>&1 sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$1"-dev php"$1"-xml >/dev/null 2>&1
fi
sudo update-alternatives --set php-config /usr/bin/php-config"$1" >/dev/null 2>&1 sudo update-alternatives --set php-config /usr/bin/php-config"$1" >/dev/null 2>&1
sudo update-alternatives --set phpize /usr/bin/phpize"$1" >/dev/null 2>&1 sudo update-alternatives --set phpize /usr/bin/phpize"$1" >/dev/null 2>&1
wget https://github.com/pear/pearweb_phars/raw/master/install-pear-nozlib.phar >/dev/null 2>&1 wget https://github.com/pear/pearweb_phars/raw/master/install-pear-nozlib.phar >/dev/null 2>&1
@ -82,6 +102,6 @@ add_extension()
( (
eval "$install_command" && \ eval "$install_command" && \
add_log "$tick" "$extension" "Installed and enabled" add_log "$tick" "$extension" "Installed and enabled"
) || add_log "$cross" "$extension" "Could not install $extension on php$version" ) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi fi
} }

View File

@ -1,6 +1,5 @@
param ( param (
[Parameter(Mandatory = $true)][string]$version = "7.3", [Parameter(Mandatory = $true)][string]$version = "7.3"
[Parameter(Mandatory = $true)][string]$dir
) )
$tick = ([char]8730) $tick = ([char]8730)
@ -16,6 +15,10 @@ Function Add-Log($mark, $subject, $message) {
printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $code $mark $subject $message printf "\033[%s;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $code $mark $subject $message
} }
if ($version -eq '8.0') {
$version = '7.4'
}
Step-Log "Setup PhpManager" Step-Log "Setup PhpManager"
Install-Module -Name PhpManager -Force -Scope CurrentUser Install-Module -Name PhpManager -Force -Scope CurrentUser
Add-Log $tick "PhpManager" "Installed" Add-Log $tick "PhpManager" "Installed"
@ -33,32 +36,18 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
if ($version -lt '7.0') { if ($version -lt '7.0') {
Install-Module -Name VcRedist -Force Install-Module -Name VcRedist -Force
} }
if ($version -eq '7.4') {
$version = '7.4RC'
}
Install-Php -Version $version -Architecture x86 -ThreadSafe $true -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1 Install-Php -Version $version -Architecture x86 -ThreadSafe $true -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1
$installed = Get-Php -Path $php_dir $installed = Get-Php -Path $php_dir
$status = "Installed PHP $($installed.FullVersion)" $status = "Installed PHP $($installed.FullVersion)"
} }
else { else {
$status = "Switched to PHP $($installed.FullVersion)" $status = "PHP $($installed.FullVersion) Found"
} }
Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir
Enable-PhpExtension -Extension openssl, curl -Path $php_dir Enable-PhpExtension -Extension openssl, curl -Path $php_dir
try {
Update-PhpCAInfo -Path $php_dir -Source CurrentUser Update-PhpCAInfo -Path $php_dir -Source CurrentUser
}
catch {
try {
Update-PhpCAInfo -Path $php_dir -Source Curl
} catch {
Update-PhpCAInfo -Path $php_dir -Source Curl -SkipChecksumCheck
}
}
if ([Version]$installed.Version -ge '7.4') {
Copy-Item "$dir\..\src\ext\php_pcov.dll" -Destination "$($installed.ExtensionsPath)\php_pcov.dll"
}
Add-Log $tick "PHP" $status Add-Log $tick "PHP" $status
Install-Composer -Scope System -Path $php_dir -PhpPath $php_dir Install-Composer -Scope System -Path $php_dir -PhpPath $php_dir
@ -99,6 +88,6 @@ Function Add-Extension {
} }
} }
catch { catch {
Add-Log $cross $extension "Could not enable" Add-Log $cross $extension "Could not install $extension on PHP $($installed.FullVersion)"
} }
} }

View File

@ -22,24 +22,6 @@ export async function getInput(
} }
} }
/**
* Function to read the PHP version.
*/
export async function getVersion(): Promise<string> {
const version: string = await getInput('php-version', true);
switch (version) {
case '8.0':
case '8.0-dev':
case '7.4':
case '7.4snapshot':
case '7.4nightly':
case 'nightly':
return '7.4';
default:
return version;
}
}
/** /**
* Async foreach loop * Async foreach loop
* *
@ -173,32 +155,10 @@ export async function readScript(
version: string, version: string,
os_version: string os_version: string
): Promise<string> { ): Promise<string> {
switch (os_version) {
case 'darwin':
switch (version) {
case '7.4':
return fs.readFileSync(
path.join(__dirname, '../src/scripts/7.4.sh'),
'utf8'
);
}
return fs.readFileSync( return fs.readFileSync(
path.join(__dirname, '../src/scripts/' + filename), path.join(__dirname, '../src/scripts/' + filename),
'utf8' 'utf8'
); );
case 'linux':
case 'win32':
return fs.readFileSync(
path.join(__dirname, '../src/scripts/' + filename),
'utf8'
);
default:
return await log(
'Platform ' + os_version + ' is not supported',
os_version,
'error'
);
}
} }
/** /**