mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-23 23:29:07 +07:00
Improve documentation
This commit is contained in:
@ -2,6 +2,13 @@ import * as utils from './utils';
|
||||
import * as extensions from './extensions';
|
||||
import * as config from './config';
|
||||
|
||||
/**
|
||||
* Function to set coverage driver
|
||||
*
|
||||
* @param coverage_driver
|
||||
* @param version
|
||||
* @param os_version
|
||||
*/
|
||||
export async function addCoverage(
|
||||
coverage_driver: string,
|
||||
version: string,
|
||||
@ -20,6 +27,12 @@ export async function addCoverage(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to setup Xdebug
|
||||
*
|
||||
* @param version
|
||||
* @param os_version
|
||||
*/
|
||||
export async function addCoverageXdebug(version: string, os_version: string) {
|
||||
let script: string = '\n';
|
||||
script += await extensions.addExtension(
|
||||
@ -38,6 +51,12 @@ export async function addCoverageXdebug(version: string, os_version: string) {
|
||||
return script;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to setup PCOV
|
||||
*
|
||||
* @param version
|
||||
* @param os_version
|
||||
*/
|
||||
export async function addCoveragePCOV(version: string, os_version: string) {
|
||||
let script: string = '\n';
|
||||
switch (version) {
|
||||
@ -93,6 +112,12 @@ export async function addCoveragePCOV(version: string, os_version: string) {
|
||||
return script;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to disable Xdebug and PCOV
|
||||
*
|
||||
* @param version
|
||||
* @param os_version
|
||||
*/
|
||||
export async function disableCoverage(version: string, os_version: string) {
|
||||
let script: string = '\n';
|
||||
switch (os_version) {
|
||||
|
@ -1,5 +1,13 @@
|
||||
import * as utils from './utils';
|
||||
|
||||
/**
|
||||
* Install and enable extensions
|
||||
*
|
||||
* @param extension_csv
|
||||
* @param version
|
||||
* @param os_version
|
||||
* @param log_prefix
|
||||
*/
|
||||
export async function addExtension(
|
||||
extension_csv: string,
|
||||
version: string,
|
||||
|
@ -18,14 +18,11 @@ if [ "$existing_version" != "$1" ]; then
|
||||
fi
|
||||
|
||||
if [ ! -e "/usr/bin/composer" ]; then
|
||||
EXPECTED_SIGNATURE="$(curl -s https://composer.github.io/installer.sig)" &
|
||||
curl -s -L https://getcomposer.org/installer > composer-setup.php &
|
||||
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" &
|
||||
|
||||
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then
|
||||
curl -s -L https://getcomposer.org/installer > composer-setup.php
|
||||
if [ "$(curl -s https://composer.github.io/installer.sig)" != "$(php -r "echo hash_file('sha384', 'composer-setup.php');")" ]; then
|
||||
>&2 echo 'ERROR: Invalid installer signature'
|
||||
else
|
||||
COMPOSER_ALLOW_SUPERUSER=1
|
||||
export COMPOSER_ALLOW_SUPERUSER=1
|
||||
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
||||
fi
|
||||
rm composer-setup.php
|
||||
|
12
src/utils.ts
12
src/utils.ts
@ -2,6 +2,12 @@ import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as core from '@actions/core';
|
||||
|
||||
/**
|
||||
* Function to get inputs from both with and env annotations.
|
||||
*
|
||||
* @param name
|
||||
* @param mandatory
|
||||
*/
|
||||
export async function getInput(
|
||||
name: string,
|
||||
mandatory: boolean
|
||||
@ -117,6 +123,7 @@ export async function writeScript(
|
||||
|
||||
/**
|
||||
* Function to break extension csv into an array
|
||||
*
|
||||
* @param extension_csv
|
||||
*/
|
||||
export async function extensionArray(
|
||||
@ -202,6 +209,11 @@ export async function log(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get prefix required to load an extension.
|
||||
*
|
||||
* @param extension
|
||||
*/
|
||||
export async function getExtensionPrefix(extension: string): Promise<string> {
|
||||
let zend: Array<string> = ['xdebug', 'opcache', 'ioncube', 'eaccelerator'];
|
||||
switch (zend.indexOf(extension)) {
|
||||
|
Reference in New Issue
Block a user