mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
commit
790a48c30d
14
.github/workflows/experimental-workflow.yml
vendored
14
.github/workflows/experimental-workflow.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, ubuntu-16.04, macOS-latest]
|
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
php-versions: ['8.0']
|
php-versions: ['8.0']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -59,9 +59,9 @@ jobs:
|
|||||||
run: node dist/index.js
|
run: node dist/index.js
|
||||||
env:
|
env:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, xdebug, pcov #optional
|
extensions: xml, opcache, xdebug, pcov #optional
|
||||||
ini-values: 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
|
||||||
coverage: xdebug
|
coverage: pcov
|
||||||
|
|
||||||
- name: Testing PHP version
|
- name: Testing PHP version
|
||||||
run: |
|
run: |
|
||||||
@ -76,17 +76,19 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
php -m
|
php -m
|
||||||
php -r "if(! extension_loaded('mbstring')) {throw new Exception('mbstring not found');}"
|
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');}"
|
php -r "if(! extension_loaded('pcov')) {throw new Exception('PCOV not found');}"
|
||||||
- name: Testing ini values
|
- name: Testing ini values
|
||||||
run: |
|
run: |
|
||||||
php -r "if(ini_get('post_max_size')!='256M') {throw new Exception('post_max_size not added');}"
|
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('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');}"
|
php -r "if(ini_get('date.timezone')!='Asia/Kolkata') {throw new Exception('date.timezone not added');}"
|
||||||
- name: Test and Benchmark JIT
|
- name: Test JIT
|
||||||
run: |
|
run: |
|
||||||
php -r "if(! extension_loaded('Zend OPcache')) {throw new Exception('Zend OPcache not found');}"
|
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_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('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');}"
|
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
|
- name: Benchmark JIT
|
||||||
|
run: |
|
||||||
|
curl -o bench.php https://raw.githubusercontent.com/php/php-src/master/Zend/bench.php
|
||||||
|
php bench.php
|
4
.github/workflows/workflow.yml
vendored
4
.github/workflows/workflow.yml
vendored
@ -57,7 +57,7 @@ jobs:
|
|||||||
run: node dist/index.js
|
run: node dist/index.js
|
||||||
env:
|
env:
|
||||||
php-version: ${{ matrix.php-versions }}
|
php-version: ${{ matrix.php-versions }}
|
||||||
extensions: mbstring, xdebug, pcov #optional
|
extensions: xml, opcache, xdebug, pcov #optional
|
||||||
ini-values: 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
|
||||||
@ -72,7 +72,7 @@ jobs:
|
|||||||
- name: Testing Extensions
|
- name: Testing Extensions
|
||||||
run: |
|
run: |
|
||||||
php -m
|
php -m
|
||||||
php -r "if(! extension_loaded('mbstring')) {throw new Exception('mbstring not found');}"
|
php -r "if(! extension_loaded('xml')) {throw new Exception('xml not found');}"
|
||||||
php -r "if(! extension_loaded('Xdebug')) {throw new Exception('Xdebug 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');}"
|
php -r "if(phpversion()>=7.1 && ! extension_loaded('pcov')) {throw new Exception('PCOV not found');}"
|
||||||
- name: Testing ini values
|
- name: Testing ini values
|
||||||
|
50
README.md
50
README.md
@ -25,9 +25,11 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
- [PCOV](#pcov)
|
- [PCOV](#pcov)
|
||||||
- [Disable coverage](#disable-coverage)
|
- [Disable coverage](#disable-coverage)
|
||||||
- [Usage](#memo-usage)
|
- [Usage](#memo-usage)
|
||||||
- [Basic Usage](#basic-usage)
|
- [Basic Setup](#basic-setup)
|
||||||
- [Matrix Testing](#matrix-testing)
|
- [Matrix Setup](#matrix-setup)
|
||||||
|
- [Experimental Setup](#experimental-setup)
|
||||||
- [Cache dependencies](#cache-dependencies)
|
- [Cache dependencies](#cache-dependencies)
|
||||||
|
- [Problem Matchers](#problem-matchers)
|
||||||
- [Examples](#examples)
|
- [Examples](#examples)
|
||||||
- [License](#scroll-license)
|
- [License](#scroll-license)
|
||||||
- [Contributions](#1-contributions)
|
- [Contributions](#1-contributions)
|
||||||
@ -47,7 +49,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
|7.4|`Stable`|`Active`|
|
|7.4|`Stable`|`Active`|
|
||||||
|8.0|`Experimental`|`In development`|
|
|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.
|
**Note:** Specifying `8.0` in `php-version` input installs a nightly build of `PHP 8.0.0-dev` with `PHP JIT` support. See [experimental setup](#experimental-setup) for more information.
|
||||||
|
|
||||||
## :cloud: OS/Platform Support
|
## :cloud: OS/Platform Support
|
||||||
|
|
||||||
@ -70,7 +72,7 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|
|||||||
### Xdebug
|
### Xdebug
|
||||||
|
|
||||||
Specify `coverage: xdebug` to use `Xdebug`.
|
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") except `8.0`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: shivammathur/setup-php@v1
|
uses: shivammathur/setup-php@v1
|
||||||
@ -123,9 +125,9 @@ Inputs supported by this GitHub Action.
|
|||||||
|
|
||||||
See [action.yml](action.yml "Metadata for this GitHub Action") and usage below for more info.
|
See [action.yml](action.yml "Metadata for this GitHub Action") and usage below for more info.
|
||||||
|
|
||||||
### Basic Usage
|
### Basic Setup
|
||||||
|
|
||||||
> Setup a particular PHP version
|
> Setup a particular PHP version.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
@ -142,9 +144,9 @@ steps:
|
|||||||
pecl: false #optional, setup PECL
|
pecl: false #optional, setup PECL
|
||||||
```
|
```
|
||||||
|
|
||||||
### Matrix Testing
|
### Matrix Setup
|
||||||
|
|
||||||
> Setup multiple PHP versions
|
> Setup multiple PHP versions on multiple operating systems.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
@ -169,6 +171,29 @@ jobs:
|
|||||||
pecl: false #optional, setup PECL
|
pecl: false #optional, setup PECL
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Experimental Setup
|
||||||
|
|
||||||
|
> Setup a nightly build of `PHP 8.0.0-dev` from the [master branch](https://github.com/php/php-src/tree/master "Master branch on PHP source repository") of PHP.
|
||||||
|
|
||||||
|
- This version is currently in development and is an experimental feature on this action.
|
||||||
|
- `PECL` is installed by default with this version on `ubuntu`.
|
||||||
|
- Some extensions might not support this version currently.
|
||||||
|
- Refer to this [RFC](https://wiki.php.net/rfc/jit "PHP JIT RFC configuration") for configuring `PHP JIT` on this version.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v1
|
||||||
|
with:
|
||||||
|
php-version: '8.0'
|
||||||
|
extensions: mbstring #optional, setup extensions
|
||||||
|
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1 #optional, setup php.ini configuration
|
||||||
|
coverage: pcov #optional, setup PCOV, Xdebug does not support this version yet.
|
||||||
|
```
|
||||||
|
|
||||||
### 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.
|
||||||
@ -191,6 +216,15 @@ You can persist composer's internal cache directory using the [`action/cache`](h
|
|||||||
run: composer install --prefer-dist
|
run: composer install --prefer-dist
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Setup Problem Matchers for PHPUnit
|
||||||
|
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||||
|
```
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
Examples for setting up this GitHub Action with different PHP Frameworks/Packages.
|
Examples for setting up this GitHub Action with different PHP Frameworks/Packages.
|
||||||
|
34
__tests__/matchers.test.ts
Normal file
34
__tests__/matchers.test.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import * as io from '@actions/io';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as matchers from '../src/matchers';
|
||||||
|
|
||||||
|
async function cleanup(path: string): Promise<void> {
|
||||||
|
fs.unlink(path, error => {
|
||||||
|
if (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
jest.mock('@actions/io');
|
||||||
|
|
||||||
|
describe('Matchers', () => {
|
||||||
|
it('Add matchers', async () => {
|
||||||
|
process.env['RUNNER_TOOL_CACHE'] = __dirname;
|
||||||
|
await matchers.addMatchers();
|
||||||
|
const spy = jest.spyOn(io, 'cp');
|
||||||
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test Regex', async () => {
|
||||||
|
const regex1 = /^\d+\)\s.*$/;
|
||||||
|
const regex2 = /^(.*)$/;
|
||||||
|
const regex3 = /^\s*$/;
|
||||||
|
const regex4 = /^(.*):(\d+)$/;
|
||||||
|
expect(regex1.test('1) Tests\\Test::it_tests')).toBe(true);
|
||||||
|
expect(regex2.test('Failed asserting that false is true')).toBe(true);
|
||||||
|
expect(regex3.test('\n')).toBe(true);
|
||||||
|
expect(regex4.test('/path/to/file.php:42')).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
@ -20,7 +20,7 @@ inputs:
|
|||||||
pecl:
|
pecl:
|
||||||
description: 'Setup PECL on ubuntu'
|
description: 'Setup PECL on ubuntu'
|
||||||
required: false
|
required: false
|
||||||
# Deprecated options, do not use. Will not be supported after February 1, 2019.
|
# Deprecated options, do not use. Will not be supported after February 1, 2020.
|
||||||
extension-csv:
|
extension-csv:
|
||||||
description: 'Deprecated! Use extensions instead.'
|
description: 'Deprecated! Use extensions instead.'
|
||||||
deprecationMessage: 'The extension-csv property will not be supported after February 1, 2020. Use extensions instead.'
|
deprecationMessage: 'The extension-csv property will not be supported after February 1, 2020. Use extensions instead.'
|
||||||
|
45
dist/index.js
vendored
45
dist/index.js
vendored
@ -932,6 +932,46 @@ class ExecState extends events.EventEmitter {
|
|||||||
}
|
}
|
||||||
//# sourceMappingURL=toolrunner.js.map
|
//# sourceMappingURL=toolrunner.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 86:
|
||||||
|
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const path = __importStar(__webpack_require__(622));
|
||||||
|
const utils = __importStar(__webpack_require__(163));
|
||||||
|
const io = __importStar(__webpack_require__(1));
|
||||||
|
/**
|
||||||
|
* Cache json files for problem matchers
|
||||||
|
*/
|
||||||
|
function addMatchers() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const config_path = path.join(__dirname, '..', 'src', 'configs', 'phpunit.json');
|
||||||
|
const runner_dir = yield utils.getInput('RUNNER_TOOL_CACHE', false);
|
||||||
|
yield io.cp(config_path, runner_dir);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.addMatchers = addMatchers;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 87:
|
/***/ 87:
|
||||||
@ -1795,6 +1835,7 @@ const config = __importStar(__webpack_require__(641));
|
|||||||
const coverage = __importStar(__webpack_require__(635));
|
const coverage = __importStar(__webpack_require__(635));
|
||||||
const extensions = __importStar(__webpack_require__(911));
|
const extensions = __importStar(__webpack_require__(911));
|
||||||
const utils = __importStar(__webpack_require__(163));
|
const utils = __importStar(__webpack_require__(163));
|
||||||
|
const matchers = __importStar(__webpack_require__(86));
|
||||||
/**
|
/**
|
||||||
* Build the script
|
* Build the script
|
||||||
*
|
*
|
||||||
@ -1810,6 +1851,7 @@ function build(filename, version, os_version) {
|
|||||||
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 setup_matchers = yield utils.getInput('matchers', 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) {
|
||||||
script += yield extensions.addExtension(extension_csv, version, os_version);
|
script += yield extensions.addExtension(extension_csv, version, os_version);
|
||||||
@ -1848,9 +1890,10 @@ 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);
|
yield exec_1.exec('pwsh ' + script_path + ' -version ' + version + ' -dir ' + __dirname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
yield matchers.addMatchers();
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
114
package-lock.json
generated
114
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.6.1",
|
"version": "1.6.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -32,15 +32,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/core": {
|
"@babel/core": {
|
||||||
"version": "7.7.5",
|
"version": "7.7.7",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.7.5.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.7.7.tgz",
|
||||||
"integrity": "sha512-M42+ScN4+1S9iB6f+TL7QBpoQETxbclx+KNoKJABghnKYE+fMzSGqst0BZJc8CpI625bwPwYgUyRvxZ+0mZzpw==",
|
"integrity": "sha512-jlSjuj/7z138NLZALxVgrx13AOtqip42ATZP7+kYl53GvDV6+4dCek1mVUo8z8c8Xnw/mx2q3d9HWh3griuesQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.5.5",
|
"@babel/code-frame": "^7.5.5",
|
||||||
"@babel/generator": "^7.7.4",
|
"@babel/generator": "^7.7.7",
|
||||||
"@babel/helpers": "^7.7.4",
|
"@babel/helpers": "^7.7.4",
|
||||||
"@babel/parser": "^7.7.5",
|
"@babel/parser": "^7.7.7",
|
||||||
"@babel/template": "^7.7.4",
|
"@babel/template": "^7.7.4",
|
||||||
"@babel/traverse": "^7.7.4",
|
"@babel/traverse": "^7.7.4",
|
||||||
"@babel/types": "^7.7.4",
|
"@babel/types": "^7.7.4",
|
||||||
@ -68,9 +68,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/generator": {
|
"@babel/generator": {
|
||||||
"version": "7.7.4",
|
"version": "7.7.7",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.4.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.7.7.tgz",
|
||||||
"integrity": "sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg==",
|
"integrity": "sha512-/AOIBpHh/JU1l0ZFS4kiRCBnLi6OTHzh0RPk3h9isBxkkqELtQNFi1Vr/tiG9p1yfoUdKVwISuXWQR+hwwM4VQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/types": "^7.7.4",
|
"@babel/types": "^7.7.4",
|
||||||
@ -145,9 +145,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/parser": {
|
"@babel/parser": {
|
||||||
"version": "7.7.5",
|
"version": "7.7.7",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.5.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.7.7.tgz",
|
||||||
"integrity": "sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig==",
|
"integrity": "sha512-WtTZMZAZLbeymhkd/sEaPD8IQyGAhmuTuvTzLiCFM7iXiVdY0gc0IaI+cW0fh1BnSMbJSzXX6/fHllgHKwHhXw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@babel/plugin-syntax-object-rest-spread": {
|
"@babel/plugin-syntax-object-rest-spread": {
|
||||||
@ -503,9 +503,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/jest": {
|
"@types/jest": {
|
||||||
"version": "24.0.23",
|
"version": "24.0.24",
|
||||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.0.23.tgz",
|
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.0.24.tgz",
|
||||||
"integrity": "sha512-L7MBvwfNpe7yVPTXLn32df/EK+AMBFAFvZrRuArGs7npEWnlziUXK+5GMIUTI4NIuwok3XibsjXCs5HxviYXjg==",
|
"integrity": "sha512-vgaG968EDPSJPMunEDdZvZgvxYSmeH8wKqBlHSkBt1pV2XlLEVDzsj1ZhLuI4iG4Pv841tES61txSBF0obh4CQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"jest-diff": "^24.3.0"
|
"jest-diff": "^24.3.0"
|
||||||
@ -518,9 +518,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "12.12.17",
|
"version": "12.12.21",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.17.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.21.tgz",
|
||||||
"integrity": "sha512-Is+l3mcHvs47sKy+afn2O1rV4ldZFU7W8101cNlOd+MRbjM4Onida8jSZnJdTe/0Pcf25g9BNIUsuugmE6puHA==",
|
"integrity": "sha512-8sRGhbpU+ck1n0PGAUgVrWrWdjSW2aqNeyC15W88GRsMpSwzv6RJGlLhE7s2RhVSOdyDmxbqlWSeThq4/7xqlA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/normalize-package-data": {
|
"@types/normalize-package-data": {
|
||||||
@ -551,12 +551,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/eslint-plugin": {
|
"@typescript-eslint/eslint-plugin": {
|
||||||
"version": "2.11.0",
|
"version": "2.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.12.0.tgz",
|
||||||
"integrity": "sha512-G2HHA1vpMN0EEbUuWubiCCfd0R3a30BB+UdvnFkxwZIxYEGOrWEXDv8tBFO9f44CWc47Xv9lLM3VSn4ORLI2bA==",
|
"integrity": "sha512-1t4r9rpLuEwl3hgt90jY18wJHSyb0E3orVL3DaqwmpiSDHmHiSspVsvsFF78BJ/3NNG3qmeso836jpuBWYziAA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/experimental-utils": "2.11.0",
|
"@typescript-eslint/experimental-utils": "2.12.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",
|
||||||
@ -564,32 +564,32 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/experimental-utils": {
|
"@typescript-eslint/experimental-utils": {
|
||||||
"version": "2.11.0",
|
"version": "2.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.12.0.tgz",
|
||||||
"integrity": "sha512-YxcA/y0ZJaCc/fB/MClhcDxHI0nOBB7v2/WxBju2cOTanX7jO9ttQq6Fy4yW9UaY5bPd9xL3cun3lDVqk67sPQ==",
|
"integrity": "sha512-jv4gYpw5N5BrWF3ntROvCuLe1IjRenLy5+U57J24NbPGwZFAjhnM45qpq0nDH1y/AZMb3Br25YiNVwyPbz6RkA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/json-schema": "^7.0.3",
|
"@types/json-schema": "^7.0.3",
|
||||||
"@typescript-eslint/typescript-estree": "2.11.0",
|
"@typescript-eslint/typescript-estree": "2.12.0",
|
||||||
"eslint-scope": "^5.0.0"
|
"eslint-scope": "^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/parser": {
|
"@typescript-eslint/parser": {
|
||||||
"version": "2.11.0",
|
"version": "2.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.12.0.tgz",
|
||||||
"integrity": "sha512-DyGXeqhb3moMioEFZIHIp7oXBBh7dEfPTzGrlyP0Mi9ScCra4SWEGs3kPd18mG7Sy9Wy8z88zmrw5tSGL6r/6A==",
|
"integrity": "sha512-lPdkwpdzxEfjI8TyTzZqPatkrswLSVu4bqUgnB03fHSOwpC7KSerPgJRgIAf11UGNf7HKjJV6oaPZI4AghLU6g==",
|
||||||
"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.11.0",
|
"@typescript-eslint/experimental-utils": "2.12.0",
|
||||||
"@typescript-eslint/typescript-estree": "2.11.0",
|
"@typescript-eslint/typescript-estree": "2.12.0",
|
||||||
"eslint-visitor-keys": "^1.1.0"
|
"eslint-visitor-keys": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/typescript-estree": {
|
"@typescript-eslint/typescript-estree": {
|
||||||
"version": "2.11.0",
|
"version": "2.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.12.0.tgz",
|
||||||
"integrity": "sha512-HGY4+d4MagO6cKMcKfIKaTMxcAv7dEVnji2Zi+vi5VV8uWAM631KjAB5GxFcexMYrwKT0EekRiiGK1/Sd7VFGA==",
|
"integrity": "sha512-rGehVfjHEn8Frh9UW02ZZIfJs6SIIxIu/K1bbci8rFfDE/1lQ8krIJy5OXOV3DVnNdDPtoiPOdEANkLMrwXbiQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
@ -1815,9 +1815,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-plugin-prettier": {
|
"eslint-plugin-prettier": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.2.tgz",
|
||||||
"integrity": "sha512-A+TZuHZ0KU0cnn56/9mfR7/KjUJ9QNVXUhwvRFSR7PGPe0zQR6PTkmyqg1AtUUEOzTqeRsUwyKFh0oVZKVCrtA==",
|
"integrity": "sha512-GlolCC9y3XZfv3RQfwGew7NnuFDKsfI4lbvRK+PIIo23SFH+LemGs4cKwzAaRa+Mdb+lQO/STaIayno8T5sJJA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"prettier-linter-helpers": "^1.0.0"
|
"prettier-linter-helpers": "^1.0.0"
|
||||||
@ -3210,9 +3210,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"inquirer": {
|
"inquirer": {
|
||||||
"version": "7.0.0",
|
"version": "7.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.1.tgz",
|
||||||
"integrity": "sha512-rSdC7zelHdRQFkWnhsMu2+2SO41mpv2oF2zy4tMhmiLWkcKbOAs87fWAJhVXttKVwhdZvymvnuM95EyEXg2/tQ==",
|
"integrity": "sha512-V1FFQ3TIO15det8PijPLFR9M9baSlnRs9nL7zWu1MNVA2T9YVl9ZbrHJhYs7e9X8jeMZ3lr2JH/rdHFgNCBdYw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-escapes": "^4.2.1",
|
"ansi-escapes": "^4.2.1",
|
||||||
@ -3224,7 +3224,7 @@
|
|||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"mute-stream": "0.0.8",
|
"mute-stream": "0.0.8",
|
||||||
"run-async": "^2.2.0",
|
"run-async": "^2.2.0",
|
||||||
"rxjs": "^6.4.0",
|
"rxjs": "^6.5.3",
|
||||||
"string-width": "^4.1.0",
|
"string-width": "^4.1.0",
|
||||||
"strip-ansi": "^5.1.0",
|
"strip-ansi": "^5.1.0",
|
||||||
"through": "^2.3.6"
|
"through": "^2.3.6"
|
||||||
@ -3307,9 +3307,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"is-date-object": {
|
"is-date-object": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz",
|
||||||
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=",
|
"integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"is-descriptor": {
|
"is-descriptor": {
|
||||||
@ -3406,12 +3406,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"is-regex": {
|
"is-regex": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz",
|
||||||
"integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
|
"integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"has": "^1.0.1"
|
"has": "^1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"is-stream": {
|
"is-stream": {
|
||||||
@ -5054,9 +5054,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"resolve": {
|
"resolve": {
|
||||||
"version": "1.13.1",
|
"version": "1.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.1.tgz",
|
||||||
"integrity": "sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w==",
|
"integrity": "sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"path-parse": "^1.0.6"
|
"path-parse": "^1.0.6"
|
||||||
@ -5613,9 +5613,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"string.prototype.trimleft": {
|
"string.prototype.trimleft": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz",
|
||||||
"integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==",
|
"integrity": "sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"define-properties": "^1.1.3",
|
"define-properties": "^1.1.3",
|
||||||
@ -5623,9 +5623,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"string.prototype.trimright": {
|
"string.prototype.trimright": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz",
|
||||||
"integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==",
|
"integrity": "sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"define-properties": "^1.1.3",
|
"define-properties": "^1.1.3",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.6.1",
|
"version": "1.6.2",
|
||||||
"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",
|
||||||
@ -26,6 +26,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.0",
|
"@actions/core": "^1.2.0",
|
||||||
"@actions/exec": "^1.0.2",
|
"@actions/exec": "^1.0.2",
|
||||||
|
"@actions/io": "^1.0.1",
|
||||||
"fs": "0.0.1-security"
|
"fs": "0.0.1-security"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
24
src/configs/phpunit.json
Normal file
24
src/configs/phpunit.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"problemMatcher": [
|
||||||
|
{
|
||||||
|
"owner": "phpunit",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^\\d+\\)\\s.*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"regexp": "^(.*)$",
|
||||||
|
"message": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"regexp": "^\\s*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"regexp": "^(.*):(\\d+)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Binary file not shown.
@ -4,6 +4,7 @@ import * as config from './config';
|
|||||||
import * as coverage from './coverage';
|
import * as coverage from './coverage';
|
||||||
import * as extensions from './extensions';
|
import * as extensions from './extensions';
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
|
import * as matchers from './matchers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the script
|
* Build the script
|
||||||
@ -25,6 +26,7 @@ export async function build(
|
|||||||
(await utils.getInput('ini-values', false)) ||
|
(await utils.getInput('ini-values', false)) ||
|
||||||
(await utils.getInput('ini-values-csv', 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);
|
||||||
|
const setup_matchers: string = await utils.getInput('matchers', false);
|
||||||
|
|
||||||
let script: string = await utils.readScript(filename, version, os_version);
|
let script: string = await utils.readScript(filename, version, os_version);
|
||||||
if (extension_csv) {
|
if (extension_csv) {
|
||||||
@ -63,9 +65,12 @@ 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('pwsh ' + script_path + ' -version ' + version);
|
await exec(
|
||||||
|
'pwsh ' + script_path + ' -version ' + version + ' -dir ' + __dirname
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
await matchers.addMatchers();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
18
src/matchers.ts
Normal file
18
src/matchers.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import * as path from 'path';
|
||||||
|
import * as utils from './utils';
|
||||||
|
import * as io from '@actions/io';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache json files for problem matchers
|
||||||
|
*/
|
||||||
|
export async function addMatchers(): Promise<void> {
|
||||||
|
const config_path = path.join(
|
||||||
|
__dirname,
|
||||||
|
'..',
|
||||||
|
'src',
|
||||||
|
'configs',
|
||||||
|
'phpunit.json'
|
||||||
|
);
|
||||||
|
const runner_dir: string = await utils.getInput('RUNNER_TOOL_CACHE', false);
|
||||||
|
await io.cp(config_path, runner_dir);
|
||||||
|
}
|
@ -17,8 +17,22 @@ add_log() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_extension_regex() {
|
||||||
|
extension=$1
|
||||||
|
case $extension in
|
||||||
|
"opcache")
|
||||||
|
echo "^Zend\sOPcache$"
|
||||||
|
;;
|
||||||
|
"xdebug")
|
||||||
|
echo "^Xdebug$"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo ^"$extension"$
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
step_log "Setup PHP and Composer"
|
step_log "Setup PHP and Composer"
|
||||||
version=$1
|
|
||||||
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
|
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
|
||||||
brew tap shivammathur/homebrew-php >/dev/null 2>&1
|
brew tap shivammathur/homebrew-php >/dev/null 2>&1
|
||||||
brew install shivammathur/php/php@"$1" composer >/dev/null 2>&1
|
brew install shivammathur/php/php@"$1" composer >/dev/null 2>&1
|
||||||
@ -37,11 +51,12 @@ add_extension() {
|
|||||||
extension=$1
|
extension=$1
|
||||||
install_command=$2
|
install_command=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
if ! php -m | grep -i -q ^"$extension"$ && [ -e "$ext_dir/$extension.so" ]; then
|
extension_regex="$(get_extension_regex "$extension")"
|
||||||
echo "$prefix=$extension" >>"$ini_file" && add_log $tick "$extension" "Enabled"
|
if ! php -m | grep -i -q "$extension_regex" && [ -e "$ext_dir/$extension.so" ]; then
|
||||||
elif php -m | grep -i -q ^"$extension"$; then
|
echo "$prefix=$extension" >>"$ini_file" && add_log "$tick" "$extension" "Enabled"
|
||||||
|
elif php -m | grep -i -q "$extension_regex"; then
|
||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
elif ! php -m | grep -i -q ^"$extension"$; then
|
elif ! php -m | grep -i -q "$extension_regex"; then
|
||||||
exists=$(curl -sL https://pecl.php.net/json.php?package="$extension" -w "%{http_code}" -o /dev/null)
|
exists=$(curl -sL https://pecl.php.net/json.php?package="$extension" -w "%{http_code}" -o /dev/null)
|
||||||
if [ "$exists" = "200" ]; then
|
if [ "$exists" = "200" ]; then
|
||||||
(
|
(
|
||||||
@ -49,7 +64,7 @@ add_extension() {
|
|||||||
add_log "$tick" "$extension" "Installed and enabled"
|
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"
|
||||||
else
|
else
|
||||||
if ! php -m | grep -i -q ^"$extension"$; then
|
if ! php -m | grep -i -q "$extension_regex"; then
|
||||||
add_log "$cross" "$extension" "Could not find $extension for PHP $semver on PECL"
|
add_log "$cross" "$extension" "Could not find $extension for PHP $semver on PECL"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -16,6 +16,22 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_extension_regex() {
|
||||||
|
extension=$1
|
||||||
|
case $extension in
|
||||||
|
"opcache")
|
||||||
|
echo "^Zend\sOPcache$"
|
||||||
|
;;
|
||||||
|
"xdebug")
|
||||||
|
echo "^Xdebug$"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo ^"$extension"$
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
existing_version=$(php-config --version | cut -c 1-3)
|
existing_version=$(php-config --version | cut -c 1-3)
|
||||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')
|
semver=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')
|
||||||
step_log "Setup PHP and Composer"
|
step_log "Setup PHP and Composer"
|
||||||
@ -96,11 +112,12 @@ add_extension()
|
|||||||
extension=$1
|
extension=$1
|
||||||
install_command=$2
|
install_command=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
if ! php -m | grep -i -q ^"$extension"$ && [ -e "$ext_dir/$extension.so" ]; then
|
extension_regex="$(get_extension_regex "$extension")"
|
||||||
|
if ! php -m | grep -i -q "$extension_regex" && [ -e "$ext_dir/$extension.so" ]; then
|
||||||
echo "$prefix=$extension" >> "$ini_file" && add_log "$tick" "$extension" "Enabled"
|
echo "$prefix=$extension" >> "$ini_file" && add_log "$tick" "$extension" "Enabled"
|
||||||
elif php -m | grep -i -q ^"$extension"$; then
|
elif php -m | grep -i -q "$extension_regex"; then
|
||||||
add_log "$tick" "$extension" "Enabled"
|
add_log "$tick" "$extension" "Enabled"
|
||||||
elif ! php -m | grep -i -q ^"$extension"$; then
|
elif ! php -m | grep -i -q "$extension_regex"; then
|
||||||
(
|
(
|
||||||
eval "$install_command" && \
|
eval "$install_command" && \
|
||||||
add_log "$tick" "$extension" "Installed and enabled"
|
add_log "$tick" "$extension" "Installed and enabled"
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
param (
|
param (
|
||||||
[Parameter(Mandatory = $true)][string]$version = "7.3"
|
[Parameter(Mandatory = $true)][string]$version = "7.4",
|
||||||
|
[Parameter(Mandatory=$true)][string]$dir
|
||||||
)
|
)
|
||||||
|
|
||||||
$tick = ([char]8730)
|
$tick = ([char]8730)
|
||||||
$cross = ([char]10007)
|
$cross = ([char]10007)
|
||||||
$php_dir = 'C:\tools\php'
|
$php_dir = 'C:\tools\php'
|
||||||
|
$ext_dir = $php_dir + '\ext'
|
||||||
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
|
$master_version = '8.0'
|
||||||
|
|
||||||
Function Step-Log($message) {
|
Function Step-Log($message) {
|
||||||
printf "\n\033[90;1m==> \033[0m\033[37;1m%s \033[0m\n" $message
|
printf "\n\033[90;1m==> \033[0m\033[37;1m%s \033[0m\n" $message
|
||||||
@ -15,10 +19,6 @@ 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,11 +33,16 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) {
|
|||||||
}
|
}
|
||||||
Step-Log "Setup PHP and Composer"
|
Step-Log "Setup PHP and Composer"
|
||||||
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.')))) {
|
if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.')))) {
|
||||||
|
$arch='x64'
|
||||||
if ($version -lt '7.0') {
|
if ($version -lt '7.0') {
|
||||||
Install-Module -Name VcRedist -Force
|
Install-Module -Name VcRedist -Force
|
||||||
|
$arch='x86'
|
||||||
|
}
|
||||||
|
if ($version -eq $master_version) {
|
||||||
|
$version = 'master'
|
||||||
}
|
}
|
||||||
|
|
||||||
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 $arch -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)"
|
||||||
}
|
}
|
||||||
@ -46,12 +51,17 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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, opcache -Path $php_dir
|
||||||
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
|
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
|
||||||
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
|
||||||
Add-Log $tick "Composer" "Installed"
|
Add-Log $tick "Composer" "Installed"
|
||||||
|
if ($version -eq 'master') {
|
||||||
|
Copy-Item $dir"\..\src\ext\php_pcov.dll" -Destination $ext_dir"\php_pcov.dll"
|
||||||
|
Set-PhpIniKey -Key 'opcache.jit_buffer_size' -Value '256M' -Path $php_dir
|
||||||
|
Set-PhpIniKey -Key 'opcache.jit' -Value '1235' -Path $php_dir
|
||||||
|
}
|
||||||
|
|
||||||
Function Add-Extension {
|
Function Add-Extension {
|
||||||
Param (
|
Param (
|
||||||
|
Loading…
Reference in New Issue
Block a user