diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts index 849e4a19f..da5fdec54 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 28e7f65e8..261559098 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 912c55867..b3b3be0bf 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 a28afecd8..6b8a17125 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 000000000..a63db08da 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 82c60ca1b..50658cf60 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 89836723e..b2bffb8f0 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: