Skip to content

Commit ad9ba35

Browse files
committed
feat: add support for ignore_platform_reqs_8 job flag
This patch adds support for the `ignore_platform_reqs_8` job flag introduced in laminas/laminas-ci-matrix-action#28. When missing, the assumption is to ignore the PHP platform requirement when installing dependencies on PHP 8 (current behavior). Otherwise, the flag value indicates whether or not to use the flag. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
1 parent 0664c1a commit ad9ba35

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The JSON string should represent an object with the following information:
1818
"php.ini directives, one per element; e.g. 'memory_limit=-1'"
1919
],
2020
"dependencies": "dependencies to test against; one of lowest, locked, latest",
21+
"ignore_platform_reqs_on_8": "(boolean; OPTIONAL) Whether or not to ignore platform requirements on PHP 8; defaults to true",
2122
"command": "command to run to perform the check (empty in case you dont want to excecute any command)"
2223
}
2324
```

entrypoint.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ function checkout {
7575
function composer_install {
7676
local DEPS=$1
7777
local PHP=$2
78+
local IGNORE_PLATFORM_REQS_ON_8=$3
7879
local COMPOSER_ARGS="--ansi --no-interaction --no-progress --prefer-dist"
79-
if [[ "${PHP}" =~ ^8. ]];then
80+
if [[ "$IGNORE_PLATFORM_REQS_ON_8}" == "yes" && "${PHP}" =~ ^8. ]];then
8081
# TODO: Remove this when it's not an issue, and/or provide a config
8182
# option to disable the behavior.
8283
COMPOSER_ARGS="${COMPOSER_ARGS} --ignore-platform-req=php"
@@ -140,6 +141,7 @@ fi
140141
EXTENSIONS=$(echo "${JOB}" | jq -r ".extensions // [] | map(\"php${PHP}-\"+.) | join(\" \")")
141142
INI=$(echo "${JOB}" | jq -r '.ini // [] | join("\n")')
142143
DEPS=$(echo "${JOB}" | jq -r '.dependencies // "locked"')
144+
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')
143145

144146
if [[ "${EXTENSIONS}" != "" ]];then
145147
ENABLE_SQLSRV=false
@@ -171,7 +173,7 @@ echo "PHP version: $(php --version)"
171173
echo "Installed extensions:"
172174
php -m
173175

174-
composer_install "${DEPS}" "${PHP}"
176+
composer_install "${DEPS}" "${PHP}" "${IGNORE_PLATFORM_REQS_ON_8}"
175177

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

0 commit comments

Comments
 (0)