Skip to content

Pass PHP version (<major>.<minor>) to the scripts #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@ The `.laminas-ci/pre-install.sh` command runs before any other command is execut
- `$1`: the user the QA command will run under
- `$2`: the WORKDIR path
- `$3`: the `$JOB` passed to the entrypoint (see above)
- `$4`: the `$PHP` (<major>.<minor>) configured for execution

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

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

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

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

It is also possible to pass `after_script` with a list of commands via the `$JOB` variable.
`$STATUS` is a variable containing the exit code of the command and can be used in the commands listed in `after_script`.
Expand Down
7 changes: 4 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ RECONFIGURE_PHP_DEFAULT="yes"
# If the default PHP version from the container is requested, we do not reconfigure PHP version
if [[ "${PHP}" == "@default" ]]; then
RECONFIGURE_PHP_DEFAULT="no"
PHP=$(php -nr "echo PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;")
fi

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

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

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

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