Skip to content

Commit 40f2f2d

Browse files
committed
feat: add pre-install script execution
Signed-off-by: Maximilian Bösing <[email protected]>
1 parent 3653e6f commit 40f2f2d

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,17 @@ jobs:
6565
Some packages may require additional setup steps: setting up a web server to test an HTTP client, seeding a database or cache service, etc.
6666
Other times, you may want to do additional reporting, particularly if the QA command failed.
6767
68-
To enable this, you may create one or both of the following files in your package:
68+
To enable this, you may create one or more of the following files in your package:
6969
70-
- `.laminas-ci/pre-run.sh`
70+
- `.laminas-ci/pre-install.sh`
71+
- `.laminas-ci/pre-run.sh`
7172
- `.laminas-ci/post-run.sh`
7273

7374
(Note: the files MUST be executable to be consumed!)
7475

75-
These run immediately before and after the QA command, respectively.
76-
The `.laminas-ci/pre-run.sh` command will receive the following arguments:
76+
The `.laminas-ci/pre-install.sh` command runs before any other command is executed in the action, and will receive the following arguments:
77+
78+
The `.laminas-ci/pre-run.sh` command runs immediately prior to the QA command, and will receive the following arguments:
7779

7880
- `$1`: the user the QA command will run under
7981
- `$2`: the WORKDIR path

entrypoint.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ if [[ "${COMMAND}" == "" ]];then
124124
exit 1
125125
fi
126126

127+
echo "Marking PHP ${PHP} as configured default"
128+
update-alternatives --set php /usr/bin/php${PHP}
129+
130+
# Is there a pre-install script available?
131+
if [ -x ".laminas-ci/pre-install.sh" ];then
132+
echo "Executing pre-install commands from .laminas-ci/pre-install.sh"
133+
./.laminas-ci/pre-install.sh testuser "${PWD}" "${JOB}"
134+
fi
135+
127136
EXTENSIONS=$(echo "${JOB}" | jq -r ".extensions | map(\"php${PHP}-\"+.) | join(\" \")")
128137
INI=$(echo "${JOB}" | jq -r '.ini | join("{NL}")')
129138
DEPS=$(echo "${JOB}" | jq -r '.dependencies')
@@ -154,9 +163,6 @@ if [[ "${INI}" != "" ]];then
154163
echo $INI | sed "s/{NL}/\n/g" > /etc/php/${PHP}/cli/conf.d/99-settings.ini
155164
fi
156165

157-
echo "Marking PHP ${PHP} as configured default"
158-
update-alternatives --set php /usr/bin/php${PHP}
159-
160166
echo "PHP version: $(php --version)"
161167
echo "Installed extensions:"
162168
php -m

0 commit comments

Comments
 (0)