mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
Use composer for codeception setup
This commit is contained in:
parent
70d858dd49
commit
cff0bdeaa3
@ -79,93 +79,6 @@ describe('Tools tests', () => {
|
|||||||
).toBe('releases/download/v1.2.3/tool.phar');
|
).toBe('releases/download/v1.2.3/tool.phar');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checking getCodeceptionUriBuilder', async () => {
|
|
||||||
expect(await tools.getCodeceptionUriBuilder('3.2.1', 'php56')).toBe(
|
|
||||||
'releases/3.2.1/php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUriBuilder('3.2.1', 'php54')).toBe(
|
|
||||||
'releases/3.2.1/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUriBuilder('3.2.1', '')).toBe(
|
|
||||||
'releases/3.2.1/codecept.phar'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking getCodeceptionUri', async () => {
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '5.6')).toBe(
|
|
||||||
'php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '7.0')).toBe(
|
|
||||||
'php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '7.1')).toBe(
|
|
||||||
'php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '7.2')).toBe(
|
|
||||||
'codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '7.3')).toBe(
|
|
||||||
'codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('latest', '7.4')).toBe(
|
|
||||||
'codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('4.0.0', '7.4')).toBe(
|
|
||||||
'releases/4.0.0/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('4.0.0', '5.6')).toBe(
|
|
||||||
'releases/4.0.0/php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('4.0.0', '7.1')).toBe(
|
|
||||||
'releases/4.0.0/php56/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('3.1.0', '7.4')).toBe(
|
|
||||||
'releases/3.1.0/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('3.1.0', '5.6')).toBe(
|
|
||||||
'releases/3.1.0/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.5.4', '7.4')).toBe(
|
|
||||||
'releases/2.5.4/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.5.4', '5.6')).toBe(
|
|
||||||
'releases/2.5.4/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.3.4', '7.4')).toBe(
|
|
||||||
'releases/2.3.4/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.3.4', '5.4')).toBe(
|
|
||||||
'releases/2.3.4/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.2.4', '5.6')).toBe(
|
|
||||||
'releases/2.2.4/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.2.4', '7.4')).toBe(
|
|
||||||
'releases/2.2.4/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.2.4', '5.4')).toBe(
|
|
||||||
'releases/2.2.4/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.1.7', '5.6')).toBe(
|
|
||||||
'releases/2.1.7/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.1.7', '5.4')).toBe(
|
|
||||||
'releases/2.1.7/php54/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.1.5', '5.4')).toBe(
|
|
||||||
'releases/2.1.5/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('2.1.5', '7.4')).toBe(
|
|
||||||
'releases/2.1.5/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('1.6.9', '7.4')).toBe(
|
|
||||||
'releases/1.6.9/codecept.phar'
|
|
||||||
);
|
|
||||||
expect(await tools.getCodeceptionUri('1.5.0', '7.4')).toBe(
|
|
||||||
'releases/1.5.0/codecept.phar'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('checking addPhive', async () => {
|
it('checking addPhive', async () => {
|
||||||
let script: string = await tools.addPhive('1.2.3', '7.4', 'linux');
|
let script: string = await tools.addPhive('1.2.3', '7.4', 'linux');
|
||||||
expect(script).toContain(
|
expect(script).toContain(
|
||||||
@ -581,7 +494,6 @@ describe('Tools tests', () => {
|
|||||||
const listOfTools = [
|
const listOfTools = [
|
||||||
'blackfire',
|
'blackfire',
|
||||||
'blackfire-player:1.8.1',
|
'blackfire-player:1.8.1',
|
||||||
'codeception',
|
|
||||||
'cs2pr',
|
'cs2pr',
|
||||||
'deployer',
|
'deployer',
|
||||||
'does_not_exist',
|
'does_not_exist',
|
||||||
@ -635,6 +547,7 @@ describe('Tools tests', () => {
|
|||||||
it('checking addTools with composer tool using user/tool as input', async () => {
|
it('checking addTools with composer tool using user/tool as input', async () => {
|
||||||
const listOfTools = [
|
const listOfTools = [
|
||||||
'composer:v1',
|
'composer:v1',
|
||||||
|
'codeception/codeception',
|
||||||
'hirak/prestissimo',
|
'hirak/prestissimo',
|
||||||
'narrowspark/automatic-composer-prefetcher',
|
'narrowspark/automatic-composer-prefetcher',
|
||||||
'robmorgan/phinx'
|
'robmorgan/phinx'
|
||||||
|
80
dist/index.js
vendored
80
dist/index.js
vendored
@ -1786,7 +1786,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.addTools = exports.addPackage = exports.addDevTools = exports.addArchive = exports.getCleanedToolsList = exports.getComposerUrl = exports.addComposer = exports.getWpCliUrl = exports.getSymfonyUri = exports.getDeployerUrl = exports.getBlackfirePlayerUrl = exports.getPharUrl = exports.addPhive = exports.getCodeceptionUri = exports.getCodeceptionUriBuilder = exports.getUri = exports.parseTool = exports.getToolVersion = void 0;
|
exports.addTools = exports.addPackage = exports.addDevTools = exports.addArchive = exports.getCleanedToolsList = exports.getComposerUrl = exports.addComposer = exports.getWpCliUrl = exports.getSymfonyUri = exports.getDeployerUrl = exports.getBlackfirePlayerUrl = exports.getPharUrl = exports.addPhive = exports.getUri = exports.parseTool = exports.getToolVersion = void 0;
|
||||||
const utils = __importStar(__webpack_require__(163));
|
const utils = __importStar(__webpack_require__(163));
|
||||||
/**
|
/**
|
||||||
* Function to get tool version
|
* Function to get tool version
|
||||||
@ -1855,77 +1855,6 @@ async function getUri(tool, extension, version, prefix, version_prefix, verb) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getUri = getUri;
|
exports.getUri = getUri;
|
||||||
/**
|
|
||||||
* Helper function to get the codeception url
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @param suffix
|
|
||||||
*/
|
|
||||||
async function getCodeceptionUriBuilder(version, suffix) {
|
|
||||||
return ['releases', version, suffix, 'codecept.phar']
|
|
||||||
.filter(Boolean)
|
|
||||||
.join('/');
|
|
||||||
}
|
|
||||||
exports.getCodeceptionUriBuilder = getCodeceptionUriBuilder;
|
|
||||||
/**
|
|
||||||
* Function to get the codeception url
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @param php_version
|
|
||||||
*/
|
|
||||||
async function getCodeceptionUri(version, php_version) {
|
|
||||||
const codecept = await getCodeceptionUriBuilder(version, '');
|
|
||||||
const codecept54 = await getCodeceptionUriBuilder(version, 'php54');
|
|
||||||
const codecept56 = await getCodeceptionUriBuilder(version, 'php56');
|
|
||||||
// Refer to https://codeception.com/builds
|
|
||||||
switch (true) {
|
|
||||||
case /latest/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.6|7\.[0|1]/.test(php_version):
|
|
||||||
return 'php56/codecept.phar';
|
|
||||||
case /7\.[2-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return 'codecept.phar';
|
|
||||||
}
|
|
||||||
case /(^[4-9]|\d{2,})\..*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.6|7\.[0|1]/.test(php_version):
|
|
||||||
return codecept56;
|
|
||||||
case /7\.[2-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /(^2\.[4-5]\.\d+|^3\.[0-1]\.\d+).*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.6/.test(php_version):
|
|
||||||
return codecept54;
|
|
||||||
case /7\.[0-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /^2\.3\.\d+.*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.[4-6]/.test(php_version):
|
|
||||||
return codecept54;
|
|
||||||
case /^7\.[0-4]$/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /(^2\.(1\.([6-9]|\d{2,}))|^2\.2\.\d+).*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.[4-5]/.test(php_version):
|
|
||||||
return codecept54;
|
|
||||||
case /5.6|7\.[0-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /(^2\.(1\.[0-5]|0\.\d+)|^1\.[6-8]\.\d+).*/.test(version):
|
|
||||||
return codecept;
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.getCodeceptionUri = getCodeceptionUri;
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get script to setup phive
|
* Helper function to get script to setup phive
|
||||||
*
|
*
|
||||||
@ -2102,7 +2031,7 @@ async function getCleanedToolsList(tools_csv) {
|
|||||||
.map(function (extension) {
|
.map(function (extension) {
|
||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.replace(/-agent|behat\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//, '');
|
.replace(/-agent|behat\/|codeception\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//, '');
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
return [...new Set(tools_list)];
|
return [...new Set(tools_list)];
|
||||||
@ -2185,10 +2114,7 @@ async function addTools(tools_csv, php_version, os_version) {
|
|||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'codeception':
|
case 'codeception':
|
||||||
url =
|
script += await addPackage(tool, release, 'codeception/', os_version);
|
||||||
'https://codeception.com/' +
|
|
||||||
(await getCodeceptionUri(version, php_version));
|
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
|
||||||
break;
|
break;
|
||||||
case 'composer':
|
case 'composer':
|
||||||
url = await getComposerUrl(version);
|
url = await getComposerUrl(version);
|
||||||
|
7705
package-lock.json
generated
7705
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
84
src/tools.ts
84
src/tools.ts
@ -76,83 +76,6 @@ export async function getUri(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function to get the codeception url
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @param suffix
|
|
||||||
*/
|
|
||||||
export async function getCodeceptionUriBuilder(
|
|
||||||
version: string,
|
|
||||||
suffix: string
|
|
||||||
): Promise<string> {
|
|
||||||
return ['releases', version, suffix, 'codecept.phar']
|
|
||||||
.filter(Boolean)
|
|
||||||
.join('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to get the codeception url
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @param php_version
|
|
||||||
*/
|
|
||||||
export async function getCodeceptionUri(
|
|
||||||
version: string,
|
|
||||||
php_version: string
|
|
||||||
): Promise<string> {
|
|
||||||
const codecept: string = await getCodeceptionUriBuilder(version, '');
|
|
||||||
const codecept54: string = await getCodeceptionUriBuilder(version, 'php54');
|
|
||||||
const codecept56: string = await getCodeceptionUriBuilder(version, 'php56');
|
|
||||||
// Refer to https://codeception.com/builds
|
|
||||||
switch (true) {
|
|
||||||
case /latest/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.6|7\.[0|1]/.test(php_version):
|
|
||||||
return 'php56/codecept.phar';
|
|
||||||
case /7\.[2-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return 'codecept.phar';
|
|
||||||
}
|
|
||||||
case /(^[4-9]|\d{2,})\..*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.6|7\.[0|1]/.test(php_version):
|
|
||||||
return codecept56;
|
|
||||||
case /7\.[2-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /(^2\.[4-5]\.\d+|^3\.[0-1]\.\d+).*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.6/.test(php_version):
|
|
||||||
return codecept54;
|
|
||||||
case /7\.[0-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /^2\.3\.\d+.*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.[4-6]/.test(php_version):
|
|
||||||
return codecept54;
|
|
||||||
case /^7\.[0-4]$/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /(^2\.(1\.([6-9]|\d{2,}))|^2\.2\.\d+).*/.test(version):
|
|
||||||
switch (true) {
|
|
||||||
case /5\.[4-5]/.test(php_version):
|
|
||||||
return codecept54;
|
|
||||||
case /5.6|7\.[0-4]/.test(php_version):
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
case /(^2\.(1\.[0-5]|0\.\d+)|^1\.[6-8]\.\d+).*/.test(version):
|
|
||||||
return codecept;
|
|
||||||
default:
|
|
||||||
return codecept;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get script to setup phive
|
* Helper function to get script to setup phive
|
||||||
*
|
*
|
||||||
@ -375,7 +298,7 @@ export async function getCleanedToolsList(
|
|||||||
return extension
|
return extension
|
||||||
.trim()
|
.trim()
|
||||||
.replace(
|
.replace(
|
||||||
/-agent|behat\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//,
|
/-agent|behat\/|codeception\/|hirak\/|icanhazstring\/|laravel\/|narrowspark\/automatic-|overtrue\/|phpspec\/|robmorgan\/|symfony\//,
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@ -495,10 +418,7 @@ export async function addTools(
|
|||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
script += await addArchive(tool, url, os_version, '"-V"');
|
||||||
break;
|
break;
|
||||||
case 'codeception':
|
case 'codeception':
|
||||||
url =
|
script += await addPackage(tool, release, 'codeception/', os_version);
|
||||||
'https://codeception.com/' +
|
|
||||||
(await getCodeceptionUri(version, php_version));
|
|
||||||
script += await addArchive(tool, url, os_version, '"-V"');
|
|
||||||
break;
|
break;
|
||||||
case 'composer':
|
case 'composer':
|
||||||
url = await getComposerUrl(version);
|
url = await getComposerUrl(version);
|
||||||
|
Loading…
Reference in New Issue
Block a user