Compare commits

...

20 Commits

Author SHA1 Message Date
fbdd58c5bc Bump version to 1.11.5
Replace husky with simple-git-hooks

Update Node.js dependencies
2021-09-28 01:51:40 +05:30
2c5cb7a75e Make all extension variables local 2021-09-28 01:42:44 +05:30
ab12e42197 Add support for expect and ssh2 using shivammathur/extensions on macOS
Add config to brew extensions and refactor add_brew_extension in darwin.sh to use it
2021-09-28 01:38:12 +05:30
5588437714 Update sponsors section 2021-09-28 01:28:53 +05:30
d7eb9ade23 Update SECURITY.md 2021-09-11 04:42:32 +05:30
938988b211 Bump version to 1.11.4
Update Node.js dependencies

Fix build error in install.ts

Add config to generate types

Add bugs, directories, files and types entries in package.json
2021-09-11 04:41:35 +05:30
e030852d0e Use PhpManager for all PHP versions on v1 2021-09-09 02:53:01 +05:30
3aa870b0fe Fix unsupported PHP versions warning on v1 2021-09-09 02:49:04 +05:30
1229133602 Use shivammathur/extensions tap to install vips on macOS 2021-09-09 02:40:49 +05:30
b1b8d8367c Run New-Item with -Force in Win32.ps1 2021-09-09 02:34:37 +05:30
60ff55130a Update sponsors info 2021-09-09 02:30:03 +05:30
e5690a9659 Add windows-2022 to the README 2021-09-09 02:27:14 +05:30
7958a5ccff Bump version 1.11.3
Sync tsconfig.json with v2

Update dependencies
2021-08-23 12:54:39 +05:30
113a31fceb Stop doing shallow clones on macOS self-hosted 2021-08-23 12:49:33 +05:30
c9aea8708f Set HOMEBREW_DEVELOPER=1 in macOS 2021-08-23 12:48:34 +05:30
7435bb8e4a Use --no-install-recommends with APT on Linux 2021-08-23 12:47:56 +05:30
5227e2cd5c Fix to make utils.readEnv more resilient to user input 2021-08-23 12:42:17 +05:30
906893d397 Use shivammathur/extensions tap on macOS for mongodb and yaml 2021-08-23 12:41:33 +05:30
f1b6b2bbe0 Rename macos-11.0 to macos-11 2021-08-23 12:39:55 +05:30
e59c938e82 Update Phive configuration 2021-08-23 12:38:05 +05:30
19 changed files with 1797 additions and 2509 deletions

6
.github/FUNDING.yml vendored
View File

@ -1,7 +1,3 @@
# These are supported funding model platforms
open_collective: setup-php
tidelift: "npm/setup-php"
community_bridge: setup-php
patreon: shivammathur
custom: https://www.paypal.me/shivammathur
github:shivammathur

3
.github/SECURITY.md vendored
View File

@ -7,7 +7,7 @@ The following versions of this project are supported for security updates.
| Version | Supported |
| ------- | ------------------ |
| 1.11.x | :white_check_mark: |
| 2.11.x | :white_check_mark: |
| 2.14.x | :white_check_mark: |
## Supported PHP Versions
@ -18,6 +18,7 @@ This security policy only applies to the latest patches of the following PHP ver
| 7.3 | :white_check_mark: |
| 7.4 | :white_check_mark: |
| 8.0 | :white_check_mark: |
| 8.1 | :white_check_mark: |
## Reporting a Vulnerability

View File

@ -61,8 +61,9 @@ Setup PHP with required extensions, php.ini configuration, code-coverage support
|Ubuntu 18.04|`ubuntu-18.04`|`PHP 7.1` to `PHP 8.0`|
|Ubuntu 20.04|`ubuntu-latest` or `ubuntu-20.04`|`PHP 7.4` to `PHP 8.0`|
|Windows Server 2019|`windows-latest` or `windows-2019`|`PHP 8.0`|
|Windows Server 2022|`windows-2022`|`PHP 8.0`|
|macOS 10.15 Catalina|`macos-latest` or `macos-10.15`|`PHP 8.0`|
|macOS 11.0 Big Sur|`macos-11.0`|`PHP 8.0`|
|macOS 11.x Big Sur|`macos-11`|`PHP 8.0`|
## :heavy_plus_sign: PHP Extension Support
- On `ubuntu` by default extensions which are available as a package can be installed. If the extension is not available as a package but it is on `PECL`, it can be installed by specifying `pecl` in the tools input.
@ -415,31 +416,24 @@ Contributions are welcome! See [Contributor's Guide](.github/CONTRIBUTING.md "sh
## :sparkling_heart: Support This Project
- If setup-php saved your developer time, please consider sponsoring setup-php:
- [Open Collective](https://opencollective.com/setup-php "setup-php Open Collective")
- [Paypal](https://www.paypal.me/shivammathur "Shivam Mathur PayPal")
- [Patreon](https://www.patreon.com/shivammathur "Shivam Mathur Patreon")
- Please [reach out](mailto:contact@setup-php.com) if you have any questions regarding sponsoring setup-php.
- Please star the project and share it. If you blog, please share your experience of using this action.
Please sponsor setup-php using [GitHub sponsors](https://github.com/sponsors/shivammathur).
*Huge thanks to the following companies for supporting `setup-php`*
[![Sponsor shivammathur](https://img.shields.io/badge/-Sponsor-fafbfc?logo=GitHub%20Sponsors)](https://github.com/sponsors/shivammathur)
<p>
<a href="https://www.jetbrains.com/?from=setup-php">
<img src="https://setup-php.com/sponsors/jetbrains.svg" alt="JetBrains" width="106" height="60">
### Corporate Sponsors
<p align="center">
<a href="https://setup-php.com/sponsors-corp/?">
<img src="https://setup-php.com/sponsors-corp/?" alt="Corporate sponsors of setup-php and related projects" width="100%">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://blackfire.io/?utm_source=setup-php">
<img src="https://setup-php.com/sponsors//blackfire.svg" alt="Blackfire" width="212" height="60">
</p>
### Individual Sponsors
<p align="center">
<a href="https://setup-php.com/sponsors/?">
<img src="https://setup-php.com/sponsors/?" alt="Individual sponsors of setup-php and related projects" width="100%">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://www.macstadium.com/?source=setup-php">
<img src="https://setup-php.com/sponsors//macstadium.png" alt="Mac Stadium" width="148" height="60">
</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://tidelift.com/subscription/pkg/npm-setup-php">
<img src="https://setup-php.com/sponsors//tidelift.png" alt="Tidelift" width="70" height="60">
</a>
</p>
## :bookmark: Dependencies

View File

@ -73,12 +73,13 @@ describe('Extension tests', () => {
it('checking addExtensionOnDarwin', async () => {
let darwin: string = await extensions.addExtension(
'Xdebug, pcov, grpc, igbinary, imagick, phalcon3, phalcon4, protobuf, psr, rdkafka, swoole, sqlite, ast-beta',
'Xdebug, pcov, expect, grpc, igbinary, imagick, phalcon3, phalcon4, protobuf, psr, rdkafka, ssh2, swoole, vips, sqlite, ast-beta',
'7.2',
'darwin'
);
expect(darwin).toContain('add_brew_extension xdebug');
expect(darwin).toContain('add_brew_extension pcov');
expect(darwin).toContain('add_brew_extension expect');
expect(darwin).toContain('add_brew_extension grpc');
expect(darwin).toContain('add_brew_extension igbinary');
expect(darwin).toContain('add_brew_extension imagick');
@ -87,7 +88,9 @@ describe('Extension tests', () => {
expect(darwin).toContain('add_brew_extension protobuf');
expect(darwin).toContain('add_brew_extension psr');
expect(darwin).toContain('add_brew_extension rdkafka');
expect(darwin).toContain('add_brew_extension ssh2');
expect(darwin).toContain('add_brew_extension swoole');
expect(darwin).toContain('add_brew_extension vips');
expect(darwin).toContain('pecl_install sqlite3');
expect(darwin).toContain('add_unstable_extension ast beta extension');

View File

@ -127,6 +127,11 @@ describe('Tools tests', () => {
expect(script).toContain(
'Add-Tool https://github.com/phar-io/phive/releases/download/0.13.5/phive-0.13.5.phar phive'
);
script = await tools.addPhive('latest', '7.2', 'win32');
expect(script).toContain(
'Add-Tool https://github.com/phar-io/phive/releases/download/0.14.5/phive-0.14.5.phar phive'
);
});
it('checking getPhpunitUri', async () => {

View File

@ -23,7 +23,11 @@ async function cleanup(path: string): Promise<void> {
describe('Utils tests', () => {
it('checking readEnv', async () => {
process.env['test'] = 'setup-php';
process.env['test-hyphen'] = 'setup-php';
expect(await utils.readEnv('test')).toBe('setup-php');
expect(await utils.readEnv('TEST')).toBe('setup-php');
expect(await utils.readEnv('test_hyphen')).toBe('setup-php');
expect(await utils.readEnv('TEST_HYPHEN')).toBe('setup-php');
expect(await utils.readEnv('undefined')).toBe('');
});

99
dist/index.js vendored
View File

@ -230,9 +230,10 @@ async function addExtensionDarwin(extension_csv, version) {
' ' +
ext_prefix;
return;
case /(5\.6|7\.[0-4]|8.0)(amqp|grpc|igbinary|imagick|imap|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|swoole|xdebug|xdebug2|zmq)/.test(version_extension):
case /(5\.6|7\.[0-4]|8.0)(amqp|expect|grpc|igbinary|imagick|imap|mongodb|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(version_extension):
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
case /^(5\.6|7\.[0-3])phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
case /(7\.[0-4]|8\.0])vips/.test(version_extension):
command = 'add_brew_extension ' + extension_name.replace('pecl_', '');
break;
case /^sqlite$/.test(extension):
@ -444,8 +445,8 @@ async function run() {
}
core.warning('setup-php v1 is deprecated.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2');
const version = await utils.parseVersion(await utils.getInput('php-version', true));
if (version == '8.1') {
core.setFailed('PHP 8.1 is not supported on setup-php v1.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2');
if (parseFloat(version) < 5.6 || parseFloat(version) > 8.0) {
core.setFailed(`setup-php v1 supports only PHP 5.6 to 8.0.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2`);
return;
}
if (version) {
@ -455,11 +456,11 @@ async function run() {
case 'darwin':
case 'linux':
script_path = await build(os_version + '.sh', version, os_version);
await exec_1.exec('bash ' + script_path + ' ' + version + ' ' + __dirname);
await (0, exec_1.exec)('bash ' + script_path + ' ' + version + ' ' + __dirname);
break;
case 'win32':
script_path = await build('win32.ps1', version, os_version);
await exec_1.exec('pwsh ' + script_path + ' ' + version + ' ' + __dirname);
await (0, exec_1.exec)('pwsh ' + script_path + ' ' + version + ' ' + __dirname);
break;
}
}
@ -468,7 +469,7 @@ async function run() {
}
}
catch (error) {
core.setFailed(error.message);
core.setFailed(error);
}
}
exports.run = run;
@ -571,6 +572,9 @@ async function addPhive(version, php_version, os_version) {
case /7\.1/.test(php_version):
version = version.replace('latest', '0.13.5');
break;
case /7\.2/.test(php_version):
version = version.replace('latest', '0.14.5');
break;
}
switch (version) {
case 'latest':
@ -821,13 +825,14 @@ const https = __importStar(__nccwpck_require__(211));
const path = __importStar(__nccwpck_require__(622));
const core = __importStar(__nccwpck_require__(186));
async function readEnv(property) {
const value = process.env[property];
switch (value) {
case undefined:
return '';
default:
return value;
}
const property_lc = property.toLowerCase();
const property_uc = property.toUpperCase();
return (process.env[property] ||
process.env[property_lc] ||
process.env[property_uc] ||
process.env[property_lc.replace('_', '-')] ||
process.env[property_uc.replace('_', '-')] ||
'');
}
exports.readEnv = readEnv;
async function getInput(name, mandatory) {
@ -1133,7 +1138,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
const command_1 = __nccwpck_require__(241);
const file_command_1 = __nccwpck_require__(717);
const utils_1 = __nccwpck_require__(278);
@ -1311,19 +1316,30 @@ exports.debug = debug;
/**
* Adds an error issue
* @param message error issue message. Errors will be converted to string via toString()
* @param properties optional properties to add to the annotation.
*/
function error(message) {
command_1.issue('error', message instanceof Error ? message.toString() : message);
function error(message, properties = {}) {
command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
}
exports.error = error;
/**
* Adds an warning issue
* Adds a warning issue
* @param message warning issue message. Errors will be converted to string via toString()
* @param properties optional properties to add to the annotation.
*/
function warning(message) {
command_1.issue('warning', message instanceof Error ? message.toString() : message);
function warning(message, properties = {}) {
command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
}
exports.warning = warning;
/**
* Adds a notice issue
* @param message notice issue message. Errors will be converted to string via toString()
* @param properties optional properties to add to the annotation.
*/
function notice(message, properties = {}) {
command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
}
exports.notice = notice;
/**
* Writes info to log with console.log.
* @param message info message
@ -1455,7 +1471,7 @@ exports.issueCommand = issueCommand;
// We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.toCommandValue = void 0;
exports.toCommandProperties = exports.toCommandValue = void 0;
/**
* Sanitizes an input into a string so it can be passed into issueCommand safely
* @param input input to sanitize into a string
@ -1470,6 +1486,25 @@ function toCommandValue(input) {
return JSON.stringify(input);
}
exports.toCommandValue = toCommandValue;
/**
*
* @param annotationProperties
* @returns The command properties to send with the actual annotation command
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
*/
function toCommandProperties(annotationProperties) {
if (!Object.keys(annotationProperties).length) {
return {};
}
return {
title: annotationProperties.title,
line: annotationProperties.startLine,
endLine: annotationProperties.endLine,
col: annotationProperties.startColumn,
endColumn: annotationProperties.endColumn
};
}
exports.toCommandProperties = toCommandProperties;
//# sourceMappingURL=utils.js.map
/***/ }),
@ -2740,70 +2775,70 @@ function copyFile(srcFile, destFile, force) {
/***/ 357:
/***/ ((module) => {
module.exports = require("assert");;
module.exports = require("assert");
/***/ }),
/***/ 129:
/***/ ((module) => {
module.exports = require("child_process");;
module.exports = require("child_process");
/***/ }),
/***/ 614:
/***/ ((module) => {
module.exports = require("events");;
module.exports = require("events");
/***/ }),
/***/ 747:
/***/ ((module) => {
module.exports = require("fs");;
module.exports = require("fs");
/***/ }),
/***/ 211:
/***/ ((module) => {
module.exports = require("https");;
module.exports = require("https");
/***/ }),
/***/ 87:
/***/ ((module) => {
module.exports = require("os");;
module.exports = require("os");
/***/ }),
/***/ 622:
/***/ ((module) => {
module.exports = require("path");;
module.exports = require("path");
/***/ }),
/***/ 304:
/***/ ((module) => {
module.exports = require("string_decoder");;
module.exports = require("string_decoder");
/***/ }),
/***/ 213:
/***/ ((module) => {
module.exports = require("timers");;
module.exports = require("timers");
/***/ }),
/***/ 669:
/***/ ((module) => {
module.exports = require("util");;
module.exports = require("util");
/***/ })
@ -2842,7 +2877,9 @@ module.exports = require("util");;
/************************************************************************/
/******/ /* webpack/runtime/compat */
/******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports

3968
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,24 @@
{
"name": "setup-php",
"version": "1.11.2",
"version": "1.11.5",
"private": false,
"description": "Setup PHP for use with GitHub Actions",
"main": "lib/install.js",
"types": "lib/install.d.ts",
"directories": {
"lib": "lib",
"test": "__tests__",
"src": "src"
},
"files": [
"lib",
"src"
],
"scripts": {
"build": "tsc",
"lint": "eslint **/*.ts --cache --fix",
"format": "prettier --write **/*.ts && git add .",
"format-check": "prettier --check **/*.ts",
"lint": "eslint **/src/*.ts --cache --fix",
"format": "prettier --write **/src/*.ts && git add .",
"format-check": "prettier --check **/src/*.ts",
"release": "ncc build -o dist && git add -f dist/",
"test": "jest"
},
@ -24,33 +34,33 @@
"author": "shivammathur",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.4.0",
"@actions/core": "^1.5.0",
"@actions/exec": "^1.1.0",
"@actions/io": "^1.1.1",
"fs": "0.0.1-security"
},
"devDependencies": {
"@types/jest": "^26.0.24",
"@types/node": "^16.3.1",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"@vercel/ncc": "^0.28.6",
"eslint": "^7.30.0",
"@types/jest": "^27.0.2",
"@types/node": "^16.10.1",
"@typescript-eslint/eslint-plugin": "^4.32.0",
"@typescript-eslint/parser": "^4.32.0",
"@vercel/ncc": "^0.31.1",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-prettier": "^3.4.0",
"husky": "^4.3.8",
"jest": "^27.0.6",
"jest-circus": "^27.0.6",
"prettier": "^2.3.2",
"ts-jest": "^27.0.3",
"typescript": "^4.3.5"
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jest": "^24.4.2",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.2.2",
"jest-circus": "^27.2.2",
"prettier": "^2.4.1",
"simple-git-hooks": "^2.6.1",
"ts-jest": "^27.0.5",
"typescript": "^4.4.3"
},
"husky": {
"skipCI": true,
"hooks": {
"pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release"
}
"bugs": {
"url": "https://github.com/shivammathur/setup-php/issues"
},
"simple-git-hooks": {
"pre-commit": "npm run format && npm run lint && npm run test && npm run build && npm run release"
}
}

View File

@ -0,0 +1,28 @@
amqp=amqp
apcu=apcu
expect=expect
grpc=grpc
igbinary=igbinary
imagick=imagick
imap=imap
memcache=memcache
memcached=memcached
mongodb=mongodb
msgpack=msgpack
pcov=pcov
pecl_http=http
phalcon3=phalcon
phalcon4=phalcon
propro=propro
protobuf=protobuf
psr=psr
raphf=raphf
rdkafka=rdkafka
redis=redis
ssh2=ssh2
swoole=swoole
vips=vips
xdebug=xdebug
xdebug2=xdebug
yaml=yaml
zmq=zmq

View File

@ -30,15 +30,17 @@ export async function addExtensionDarwin(
' ' +
ext_prefix;
return;
// match 5.6 to 8.0 amqp, grpc, igbinary, imagick, imap, msgpack, pecl_http, propro, protobuf, raphf, rdkafka, redis, swoole, xdebug, xdebug2, zmq
// match 5.6 to 8.0 amqp, expect, grpc, igbinary, imagick, imap, mongodb, msgpack, pecl_http, propro, protobuf, raphf, rdkafka, redis, ssh2, swoole, xdebug, xdebug2, yaml, zmq
// match 7.1pcov to 8.0pcov
case /(5\.6|7\.[0-4]|8.0)(amqp|grpc|igbinary|imagick|imap|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|swoole|xdebug|xdebug2|zmq)/.test(
// match 7.0vips to 8.0vips
case /(5\.6|7\.[0-4]|8.0)(amqp|expect|grpc|igbinary|imagick|imap|mongodb|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(
version_extension
):
case /(7\.[1-4]|8\.0])pcov/.test(version_extension):
case /^(5\.6|7\.[0-3])phalcon3$|^7\.[2-4]phalcon4$/.test(
version_extension
):
case /(7\.[0-4]|8\.0])vips/.test(version_extension):
command = 'add_brew_extension ' + extension_name.replace('pecl_', '');
break;
// match sqlite

View File

@ -67,9 +67,9 @@ export async function run(): Promise<void> {
const version: string = await utils.parseVersion(
await utils.getInput('php-version', true)
);
if (version == '8.1') {
if (parseFloat(version) < 5.6 || parseFloat(version) > 8.0) {
core.setFailed(
'PHP 8.1 is not supported on setup-php v1.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2'
`setup-php v1 supports only PHP 5.6 to 8.0.\nPlease upgrade to v2 - https://setup-php.com/w/Switch-to-v2`
);
return;
}
@ -92,7 +92,7 @@ export async function run(): Promise<void> {
core.setFailed('Unable to get the PHP version');
}
} catch (error) {
core.setFailed(error.message);
core.setFailed(error as Error);
}
}

View File

@ -18,7 +18,7 @@ add_log() {
# Function to remove extensions
remove_extension() {
extension=$1
local extension=$1
sudo sed -Ei '' "/=(.*\/)?\"?$extension/d" "$ini_file"
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
@ -26,7 +26,7 @@ remove_extension() {
# Function to test if extension is loaded
check_extension() {
extension=$1
local extension=$1
if [ "$extension" != "mysql" ]; then
php -m | grep -i -q -w "$extension"
else
@ -42,7 +42,7 @@ pecl_install() {
# Function to get the PECL version
get_pecl_version() {
extension=$1
local extension=$1
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
pecl_rest='https://pecl.php.net/rest/r/'
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
@ -55,7 +55,7 @@ get_pecl_version() {
# Function to install a PECL version
add_pecl_extension() {
extension=$1
local extension=$1
pecl_version=$2
prefix=$3
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
@ -95,7 +95,7 @@ add_brew_tap() {
if ! [ -d "$tap_dir/$tap" ]; then
fetch_brew_tap "$tap" >/dev/null 2>&1
if ! [ -d "$tap_dir/$tap" ]; then
brew tap --shallow "$tap" >/dev/null 2>&1
brew tap "$tap" >/dev/null 2>&1
fi
fi
}
@ -103,7 +103,8 @@ add_brew_tap() {
# Function to install a php extension from shivammathur/extensions tap.
add_brew_extension() {
formula=$1
extension=${formula//[0-9]/}
extension=$(grep "$formula=" "$dist"/../src/configs/brew_extensions | cut -d '=' -f 2)
[[ -z "$extension" ]] && extension="$(echo "$formula" | sed -E "s/pecl_|[0-9]//g")"
add_brew_tap shivammathur/homebrew-php
add_brew_tap shivammathur/homebrew-extensions
sudo mv "$tap_dir"/shivammathur/homebrew-extensions/.github/deps/"$formula"/* "$tap_dir/homebrew/homebrew-core/Formula/" 2>/dev/null || true
@ -113,7 +114,7 @@ add_brew_extension() {
# Function to setup extensions
add_extension() {
extension=$1
local extension=$1
install_command=$2
prefix=$3
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
@ -131,7 +132,7 @@ add_extension() {
# Function to pre-release extensions using PECL
add_unstable_extension() {
extension=$1
local extension=$1
stability=$2
prefix=$3
pecl_version=$(get_pecl_version "$extension" "$stability")
@ -311,6 +312,7 @@ brew_repo="$(brew --repository)"
tap_dir="$brew_repo"/Library/Taps
existing_version=$(get_brewed_php)
export HOMEBREW_CHANGE_ARCH_TO_ARM=1
export HOMEBREW_DEVELOPER=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1

View File

@ -20,7 +20,7 @@ update_ppa() {
# Function to install phalcon
install_phalcon() {
extension=$1
local extension=$1
version=$2
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-psr" "php$version-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"

View File

@ -62,7 +62,7 @@ configure_pecl() {
# Function to get the PECL version
get_pecl_version() {
extension=$1
local extension=$1
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
pecl_rest='https://pecl.php.net/rest/r/'
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
@ -89,7 +89,7 @@ enable_extension() {
# Function to test if extension is loaded
check_extension() {
extension=$1
local extension=$1
if [ "$extension" != "mysql" ]; then
php -m | grep -i -q -w "$extension"
else
@ -99,7 +99,7 @@ check_extension() {
# Function to delete extensions
delete_extension() {
extension=$1
local extension=$1
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$ini_file"
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$pecl_file"
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
@ -109,7 +109,7 @@ delete_extension() {
# Function to disable and delete extensions
remove_extension() {
extension=$1
local extension=$1
if [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
sudo phpdismod -v "$version" "$extension"
fi
@ -118,7 +118,7 @@ remove_extension() {
# Function to setup extensions
add_extension() {
extension=$1
local extension=$1
install_command=$2
prefix=$3
enable_extension "$extension" "$prefix"
@ -135,7 +135,7 @@ add_extension() {
# Function to install a PECL version
add_pecl_extension() {
extension=$1
local extension=$1
pecl_version=$2
prefix=$3
configure_pecl
@ -158,7 +158,7 @@ add_pecl_extension() {
# Function to pre-release extensions using PECL
add_unstable_extension() {
extension=$1
local extension=$1
stability=$2
prefix=$3
pecl_version=$(get_pecl_version "$extension" "$stability")
@ -313,7 +313,7 @@ cross="✗"
version=$1
dist=$2
debconf_fix="DEBIAN_FRONTEND=noninteractive"
apt_install="sudo $debconf_fix apt-fast install -y"
apt_install="sudo $debconf_fix apt-fast install -y --no-install-recommends"
tool_path_dir="/usr/local/bin"
curl_opts=(-sL)
composer_home="$HOME/.composer"

View File

@ -46,13 +46,13 @@ Function Add-ToProfile {
Function Add-Printf {
if (-not(Test-Path "C:\Program Files\Git\usr\bin\printf.exe")) {
if(Test-Path "C:\msys64\usr\bin\printf.exe") {
New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe
New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe -Force > $null 2>&1
} else {
Invoke-WebRequest -UseBasicParsing -Uri "$github/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$php_dir\printf.zip"
Expand-Archive -Path $php_dir\printf.zip -DestinationPath $php_dir -Force
}
} else {
New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value "C:\Program Files\Git\usr\bin\printf.exe"
New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value "C:\Program Files\Git\usr\bin\printf.exe" -Force > $null 2>&1
}
}
@ -277,7 +277,6 @@ $github = 'https://github.com'
$composer_bin = "$env:APPDATA\Composer\vendor\bin"
$composer_json = "$env:APPDATA\Composer\composer.json"
$composer_lock = "$env:APPDATA\Composer\composer.lock"
$master_version = '8.0'
$arch = 'x64'
if(-not([Environment]::Is64BitOperatingSystem) -or $version -lt '7.0') {
$arch = 'x86'
@ -308,13 +307,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" Get-VcList >$null 2>&1
}
try {
if ($version -eq $master_version) {
$version = 'master'
Invoke-WebRequest -UseBasicParsing -Uri https://github.com/shivammathur/php-builder-windows/releases/latest/download/Get-Php.ps1 -OutFile $php_dir\Get-Php.ps1 > $null 2>&1
& $php_dir\Get-Php.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir
} else {
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
}
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
} catch { }
} else {
$status = "Found"
@ -329,5 +322,5 @@ if($installed.MajorMinorVersion -ne $version) {
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
Copy-Item -Path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
New-Item -ItemType Directory -Path $composer_bin -Force 2>&1 | Out-Null
New-Item -ItemType Directory -Path $composer_bin -Force > $null 2>&1
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"

View File

@ -119,6 +119,9 @@ export async function addPhive(
case /7\.1/.test(php_version):
version = version.replace('latest', '0.13.5');
break;
case /7\.2/.test(php_version):
version = version.replace('latest', '0.14.5');
break;
}
switch (version) {
case 'latest':

View File

@ -10,13 +10,16 @@ import * as core from '@actions/core';
* @param property
*/
export async function readEnv(property: string): Promise<string> {
const value = process.env[property];
switch (value) {
case undefined:
return '';
default:
return value;
}
const property_lc: string = property.toLowerCase();
const property_uc: string = property.toUpperCase();
return (
process.env[property] ||
process.env[property_lc] ||
process.env[property_uc] ||
process.env[property_lc.replace('_', '-')] ||
process.env[property_uc.replace('_', '-')] ||
''
);
}
/**

View File

@ -1,8 +1,9 @@
{
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"lib": [
"ESNext"
"ES2020"
],
"module": "commonjs",
"moduleResolution": "node",
@ -12,7 +13,7 @@
"rootDir": "./src",
"sourceMap": true,
"strict": true,
"target": "ESNext"
"target": "ES2019"
},
"exclude": ["__tests__", "lib", "node_modules"]
}
}