Bump version to 1.11.2

Update Node.js dependencies

Fix replacing v prefix in tool version

Use shivammathur/extensions tap for rdkafka on macOS

Update Ubuntu 16.04 warning in install.ts

Add patch for PCRE2
This commit is contained in:
Shivam Mathur 2021-07-13 15:13:18 +05:30
parent 32c1436247
commit fec64d1788
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
8 changed files with 1847 additions and 1639 deletions

View File

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

294
dist/index.js vendored
View File

@ -230,7 +230,7 @@ async function addExtensionDarwin(extension_csv, version) {
' ' + ' ' +
ext_prefix; ext_prefix;
return; return;
case /(5\.6|7\.[0-4]|8.0)(amqp|grpc|igbinary|imagick|imap|msgpack|^(pecl_)?http$|propro|protobuf|psr|raphf|redis|swoole|xdebug|xdebug2|zmq)/.test(version_extension): 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 /(7\.[1-4]|8\.0])pcov/.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 /^(5\.6|7\.[0-3])phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
command = 'add_brew_extension ' + extension_name.replace('pecl_', ''); command = 'add_brew_extension ' + extension_name.replace('pecl_', '');
@ -445,7 +445,7 @@ async function run() {
return; return;
} }
if ((await utils.readEnv('ImageOS')) == 'ubuntu16') { if ((await utils.readEnv('ImageOS')) == 'ubuntu16') {
core.warning('Ubuntu 16.04 is deprecated.\nPlease upgrade to Ubuntu 18.04 or Ubuntu 20.04 - https://setup-php.com/i/452'); core.warning('setup-php will stop working on Ubuntu 16.04 from August 1, 2021. Please upgrade to Ubuntu 18.04 or Ubuntu 20.04 - https://setup-php.com/i/452');
} }
if (version) { if (version) {
const os_version = process.platform; const os_version = process.platform;
@ -520,8 +520,8 @@ async function getCommand(os_version, suffix) {
exports.getCommand = getCommand; exports.getCommand = getCommand;
async function getToolVersion(version) { async function getToolVersion(version) {
const semver_regex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; const semver_regex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/; const composer_regex = /^stable$|^preview$|^snapshot$|^[1|2]$/;
version = version.replace(/[><=^]*/, ''); version = version.replace(/[><=^]*/, '').replace(/^v(\d)/, '$1');
switch (true) { switch (true) {
case composer_regex.test(version): case composer_regex.test(version):
case semver_regex.test(version): case semver_regex.test(version):
@ -1132,7 +1132,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}); });
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); 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.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; 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;
const command_1 = __nccwpck_require__(241); const command_1 = __nccwpck_require__(241);
const file_command_1 = __nccwpck_require__(717); const file_command_1 = __nccwpck_require__(717);
const utils_1 = __nccwpck_require__(278); const utils_1 = __nccwpck_require__(278);
@ -1218,6 +1218,21 @@ function getInput(name, options) {
return val.trim(); return val.trim();
} }
exports.getInput = getInput; exports.getInput = getInput;
/**
* Gets the values of an multiline input. Each value is also trimmed.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns string[]
*
*/
function getMultilineInput(name, options) {
const inputs = getInput(name, options)
.split('\n')
.filter(x => x !== '');
return inputs;
}
exports.getMultilineInput = getMultilineInput;
/** /**
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
* Support boolean input list: `true | True | TRUE | false | False | FALSE` . * Support boolean input list: `true | True | TRUE | false | False | FALSE` .
@ -1462,6 +1477,25 @@ exports.toCommandValue = toCommandValue;
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -1471,14 +1505,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getExecOutput = exports.exec = void 0;
const string_decoder_1 = __nccwpck_require__(304);
const tr = __importStar(__nccwpck_require__(159)); const tr = __importStar(__nccwpck_require__(159));
/** /**
* Exec a command. * Exec a command.
@ -1504,6 +1533,51 @@ function exec(commandLine, args, options) {
}); });
} }
exports.exec = exec; exports.exec = exec;
/**
* Exec a command and get the output.
* Output will be streamed to the live console.
* Returns promise with the exit code and collected stdout and stderr
*
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
* @param args optional arguments for tool. Escaping is handled by the lib.
* @param options optional exec options. See ExecOptions
* @returns Promise<ExecOutput> exit code, stdout, and stderr
*/
function getExecOutput(commandLine, args, options) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
let stdout = '';
let stderr = '';
//Using string decoder covers the case where a mult-byte character is split
const stdoutDecoder = new string_decoder_1.StringDecoder('utf8');
const stderrDecoder = new string_decoder_1.StringDecoder('utf8');
const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout;
const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr;
const stdErrListener = (data) => {
stderr += stderrDecoder.write(data);
if (originalStdErrListener) {
originalStdErrListener(data);
}
};
const stdOutListener = (data) => {
stdout += stdoutDecoder.write(data);
if (originalStdoutListener) {
originalStdoutListener(data);
}
};
const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener });
const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners }));
//flush any remaining characters
stdout += stdoutDecoder.end();
stderr += stderrDecoder.end();
return {
exitCode,
stdout,
stderr
};
});
}
exports.getExecOutput = getExecOutput;
//# sourceMappingURL=exec.js.map //# sourceMappingURL=exec.js.map
/***/ }), /***/ }),
@ -1512,6 +1586,25 @@ exports.exec = exec;
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -1521,20 +1614,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.argStringToArray = exports.ToolRunner = void 0;
const os = __importStar(__nccwpck_require__(87)); const os = __importStar(__nccwpck_require__(87));
const events = __importStar(__nccwpck_require__(614)); const events = __importStar(__nccwpck_require__(614));
const child = __importStar(__nccwpck_require__(129)); const child = __importStar(__nccwpck_require__(129));
const path = __importStar(__nccwpck_require__(622)); const path = __importStar(__nccwpck_require__(622));
const io = __importStar(__nccwpck_require__(351)); const io = __importStar(__nccwpck_require__(351));
const ioUtil = __importStar(__nccwpck_require__(962)); const ioUtil = __importStar(__nccwpck_require__(962));
const timers_1 = __nccwpck_require__(213);
/* eslint-disable @typescript-eslint/unbound-method */ /* eslint-disable @typescript-eslint/unbound-method */
const IS_WINDOWS = process.platform === 'win32'; const IS_WINDOWS = process.platform === 'win32';
/* /*
@ -1604,11 +1692,12 @@ class ToolRunner extends events.EventEmitter {
s = s.substring(n + os.EOL.length); s = s.substring(n + os.EOL.length);
n = s.indexOf(os.EOL); n = s.indexOf(os.EOL);
} }
strBuffer = s; return s;
} }
catch (err) { catch (err) {
// streaming lines to console is best effort. Don't fail a build. // streaming lines to console is best effort. Don't fail a build.
this._debug(`error processing line. Failed with error ${err}`); this._debug(`error processing line. Failed with error ${err}`);
return '';
} }
} }
_getSpawnFileName() { _getSpawnFileName() {
@ -1890,7 +1979,7 @@ class ToolRunner extends events.EventEmitter {
// if the tool is only a file name, then resolve it from the PATH // if the tool is only a file name, then resolve it from the PATH
// otherwise verify it exists (add extension on Windows if necessary) // otherwise verify it exists (add extension on Windows if necessary)
this.toolPath = yield io.which(this.toolPath, true); this.toolPath = yield io.which(this.toolPath, true);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
this._debug(`exec tool: ${this.toolPath}`); this._debug(`exec tool: ${this.toolPath}`);
this._debug('arguments:'); this._debug('arguments:');
for (const arg of this.args) { for (const arg of this.args) {
@ -1904,9 +1993,12 @@ class ToolRunner extends events.EventEmitter {
state.on('debug', (message) => { state.on('debug', (message) => {
this._debug(message); this._debug(message);
}); });
if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) {
return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`));
}
const fileName = this._getSpawnFileName(); const fileName = this._getSpawnFileName();
const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName)); const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
const stdbuffer = ''; let stdbuffer = '';
if (cp.stdout) { if (cp.stdout) {
cp.stdout.on('data', (data) => { cp.stdout.on('data', (data) => {
if (this.options.listeners && this.options.listeners.stdout) { if (this.options.listeners && this.options.listeners.stdout) {
@ -1915,14 +2007,14 @@ class ToolRunner extends events.EventEmitter {
if (!optionsNonNull.silent && optionsNonNull.outStream) { if (!optionsNonNull.silent && optionsNonNull.outStream) {
optionsNonNull.outStream.write(data); optionsNonNull.outStream.write(data);
} }
this._processLineBuffer(data, stdbuffer, (line) => { stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => {
if (this.options.listeners && this.options.listeners.stdline) { if (this.options.listeners && this.options.listeners.stdline) {
this.options.listeners.stdline(line); this.options.listeners.stdline(line);
} }
}); });
}); });
} }
const errbuffer = ''; let errbuffer = '';
if (cp.stderr) { if (cp.stderr) {
cp.stderr.on('data', (data) => { cp.stderr.on('data', (data) => {
state.processStderr = true; state.processStderr = true;
@ -1937,7 +2029,7 @@ class ToolRunner extends events.EventEmitter {
: optionsNonNull.outStream; : optionsNonNull.outStream;
s.write(data); s.write(data);
} }
this._processLineBuffer(data, errbuffer, (line) => { errbuffer = this._processLineBuffer(data, errbuffer, (line) => {
if (this.options.listeners && this.options.listeners.errline) { if (this.options.listeners && this.options.listeners.errline) {
this.options.listeners.errline(line); this.options.listeners.errline(line);
} }
@ -1984,7 +2076,7 @@ class ToolRunner extends events.EventEmitter {
} }
cp.stdin.end(this.options.input); cp.stdin.end(this.options.input);
} }
}); }));
}); });
} }
} }
@ -2070,7 +2162,7 @@ class ExecState extends events.EventEmitter {
this._setResult(); this._setResult();
} }
else if (this.processExited) { else if (this.processExited) {
this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this); this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this);
} }
} }
_debug(message) { _debug(message) {
@ -2118,6 +2210,25 @@ class ExecState extends events.EventEmitter {
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -2127,16 +2238,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var _a; var _a;
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
const assert_1 = __nccwpck_require__(357); exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
const fs = __importStar(__nccwpck_require__(747)); const fs = __importStar(__nccwpck_require__(747));
const path = __importStar(__nccwpck_require__(622)); const path = __importStar(__nccwpck_require__(622));
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; _a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
@ -2179,49 +2283,6 @@ function isRooted(p) {
return p.startsWith('/'); return p.startsWith('/');
} }
exports.isRooted = isRooted; exports.isRooted = isRooted;
/**
* Recursively create a directory at `fsPath`.
*
* This implementation is optimistic, meaning it attempts to create the full
* path first, and backs up the path stack from there.
*
* @param fsPath The path to create
* @param maxDepth The maximum recursion depth
* @param depth The current recursion depth
*/
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
return __awaiter(this, void 0, void 0, function* () {
assert_1.ok(fsPath, 'a path argument must be provided');
fsPath = path.resolve(fsPath);
if (depth >= maxDepth)
return exports.mkdir(fsPath);
try {
yield exports.mkdir(fsPath);
return;
}
catch (err) {
switch (err.code) {
case 'ENOENT': {
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
yield exports.mkdir(fsPath);
return;
}
default: {
let stats;
try {
stats = yield exports.stat(fsPath);
}
catch (err2) {
throw err;
}
if (!stats.isDirectory())
throw err;
}
}
}
});
}
exports.mkdirP = mkdirP;
/** /**
* Best effort attempt to determine whether a file exists and is executable. * Best effort attempt to determine whether a file exists and is executable.
* @param filePath file path to check * @param filePath file path to check
@ -2318,6 +2379,12 @@ function isUnixExecutable(stats) {
((stats.mode & 8) > 0 && stats.gid === process.getgid()) || ((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
((stats.mode & 64) > 0 && stats.uid === process.getuid())); ((stats.mode & 64) > 0 && stats.uid === process.getuid()));
} }
// Get the path of cmd.exe in windows
function getCmdPath() {
var _a;
return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`;
}
exports.getCmdPath = getCmdPath;
//# sourceMappingURL=io-util.js.map //# sourceMappingURL=io-util.js.map
/***/ }), /***/ }),
@ -2326,6 +2393,25 @@ function isUnixExecutable(stats) {
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -2335,19 +2421,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
const assert_1 = __nccwpck_require__(357);
const childProcess = __importStar(__nccwpck_require__(129)); const childProcess = __importStar(__nccwpck_require__(129));
const path = __importStar(__nccwpck_require__(622)); const path = __importStar(__nccwpck_require__(622));
const util_1 = __nccwpck_require__(669); const util_1 = __nccwpck_require__(669);
const ioUtil = __importStar(__nccwpck_require__(962)); const ioUtil = __importStar(__nccwpck_require__(962));
const exec = util_1.promisify(childProcess.exec); const exec = util_1.promisify(childProcess.exec);
const execFile = util_1.promisify(childProcess.execFile);
/** /**
* Copies a file or folder. * Copies a file or folder.
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
@ -2358,14 +2440,14 @@ const exec = util_1.promisify(childProcess.exec);
*/ */
function cp(source, dest, options = {}) { function cp(source, dest, options = {}) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const { force, recursive } = readCopyOptions(options); const { force, recursive, copySourceDirectory } = readCopyOptions(options);
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null; const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
// Dest is an existing file, but not forcing // Dest is an existing file, but not forcing
if (destStat && destStat.isFile() && !force) { if (destStat && destStat.isFile() && !force) {
return; return;
} }
// If dest is an existing directory, should copy inside. // If dest is an existing directory, should copy inside.
const newDest = destStat && destStat.isDirectory() const newDest = destStat && destStat.isDirectory() && copySourceDirectory
? path.join(dest, path.basename(source)) ? path.join(dest, path.basename(source))
: dest; : dest;
if (!(yield ioUtil.exists(source))) { if (!(yield ioUtil.exists(source))) {
@ -2430,12 +2512,22 @@ function rmRF(inputPath) {
if (ioUtil.IS_WINDOWS) { if (ioUtil.IS_WINDOWS) {
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del. // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
// Check for invalid characters
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
if (/[*"<>|]/.test(inputPath)) {
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
}
try { try {
const cmdPath = ioUtil.getCmdPath();
if (yield ioUtil.isDirectory(inputPath, true)) { if (yield ioUtil.isDirectory(inputPath, true)) {
yield exec(`rd /s /q "${inputPath}"`); yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
env: { inputPath }
});
} }
else { else {
yield exec(`del /f /a "${inputPath}"`); yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
env: { inputPath }
});
} }
} }
catch (err) { catch (err) {
@ -2468,7 +2560,7 @@ function rmRF(inputPath) {
return; return;
} }
if (isDir) { if (isDir) {
yield exec(`rm -rf "${inputPath}"`); yield execFile(`rm`, [`-rf`, `${inputPath}`]);
} }
else { else {
yield ioUtil.unlink(inputPath); yield ioUtil.unlink(inputPath);
@ -2486,7 +2578,8 @@ exports.rmRF = rmRF;
*/ */
function mkdirP(fsPath) { function mkdirP(fsPath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
yield ioUtil.mkdirP(fsPath); assert_1.ok(fsPath, 'a path argument must be provided');
yield ioUtil.mkdir(fsPath, { recursive: true });
}); });
} }
exports.mkdirP = mkdirP; exports.mkdirP = mkdirP;
@ -2584,7 +2677,10 @@ exports.findInPath = findInPath;
function readCopyOptions(options) { function readCopyOptions(options) {
const force = options.force == null ? true : options.force; const force = options.force == null ? true : options.force;
const recursive = Boolean(options.recursive); const recursive = Boolean(options.recursive);
return { force, recursive }; const copySourceDirectory = options.copySourceDirectory == null
? true
: Boolean(options.copySourceDirectory);
return { force, recursive, copySourceDirectory };
} }
function cpDirRecursive(sourceDir, destDir, currentDepth, force) { function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
@ -2689,6 +2785,20 @@ module.exports = require("path");;
/***/ }), /***/ }),
/***/ 304:
/***/ ((module) => {
module.exports = require("string_decoder");;
/***/ }),
/***/ 213:
/***/ ((module) => {
module.exports = require("timers");;
/***/ }),
/***/ 669: /***/ 669:
/***/ ((module) => { /***/ ((module) => {

3137
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "1.11.1", "version": "1.11.2",
"private": false, "private": false,
"description": "Setup PHP for use with GitHub Actions", "description": "Setup PHP for use with GitHub Actions",
"main": "lib/install.js", "main": "lib/install.js",
@ -24,28 +24,28 @@
"author": "shivammathur", "author": "shivammathur",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.3.0", "@actions/core": "^1.4.0",
"@actions/exec": "^1.0.4", "@actions/exec": "^1.1.0",
"@actions/io": "^1.1.0", "@actions/io": "^1.1.1",
"fs": "0.0.1-security" "fs": "0.0.1-security"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^26.0.23", "@types/jest": "^26.0.24",
"@types/node": "^15.6.1", "@types/node": "^16.3.1",
"@typescript-eslint/eslint-plugin": "^4.25.0", "@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.25.0", "@typescript-eslint/parser": "^4.28.3",
"@vercel/ncc": "^0.28.6", "@vercel/ncc": "^0.28.6",
"eslint": "^7.27.0", "eslint": "^7.30.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4", "eslint-plugin-import": "^2.23.4",
"eslint-plugin-jest": "^24.3.6", "eslint-plugin-jest": "^24.3.6",
"eslint-plugin-prettier": "^3.4.0", "eslint-plugin-prettier": "^3.4.0",
"husky": "^4.3.8", "husky": "^4.3.8",
"jest": "^27.0.3", "jest": "^27.0.6",
"jest-circus": "^27.0.3", "jest-circus": "^27.0.6",
"prettier": "^2.3.0", "prettier": "^2.3.2",
"ts-jest": "^27.0.1", "ts-jest": "^27.0.3",
"typescript": "^4.3.2" "typescript": "^4.3.5"
}, },
"husky": { "husky": {
"skipCI": true, "skipCI": true,

View File

@ -30,9 +30,9 @@ export async function addExtensionDarwin(
' ' + ' ' +
ext_prefix; ext_prefix;
return; return;
// match 5.6 to 8.0 amqp, grpc, igbinary, imagick, imap, msgpack, pecl_http, propro, protobuf, raphf, redis, swoole, xdebug, xdebug2, zmq // match 5.6 to 8.0 amqp, grpc, igbinary, imagick, imap, msgpack, pecl_http, propro, protobuf, raphf, rdkafka, redis, swoole, xdebug, xdebug2, zmq
// match 7.1pcov to 8.0pcov // 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|redis|swoole|xdebug|xdebug2|zmq)/.test( 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 version_extension
): ):
case /(7\.[1-4]|8\.0])pcov/.test(version_extension): case /(7\.[1-4]|8\.0])pcov/.test(version_extension):

View File

@ -69,7 +69,7 @@ export async function run(): Promise<void> {
} }
if ((await utils.readEnv('ImageOS')) == 'ubuntu16') { if ((await utils.readEnv('ImageOS')) == 'ubuntu16') {
core.warning( core.warning(
'Ubuntu 16.04 is deprecated.\nPlease upgrade to Ubuntu 18.04 or Ubuntu 20.04 - https://setup-php.com/i/452' 'setup-php will stop working on Ubuntu 16.04 from August 1, 2021. Please upgrade to Ubuntu 18.04 or Ubuntu 20.04 - https://setup-php.com/i/452'
); );
} }
if (version) { if (version) {

View File

@ -316,6 +316,10 @@ if [ "$existing_version" != "$version" ]; then
status="Installed" status="Installed"
else else
status="Found" status="Found"
# Remove when PCRE2 on macOS images is updated to the patched PCRE2 10.37
add_brew_tap shivammathur/homebrew-php
update_dependencies
brew reinstall pcre2 >/dev/null 2>&1
fi fi
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")
sudo chmod 777 "$ini_file" "$tool_path_dir" sudo chmod 777 "$ini_file" "$tool_path_dir"

View File

@ -34,8 +34,8 @@ export async function getToolVersion(version: string): Promise<string> {
// semver_regex - https://semver.org/ // semver_regex - https://semver.org/
const semver_regex = const semver_regex =
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/; const composer_regex = /^stable$|^preview$|^snapshot$|^[1|2]$/;
version = version.replace(/[><=^]*/, ''); version = version.replace(/[><=^]*/, '').replace(/^v(\d)/, '$1');
switch (true) { switch (true) {
case composer_regex.test(version): case composer_regex.test(version):
case semver_regex.test(version): case semver_regex.test(version):