Skip to content

Commit 5fa1858

Browse files
Merge pull request #47 from laminas/feature/ignore-php-platform-requirement
Provide support for `laminas-ci-matrix` v1.9
2 parents 0573cf3 + 80832b2 commit 5fa1858

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ 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",
21+
"ignore_platform_reqs_on_8": "(boolean; OPTIONAL; DEPRECATED) Whether or not to ignore platform requirements on PHP 8; defaults to true",
22+
"ignore_php_platform_requirement": "(boolean; OPTIONAL) Whether or not to ignore PHP platform requirement; defaults to false",
2223
"command": "command to run to perform the check (empty in case you dont want to excecute any command)"
2324
}
2425
```

entrypoint.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,9 @@ function checkout {
7979

8080
function composer_install {
8181
local DEPS=$1
82-
local PHP=$2
83-
local IGNORE_PLATFORM_REQS_ON_8=$3
82+
local IGNORE_PHP_PLATFORM_REQUIREMENT=$2
8483
local COMPOSER_ARGS="--ansi --no-interaction --no-progress --prefer-dist"
85-
if [[ "${IGNORE_PLATFORM_REQS_ON_8}" == "yes" && "${PHP}" =~ ^8. ]];then
86-
# TODO: Remove this when it's not an issue, and/or provide a config
87-
# option to disable the behavior.
84+
if [[ "${IGNORE_PHP_PLATFORM_REQUIREMENT}" == "true" ]];then
8885
COMPOSER_ARGS="${COMPOSER_ARGS} --ignore-platform-req=php"
8986
fi
9087

@@ -150,6 +147,17 @@ EXTENSIONS=$(echo "${JOB}" | jq -r ".extensions // [] | map(\"php${PHP}-\"+.) |
150147
INI=$(echo "${JOB}" | jq -r '.ini // [] | join("\n")')
151148
DEPS=$(echo "${JOB}" | jq -r '.dependencies // "locked"')
152149
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')
150+
IGNORE_PHP_PLATFORM_REQUIREMENT=$(echo "${JOB}" | jq -r '.ignore_php_platform_requirement')
151+
152+
# Old matrix generation
153+
if [ "${IGNORE_PHP_PLATFORM_REQUIREMENT}" == "null" ]; then
154+
IGNORE_PHP_PLATFORM_REQUIREMENT="false"
155+
156+
# Provide BC compatibility
157+
if [ "${IGNORE_PLATFORM_REQS_ON_8}" == "yes" ] && [[ "${PHP}" =~ ^8 ]]; then
158+
IGNORE_PHP_PLATFORM_REQUIREMENT="true"
159+
fi
160+
fi
153161

154162
if [[ "${EXTENSIONS}" != "" ]];then
155163
/scripts/extensions.sh "${PHP}" "${EXTENSIONS}"
@@ -168,7 +176,8 @@ php -m
168176
if [[ "${GITHUB_TOKEN}" != "" ]];then
169177
composer config --global github-oauth.github.com "${GITHUB_TOKEN}"
170178
fi
171-
composer_install "${DEPS}" "${PHP}" "${IGNORE_PLATFORM_REQS_ON_8}"
179+
180+
composer_install "${DEPS}" "${IGNORE_PHP_PLATFORM_REQUIREMENT}"
172181

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

0 commit comments

Comments
 (0)