Skip to content

Commit 625e2b4

Browse files
authored
Merge pull request #161 from boesing/feature/pass-php-version-to-scripts
Pass `PHP` version (<major>.<minor>) to the scripts
2 parents de5ce6e + 6948355 commit 625e2b4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,14 @@ The `.laminas-ci/pre-install.sh` command runs before any other command is execut
114114
- `$1`: the user the QA command will run under
115115
- `$2`: the WORKDIR path
116116
- `$3`: the `$JOB` passed to the entrypoint (see above)
117+
- `$4`: the `$PHP` (<major>.<minor>) configured for execution
117118

118119
The `.laminas-ci/pre-run.sh` command runs immediately prior to the QA command, and will receive the following arguments:
119120

120121
- `$1`: the user the QA command will run under
121122
- `$2`: the WORKDIR path
122123
- `$3`: the `$JOB` passed to the entrypoint (see above)
124+
- `$4`: the `$PHP` (<major>.<minor>) configured for execution
123125

124126
It is also possible to pass `before_script` with a list of commands via the `$JOB` variable.
125127

@@ -129,6 +131,7 @@ The `.laminas-ci/post-run.sh` command will receive these arguments:
129131
- `$2`: the user the QA command will run under
130132
- `$3`: the WORKDIR path
131133
- `$4`: the `$JOB` passed to the entrypoint (see above)
134+
- `$5`: the `$PHP` (<major>.<minor>) configured for execution
132135

133136
It is also possible to pass `after_script` with a list of commands via the `$JOB` variable.
134137
`$STATUS` is a variable containing the exit code of the command and can be used in the commands listed in `after_script`.

entrypoint.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ RECONFIGURE_PHP_DEFAULT="yes"
146146
# If the default PHP version from the container is requested, we do not reconfigure PHP version
147147
if [[ "${PHP}" == "@default" ]]; then
148148
RECONFIGURE_PHP_DEFAULT="no"
149+
PHP=$(php -nr "echo PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;")
149150
fi
150151

151152
if [[ "${COMMAND}" =~ "^roave-backward-compatibility-check" ]] || [[ "${COMMAND}" =~ "^/usr/bin/env roave-backward-compatibility-check" ]] || [[ "${COMMAND}" =~ "^/usr/local/bin/roave-backward-compatibility-check" ]]; then
@@ -175,7 +176,7 @@ checkout
175176
# Is there a pre-install script available?
176177
if [ -x ".laminas-ci/pre-install.sh" ];then
177178
echo "Executing pre-install commands from .laminas-ci/pre-install.sh"
178-
./.laminas-ci/pre-install.sh testuser "${PWD}" "${JOB}"
179+
./.laminas-ci/pre-install.sh testuser "${PWD}" "${JOB}" "${PHP}"
179180
fi
180181

181182
EXTENSIONS=$(echo "${JOB}" | jq -r ".extensions // [] | join(\" \")")
@@ -237,7 +238,7 @@ chown -R testuser .
237238
# Is there a pre-run script available?
238239
if [ -x ".laminas-ci/pre-run.sh" ];then
239240
echo "Executing pre-run commands from .laminas-ci/pre-run.sh"
240-
./.laminas-ci/pre-run.sh testuser "${PWD}" "${JOB}"
241+
./.laminas-ci/pre-run.sh testuser "${PWD}" "${JOB}" "${PHP}"
241242
fi
242243

243244
for BEFORE_SCRIPT_COMMAND in "${BEFORE_SCRIPT[@]}"; do
@@ -257,7 +258,7 @@ set -e
257258
# Is there a post-run script available?
258259
if [ -x ".laminas-ci/post-run.sh" ];then
259260
echo "Executing post-run commands from .laminas-ci/post-run.sh"
260-
./.laminas-ci/post-run.sh "${STATUS}" testuser "${PWD}" "${JOB}"
261+
./.laminas-ci/post-run.sh "${STATUS}" testuser "${PWD}" "${JOB}" "${PHP}"
261262
fi
262263

263264
for AFTER_SCRIPT_COMMAND in "${AFTER_SCRIPT[@]}"; do

0 commit comments

Comments
 (0)