mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 03:41:06 +07:00
Add support for jolicode/castor
This commit is contained in:
parent
4bd44f22a9
commit
7ce22e0264
@ -224,7 +224,7 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
|
||||
|
||||
These tools can be set up globally using the `tools` input. It accepts a string in csv-format.
|
||||
|
||||
[`behat`], [`blackfire`], [`blackfire-player`], [`churn`], [`codeception`], [`composer`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`flex`], [`grpc_php_plugin`], [`infection`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
|
||||
[`behat`], [`blackfire`], [`blackfire-player`], [`castor`], [`churn`], [`codeception`], [`composer`], [`composer-normalize`], [`composer-prefetcher`], [`composer-require-checker`], [`composer-unused`], [`cs2pr`], [`deployer`], [`flex`], [`grpc_php_plugin`], [`infection`], [`parallel-lint`], [`pecl`], [`phan`], [`phing`], [`phinx`], [`phive`], [`php-config`], [`php-cs-fixer`], [`phpcbf`], [`phpcpd`], [`phpcs`], [`phpdoc`] or [`phpDocumentor`], [`phpize`], [`phplint`], [`phpmd`], [`phpspec`], [`phpstan`], [`phpunit`], [`phpunit-bridge`], [`phpunit-polyfills`], [`pint`], [`prestissimo`], [`protoc`], [`psalm`], [`rector`], [`symfony`] or [`symfony-cli`], [`vapor`] or [`vapor-cli`], [`wp`] or [`wp-cli`]
|
||||
|
||||
```yaml
|
||||
- name: Setup PHP with tools
|
||||
@ -1028,6 +1028,7 @@ These companies generously provide setup-php their products and services to aid
|
||||
[`behat`]: https://docs.behat.org/en/latest/
|
||||
[`blackfire`]: https://blackfire.io/docs/php/index
|
||||
[`blackfire-player`]: https://blackfire.io/docs/builds-cookbooks/player
|
||||
[`castor`]: https://github.com/jolicode/castor
|
||||
[`churn`]: https://github.com/bmitch/churn-php
|
||||
[`codeception`]: https://codeception.com/
|
||||
[`composer`]: https://getcomposer.org/
|
||||
|
@ -526,6 +526,25 @@ describe('Tools tests', () => {
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
version | os | uri
|
||||
${'latest'} | ${'linux'} | ${'releases/latest/download/castor.linux-amd64.phar'}
|
||||
${'0.5.1'} | ${'linux'} | ${'releases/download/v0.5.1/castor.linux-amd64.phar'}
|
||||
${'latest'} | ${'darwin'} | ${'releases/latest/download/castor.darwin-amd64.phar'}
|
||||
${'0.5.1'} | ${'darwin'} | ${'releases/download/v0.5.1/castor.darwin-amd64.phar'}
|
||||
${'latest'} | ${'win32'} | ${'releases/latest/download/castor.windows-amd64.phar'}
|
||||
${'0.5.1'} | ${'win32'} | ${'releases/download/v0.5.1/castor.windows-amd64.phar'}
|
||||
${'latest'} | ${'openbsd'} | ${'Platform openbsd is not supported'}
|
||||
`('checking addCastor: $version, $os', async ({version, os, uri}) => {
|
||||
const data = getData({
|
||||
tool: 'castor',
|
||||
php_version: '8.1',
|
||||
version: version,
|
||||
os: os
|
||||
});
|
||||
expect(await tools.addCastor(data)).toContain(uri);
|
||||
});
|
||||
|
||||
it.each`
|
||||
tools_csv | script
|
||||
${'none'} | ${''}
|
||||
|
26
dist/index.js
vendored
26
dist/index.js
vendored
@ -682,7 +682,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.addTools = exports.functionRecord = exports.getData = exports.addWPCLI = exports.addPHPUnitTools = exports.addPhive = exports.addPhing = exports.addPECL = exports.addDevTools = exports.addDeployer = exports.addComposer = exports.addBlackfirePlayer = exports.addPackage = exports.addArchive = exports.getPharUrl = exports.getUrl = exports.filterList = exports.getRelease = exports.getVersion = exports.getLatestVersion = exports.getSemverVersion = void 0;
|
||||
exports.addTools = exports.functionRecord = exports.getData = exports.addWPCLI = exports.addPHPUnitTools = exports.addPhive = exports.addPhing = exports.addPECL = exports.addDevTools = exports.addDeployer = exports.addComposer = exports.addCastor = exports.addBlackfirePlayer = exports.addPackage = exports.addArchive = exports.getPharUrl = exports.getUrl = exports.filterList = exports.getRelease = exports.getVersion = exports.getLatestVersion = exports.getSemverVersion = void 0;
|
||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const fetch = __importStar(__nccwpck_require__(2387));
|
||||
@ -837,6 +837,29 @@ async function addBlackfirePlayer(data) {
|
||||
return addArchive(data);
|
||||
}
|
||||
exports.addBlackfirePlayer = addBlackfirePlayer;
|
||||
async function addCastor(data) {
|
||||
let filename;
|
||||
switch (data['os']) {
|
||||
case 'linux':
|
||||
case 'darwin':
|
||||
filename = 'castor.' + data['os'] + '-amd64.phar';
|
||||
break;
|
||||
case 'win32':
|
||||
filename = 'castor.windows-amd64.phar';
|
||||
break;
|
||||
default:
|
||||
return await utils.log('Platform ' + data['os'] + ' is not supported', data['os'], 'error');
|
||||
}
|
||||
if (data['version'] === 'latest') {
|
||||
data['uri'] = ['releases/latest/download', filename].join('/');
|
||||
}
|
||||
else {
|
||||
data['uri'] = ['releases/download', 'v' + data['version'], filename].join('/');
|
||||
}
|
||||
data['url'] = [data['domain'], data['repository'], data['uri']].join('/');
|
||||
return await addArchive(data);
|
||||
}
|
||||
exports.addCastor = addCastor;
|
||||
async function addComposer(data) {
|
||||
const channel = data['version'].replace('latest', 'stable');
|
||||
const github = data['github'];
|
||||
@ -1015,6 +1038,7 @@ async function getData(release, php_version, os) {
|
||||
}
|
||||
exports.getData = getData;
|
||||
exports.functionRecord = {
|
||||
castor: addCastor,
|
||||
composer: addComposer,
|
||||
deployer: addDeployer,
|
||||
dev_tools: addDevTools,
|
||||
|
@ -222,6 +222,12 @@
|
||||
"version_prefix": "v",
|
||||
"version_parameter": "-V"
|
||||
},
|
||||
"castor": {
|
||||
"type": "custom-function",
|
||||
"domain": "https://github.com",
|
||||
"repository": "jolicode/castor",
|
||||
"function": "castor"
|
||||
},
|
||||
"composer": {
|
||||
"type": "custom-function",
|
||||
"domain": "https://getcomposer.org",
|
||||
|
34
src/tools.ts
34
src/tools.ts
@ -230,6 +230,39 @@ export async function addBlackfirePlayer(data: RS): Promise<string> {
|
||||
return addArchive(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to add Castor
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
export async function addCastor(data: RS): Promise<string> {
|
||||
let filename: string;
|
||||
switch (data['os']) {
|
||||
case 'linux':
|
||||
case 'darwin':
|
||||
filename = 'castor.' + data['os'] + '-amd64.phar';
|
||||
break;
|
||||
case 'win32':
|
||||
filename = 'castor.windows-amd64.phar';
|
||||
break;
|
||||
default:
|
||||
return await utils.log(
|
||||
'Platform ' + data['os'] + ' is not supported',
|
||||
data['os'],
|
||||
'error'
|
||||
);
|
||||
}
|
||||
if (data['version'] === 'latest') {
|
||||
data['uri'] = ['releases/latest/download', filename].join('/');
|
||||
} else {
|
||||
data['uri'] = ['releases/download', 'v' + data['version'], filename].join(
|
||||
'/'
|
||||
);
|
||||
}
|
||||
data['url'] = [data['domain'], data['repository'], data['uri']].join('/');
|
||||
return await addArchive(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to add composer
|
||||
*
|
||||
@ -479,6 +512,7 @@ export async function getData(
|
||||
}
|
||||
|
||||
export const functionRecord: Record<string, (data: RS) => Promise<string>> = {
|
||||
castor: addCastor,
|
||||
composer: addComposer,
|
||||
deployer: addDeployer,
|
||||
dev_tools: addDevTools,
|
||||
|
Loading…
Reference in New Issue
Block a user