diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts index 849e4a19..da5fdec5 100644 --- a/__tests__/utils.test.ts +++ b/__tests__/utils.test.ts @@ -56,6 +56,7 @@ describe('Utils tests', () => { expect(await utils.readScript('darwin.sh', '7.3', 'darwin')).toBe(darwin); expect(await utils.readScript('linux.sh', '7.4', 'linux')).toBe(linux); expect(await utils.readScript('linux.sh', '7.3', 'linux')).toBe(linux); + expect(await utils.readScript('win32.ps1', '7.4', 'win32')).toBe(win32); expect(await utils.readScript('win32.ps1', '7.3', 'win32')).toBe(win32); expect(await utils.readScript('fedora.sh', '7.3', 'fedora')).toContain( 'Platform fedora is not supported' diff --git a/lib/utils.js b/lib/utils.js index 28e7f65e..26155909 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -79,24 +79,26 @@ function readScript(filename, version, os_version) { 'scripts/pcov.sh' ]); return fs.readFileSync(path.join(__dirname, '../src/scripts/7.4.sh'), 'utf8'); - case '7.3': - default: - return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8'); } + break; case 'linux': switch (version) { case '7.4': yield readFiles74(['scripts/xdebug.sh', 'scripts/pcov.sh']); - return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8'); - case '7.3': - default: - return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8'); + break; } + break; case 'win32': - return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8'); + switch (version) { + case '7.4': + yield readFiles74(['ext/php_pcov.dll']); + break; + } + break; default: return yield log('Platform ' + os_version + ' is not supported', os_version, 'error'); } + return fs.readFileSync(path.join(__dirname, '../src/scripts/' + filename), 'utf8'); }); } exports.readScript = readScript; @@ -179,7 +181,7 @@ function log(message, os_version, log_type) { exports.log = log; function getExtensionPrefix(extension) { return __awaiter(this, void 0, void 0, function* () { - let zend = ['xdebug', 'opcache']; + let zend = ['xdebug', 'opcache', 'ioncube', 'eaccelerator']; switch (zend.indexOf(extension)) { case 0: case 1: diff --git a/package-lock.json b/package-lock.json index 912c5586..b3b3be0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "setup-php", - "version": "1.3.7", + "version": "1.3.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a28afecd..6b8a1712 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setup-php", - "version": "1.3.7", + "version": "1.3.8", "private": false, "description": "Setup php action", "main": "lib/setup-php.js", diff --git a/src/ext/php_pcov.dll b/src/ext/php_pcov.dll new file mode 100644 index 00000000..a63db08d Binary files /dev/null and b/src/ext/php_pcov.dll differ diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 82c60ca1..50658cf6 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -26,16 +26,18 @@ if($installed -ne $version) { } echo "Housekeeping in PHP.ini, enabling openssl" +$ext_dir = "C:\tools\php\ext" Add-Content C:\tools\php\php.ini "date.timezone = 'UTC'" -Set-PhpIniKey extension_dir C:\tools\php\ext +Set-PhpIniKey extension_dir $ext_dir + if($version -lt '7.4') { Enable-PhpExtension openssl } else { Add-Content C:\tools\php\php.ini "extension=php_openssl.dll" + Copy-Item "php_pcov.dll" -Destination $ext_dir"\php_pcov.dll" } echo "Installing Composer" Install-Composer -Scope System -Path C:\tools\php -$ext_dir = Get-PhpIniKey extension_dir php -v composer -V \ No newline at end of file diff --git a/src/utils.ts b/src/utils.ts index 89836723..b2bffb8f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -70,33 +70,22 @@ export async function readScript( path.join(__dirname, '../src/scripts/7.4.sh'), 'utf8' ); - case '7.3': - default: - return fs.readFileSync( - path.join(__dirname, '../src/scripts/' + filename), - 'utf8' - ); } + break; case 'linux': switch (version) { case '7.4': await readFiles74(['scripts/xdebug.sh', 'scripts/pcov.sh']); - return fs.readFileSync( - path.join(__dirname, '../src/scripts/' + filename), - 'utf8' - ); - case '7.3': - default: - return fs.readFileSync( - path.join(__dirname, '../src/scripts/' + filename), - 'utf8' - ); + break; } + break; case 'win32': - return fs.readFileSync( - path.join(__dirname, '../src/scripts/' + filename), - 'utf8' - ); + switch (version) { + case '7.4': + await readFiles74(['ext/php_pcov.dll']); + break; + } + break; default: return await log( 'Platform ' + os_version + ' is not supported', @@ -104,6 +93,11 @@ export async function readScript( 'error' ); } + + return fs.readFileSync( + path.join(__dirname, '../src/scripts/' + filename), + 'utf8' + ); } /** @@ -189,7 +183,7 @@ export async function log( } export async function getExtensionPrefix(extension: string): Promise { - let zend: Array = ['xdebug', 'opcache']; + let zend: Array = ['xdebug', 'opcache', 'ioncube', 'eaccelerator']; switch (zend.indexOf(extension)) { case 0: case 1: