mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Move matchers setup to scripts
This commit is contained in:
parent
ad196941ed
commit
9e663851ce
@ -1,41 +0,0 @@
|
||||
import * as io from '@actions/io';
|
||||
import * as matchers from '../src/matchers';
|
||||
|
||||
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(2);
|
||||
});
|
||||
|
||||
it('Test PHPUnit Regex', async () => {
|
||||
const regex1 = /^\d+\)\s.*$/;
|
||||
const regex2 = /^(.*Failed\sasserting\sthat.*)$/;
|
||||
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);
|
||||
});
|
||||
|
||||
it('Test PHP Regex', async () => {
|
||||
const regex1 = /^(.*error):\s+\s+(.+) in (.+) on line (\d+)$/;
|
||||
const regex2 = /^(.*Warning|.*Deprecated|.*Notice):\s+\s+(.+) in (.+) on line (\d+)$/;
|
||||
expect(
|
||||
regex1.test('PHP Parse error: error_message in file.php on line 10')
|
||||
).toBe(true);
|
||||
expect(
|
||||
regex2.test('PHP Notice: info_message in file.php on line 10')
|
||||
).toBe(true);
|
||||
expect(
|
||||
regex2.test('PHP Warning: warning_message in file.php on line 10')
|
||||
).toBe(true);
|
||||
expect(
|
||||
regex2.test('PHP Deprecated: deprecated_message in file.php on line 10')
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
45
dist/index.js
vendored
45
dist/index.js
vendored
@ -977,49 +977,6 @@ function toCommandValue(input) {
|
||||
exports.toCommandValue = toCommandValue;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 86:
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
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.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.addMatchers = void 0;
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const utils = __importStar(__webpack_require__(163));
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
/**
|
||||
* Cache json files for problem matchers
|
||||
*/
|
||||
async function addMatchers() {
|
||||
const config_path = path.join(__dirname, '..', 'src', 'configs');
|
||||
const runner_dir = await utils.getInput('RUNNER_TOOL_CACHE', false);
|
||||
await io.cp(path.join(config_path, 'phpunit.json'), runner_dir);
|
||||
await io.cp(path.join(config_path, 'php.json'), runner_dir);
|
||||
}
|
||||
exports.addMatchers = addMatchers;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 87:
|
||||
@ -2578,7 +2535,6 @@ const coverage = __importStar(__webpack_require__(635));
|
||||
const extensions = __importStar(__webpack_require__(911));
|
||||
const tools = __importStar(__webpack_require__(534));
|
||||
const utils = __importStar(__webpack_require__(163));
|
||||
const matchers = __importStar(__webpack_require__(86));
|
||||
/**
|
||||
* Build the script
|
||||
*
|
||||
@ -2624,7 +2580,6 @@ async function run() {
|
||||
const script = os_version + (await utils.scriptExtension(os_version));
|
||||
const location = await getScript(script, version, os_version);
|
||||
await exec_1.exec(await utils.joins(tool, location, version, __dirname));
|
||||
await matchers.addMatchers();
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
|
@ -5,7 +5,6 @@ import * as coverage from './coverage';
|
||||
import * as extensions from './extensions';
|
||||
import * as tools from './tools';
|
||||
import * as utils from './utils';
|
||||
import * as matchers from './matchers';
|
||||
|
||||
/**
|
||||
* Build the script
|
||||
@ -62,7 +61,6 @@ export async function run(): Promise<void> {
|
||||
const script = os_version + (await utils.scriptExtension(os_version));
|
||||
const location = await getScript(script, version, os_version);
|
||||
await exec(await utils.joins(tool, location, version, __dirname));
|
||||
await matchers.addMatchers();
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
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');
|
||||
const runner_dir: string = await utils.getInput('RUNNER_TOOL_CACHE', false);
|
||||
await io.cp(path.join(config_path, 'phpunit.json'), runner_dir);
|
||||
await io.cp(path.join(config_path, 'php.json'), runner_dir);
|
||||
}
|
@ -267,6 +267,7 @@ setup_php() {
|
||||
tick="✓"
|
||||
cross="✗"
|
||||
version=$1
|
||||
dist=$2
|
||||
nodot_version=${1/./}
|
||||
old_versions="5.[3-5]"
|
||||
tool_path_dir="/usr/local/bin"
|
||||
@ -305,4 +306,5 @@ scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||
sudo mkdir -p "$ext_dir"
|
||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
||||
if [[ ! "$version" =~ $old_versions ]]; then configure_pecl >/dev/null 2>&1; fi
|
||||
sudo mv "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||
add_log "$tick" "PHP" "$status PHP $semver"
|
||||
|
@ -422,6 +422,7 @@ tick="✓"
|
||||
cross="✗"
|
||||
pecl_config="false"
|
||||
version=$1
|
||||
dist=$2
|
||||
master_version="8.0"
|
||||
old_versions="5.[3-5]"
|
||||
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||
@ -477,4 +478,5 @@ pecl_file="$scan_dir"/99-pecl.ini
|
||||
echo '' | sudo tee "$pecl_file" >/dev/null 2>&1
|
||||
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
|
||||
sudo chmod 777 "$ini_file" "$pecl_file" "$tool_path_dir"
|
||||
sudo mv "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||
add_log "$tick" "PHP" "$status PHP $semver"
|
||||
|
@ -8,7 +8,7 @@ param (
|
||||
[ValidateNotNull()]
|
||||
[ValidateLength(1, [int]::MaxValue)]
|
||||
[string]
|
||||
$dir
|
||||
$dist
|
||||
)
|
||||
|
||||
# Function to log start of a operation.
|
||||
@ -393,4 +393,5 @@ if($version -lt "5.5") {
|
||||
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
|
||||
}
|
||||
Update-PhpCAInfo -Path $php_dir -Source $cert_source
|
||||
Move-Item -path $dist\..\src\configs\*.json -Destination $env:RUNNER_TOOL_CACHE
|
||||
Add-Log $tick "PHP" "$status PHP $($installed.FullVersion)"
|
||||
|
Loading…
Reference in New Issue
Block a user