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
c43f842cf3
commit
6cba0a914f
@ -1,24 +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(1);
|
||||
});
|
||||
|
||||
it('Test 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);
|
||||
});
|
||||
});
|
44
dist/index.js
vendored
44
dist/index.js
vendored
@ -977,48 +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', 'phpunit.json');
|
||||
const runner_dir = await utils.getInput('RUNNER_TOOL_CACHE', false);
|
||||
await io.cp(config_path, runner_dir);
|
||||
}
|
||||
exports.addMatchers = addMatchers;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 87:
|
||||
@ -2419,7 +2377,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
|
||||
*
|
||||
@ -2480,7 +2437,6 @@ async function run() {
|
||||
await exec_1.exec('pwsh ' + script_path + ' ' + version + ' ' + __dirname);
|
||||
break;
|
||||
}
|
||||
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
|
||||
@ -79,7 +78,6 @@ export async function run(): Promise<void> {
|
||||
await exec('pwsh ' + script_path + ' ' + version + ' ' + __dirname);
|
||||
break;
|
||||
}
|
||||
await matchers.addMatchers();
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
|
@ -1,18 +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',
|
||||
'phpunit.json'
|
||||
);
|
||||
const runner_dir: string = await utils.getInput('RUNNER_TOOL_CACHE', false);
|
||||
await io.cp(config_path, runner_dir);
|
||||
}
|
@ -204,6 +204,7 @@ setup_php() {
|
||||
tick="✓"
|
||||
cross="✗"
|
||||
version=$1
|
||||
dist=$2
|
||||
tool_path_dir="/usr/local/bin"
|
||||
curl_opts=(-sL)
|
||||
existing_version=$(php-config --version 2>/dev/null | cut -c 1-3)
|
||||
@ -224,4 +225,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 ' ')
|
||||
configure_pecl
|
||||
sudo mv "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||
add_log "$tick" "PHP" "$status PHP $semver"
|
||||
|
@ -254,6 +254,7 @@ cross="✗"
|
||||
lists_updated="false"
|
||||
pecl_config="false"
|
||||
version=$1
|
||||
dist=$2
|
||||
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
||||
apt_install="sudo $debconf_fix apt-fast install -y"
|
||||
tool_path_dir="/usr/local/bin"
|
||||
@ -298,4 +299,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 Step-Log($message) {
|
||||
@ -285,4 +285,5 @@ Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir
|
||||
Set-PhpIniKey -Key 'memory_limit' -Value '-1' -Path $php_dir
|
||||
Enable-PhpExtension -Extension openssl, curl, opcache, mbstring -Path $php_dir
|
||||
Update-PhpCAInfo -Path $php_dir -Source CurrentUser
|
||||
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