Skip to content

Commit 706dc83

Browse files
authored
Merge pull request #56 from boesing/feature/additional-composer-arguments
Take additional composer arguments into account
2 parents c81976f + b4a2a87 commit 706dc83

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ The JSON string should represent an object with the following information:
2020
"dependencies": "dependencies to test against; one of lowest, locked, latest",
2121
"ignore_platform_reqs_on_8": "(boolean; OPTIONAL; DEPRECATED) Whether or not to ignore platform requirements on PHP 8; defaults to true",
2222
"ignore_php_platform_requirement": "(boolean; OPTIONAL) Whether or not to ignore PHP platform requirement; defaults to false",
23-
"command": "command to run to perform the check (empty in case you dont want to excecute any command)"
23+
"command": "command to run to perform the check (empty in case you dont want to excecute any command)",
24+
"additional_composer_arguments": [
25+
"arguments which will be passed to `composer install` or `composer update`, passed as a list or as a list; e.g. --no-scripts"
26+
]
2427
}
2528
```
2629

entrypoint.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ function help {
77
echo ""
88
echo "Run a QA JOB as specified in a JSON object."
99
echo "The JSON should include each of the following elements:"
10-
echo " - command: command to run"
11-
echo " - php: the PHP version to use"
12-
echo " - extensions: a list of additional extensions to enable"
13-
echo " - ini: a list of php.ini directives"
14-
echo " - dependencies: the dependency set to run against (lowest, latest, locked)"
10+
echo " - command: command to run"
11+
echo " - php: the PHP version to use"
12+
echo " - extensions: a list of additional extensions to enable"
13+
echo " - ini: a list of php.ini directives"
14+
echo " - dependencies: the dependency set to run against (lowest, latest, locked)"
15+
echo " - ignore_php_platform_requirement: flag to enable/disable the PHP platform requirement when executing composer \`install\` or \`update\`"
16+
echo " - additional_composer_arguments: a list of composer arguments to be added when \`install\` or \`update\` is called."
1517
echo ""
1618
}
1719

@@ -77,10 +79,11 @@ function checkout {
7779
fi
7880
}
7981

80-
function composer_install {
82+
function composer_install_dependencies {
8183
local DEPS=$1
8284
local IGNORE_PHP_PLATFORM_REQUIREMENT=$2
83-
local COMPOSER_ARGS="--ansi --no-interaction --no-progress --prefer-dist"
85+
local ADDITIONAL_COMPOSER_ARGUMENTS=$3
86+
local COMPOSER_ARGS="--ansi --no-interaction --no-progress --prefer-dist ${ADDITIONAL_COMPOSER_ARGUMENTS}"
8487
if [[ "${IGNORE_PHP_PLATFORM_REQUIREMENT}" == "true" ]];then
8588
COMPOSER_ARGS="${COMPOSER_ARGS} --ignore-platform-req=php"
8689
fi
@@ -99,7 +102,7 @@ function composer_install {
99102
*)
100103
echo "Installing dependencies as specified in lockfile via Composer"
101104
# shellcheck disable=SC2086
102-
composer install ${COMPOSER_ARGS}
105+
echo composer install ${COMPOSER_ARGS}
103106
;;
104107
esac
105108

@@ -148,6 +151,7 @@ INI=$(echo "${JOB}" | jq -r '.ini // [] | join("\n")')
148151
DEPS=$(echo "${JOB}" | jq -r '.dependencies // "locked"')
149152
IGNORE_PLATFORM_REQS_ON_8=$(echo "${JOB}" | jq -r 'if has("ignore_platform_reqs_8") | not then "yes" elif .ignore_platform_reqs_8 then "yes" else "no" end')
150153
IGNORE_PHP_PLATFORM_REQUIREMENT=$(echo "${JOB}" | jq -r '.ignore_php_platform_requirement')
154+
ADDITIONAL_COMPOSER_ARGUMENTS=$(echo "${JOB}" | jq -r '.additional_composer_arguments // [] | join("\n")')
151155

152156
# Old matrix generation
153157
if [ "${IGNORE_PHP_PLATFORM_REQUIREMENT}" == "null" ]; then
@@ -177,7 +181,7 @@ if [[ "${GITHUB_TOKEN}" != "" ]];then
177181
composer config --global github-oauth.github.com "${GITHUB_TOKEN}"
178182
fi
179183

180-
composer_install "${DEPS}" "${IGNORE_PHP_PLATFORM_REQUIREMENT}"
184+
composer_install_dependencies "${DEPS}" "${IGNORE_PHP_PLATFORM_REQUIREMENT}" "${ADDITIONAL_COMPOSER_ARGUMENTS}"
181185

182186
if [[ "${COMMAND}" =~ phpunit ]];then
183187
echo "Setting up PHPUnit problem matcher"

0 commit comments

Comments
 (0)