From 6db1a06425f5a9a99ce7abce052ad5319a9a49ea Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Tue, 17 Jan 2023 05:11:26 +0530 Subject: [PATCH] Improve support for blackfire-player --- __tests__/tools.test.ts | 7 ++++--- dist/index.js | 10 +++++++--- src/tools.ts | 11 ++++++----- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/__tests__/tools.test.ts b/__tests__/tools.test.ts index dfb0749a6..cfa970664 100644 --- a/__tests__/tools.test.ts +++ b/__tests__/tools.test.ts @@ -265,8 +265,9 @@ describe('Tools tests', () => { it.each` version | php_version | url - ${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player.phar'} + ${'latest'} | ${'8.1'} | ${'https://get.blackfire.io/blackfire-player.phar'} ${'1.2.3'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.2.3.phar'} + ${'latest'} | ${'7.4'} | ${'https://get.blackfire.io/blackfire-player-v1.22.0.phar'} ${'latest'} | ${'5.5'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'} ${'latest'} | ${'7.0'} | ${'https://get.blackfire.io/blackfire-player-v1.9.3.phar'} `( @@ -376,7 +377,7 @@ describe('Tools tests', () => { [ 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_blackfire', - 'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"', + 'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"', 'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"', 'add_tool https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr cs2pr "-V"', 'add_composertool flex flex symfony/ global', @@ -417,7 +418,7 @@ describe('Tools tests', () => { 'add_tool https://github.com/shivammathur/composer-cache/releases/latest/download/composer-7.4-stable.phar,https://dl.cloudsmith.io/public/shivammathur/composer-cache/raw/files/composer-7.4-stable.phar,https://getcomposer.org/composer-stable.phar composer', 'add_composertool behat behat behat/ scoped', 'add_blackfire', - 'add_tool https://get.blackfire.io/blackfire-player.phar blackfire-player "-V"', + 'add_tool https://get.blackfire.io/blackfire-player-v1.22.0.phar blackfire-player "-V"', 'add_tool https://github.com/bmitch/churn-php/releases/latest/download/churn.phar churn "-V"', 'add_tool https://github.com/ergebnis/composer-normalize/releases/latest/download/composer-normalize.phar composer-normalize "-V"', 'add_composertool composer-require-checker composer-require-checker maglnet/ scoped', diff --git a/dist/index.js b/dist/index.js index 71ad512b6..7ee539621 100644 --- a/dist/index.js +++ b/dist/index.js @@ -759,9 +759,13 @@ async function addPackage(data) { } exports.addPackage = addPackage; async function addBlackfirePlayer(data) { - if (/5\.[5-6]|7\.0/.test(data['php_version']) && - data['version'] == 'latest') { - data['version'] = '1.9.3'; + if (data['version'] == 'latest') { + if (/5\.[5-6]|7\.0/.test(data['php_version'])) { + data['version'] = '1.9.3'; + } + else if (/7\.[1-4]|8\.0/.test(data['php_version'])) { + data['version'] = '1.22.0'; + } } data['url'] = await getPharUrl(data); return addArchive(data); diff --git a/src/tools.ts b/src/tools.ts index a2b7d7e4d..2375f1b96 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -218,11 +218,12 @@ export async function addPackage(data: RS): Promise { * @param data */ export async function addBlackfirePlayer(data: RS): Promise { - if ( - /5\.[5-6]|7\.0/.test(data['php_version']) && - data['version'] == 'latest' - ) { - data['version'] = '1.9.3'; + if (data['version'] == 'latest') { + if (/5\.[5-6]|7\.0/.test(data['php_version'])) { + data['version'] = '1.9.3'; + } else if (/7\.[1-4]|8\.0/.test(data['php_version'])) { + data['version'] = '1.22.0'; + } } data['url'] = await getPharUrl(data); return addArchive(data);