Skip to content

Commit 76cecac

Browse files
authored
Merge pull request #168 from shivammathur/develop
1.8.1
2 parents d384d9f + d6e173f commit 76cecac

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

__tests__/extensions.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ describe('Extension tests', () => {
3535
expect(linux).toContain(
3636
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
3737
);
38-
expect(linux).toContain('pecl install -f pcov');
3938
expect(linux).toContain('install_extension ast-beta');
4039

4140
linux = await extensions.addExtension('gearman', '7.0', 'linux');

dist/index.js

-3
Original file line numberDiff line numberDiff line change
@@ -2787,9 +2787,6 @@ function addExtensionLinux(extension_csv, version, pipe) {
27872787
version +
27882788
'-' +
27892789
extension.replace('pdo_', '').replace('pdo-', '') +
2790-
pipe +
2791-
' || sudo pecl install -f ' +
2792-
extension +
27932790
pipe;
27942791
break;
27952792
}

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-php",
3-
"version": "1.8.0",
3+
"version": "1.8.1",
44
"private": false,
55
"description": "Setup PHP for use with GitHub Actions",
66
"main": "dist/index.js",

src/extensions.ts

-3
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@ export async function addExtensionLinux(
163163
version +
164164
'-' +
165165
extension.replace('pdo_', '').replace('pdo-', '') +
166-
pipe +
167-
' || sudo pecl install -f ' +
168-
extension +
169166
pipe;
170167
break;
171168
}

src/scripts/linux.sh

+15-5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ update_ppa() {
2424
fi
2525
}
2626

27+
configure_pecl() {
28+
if [ "$pecl_config" = "false" ] && [ -e /usr/bin/pecl ]; then
29+
for tool in pear pecl; do
30+
sudo $tool config-set php_ini "$ini_file" >/dev/null 2>&1
31+
sudo $tool config-set auto_discover 1 >/dev/null 2>&1
32+
sudo $tool channel-update $tool.php.net >/dev/null 2>&1
33+
done
34+
pecl_config="true"
35+
fi
36+
}
37+
2738
# Function to setup extensions
2839
add_extension() {
2940
extension=$1
@@ -36,6 +47,7 @@ add_extension() {
3647
elif ! php -m | grep -i -q -w "$extension"; then
3748
(eval "$install_command" && add_log "$tick" "$extension" "Installed and enabled") ||
3849
(update_ppa && eval "$install_command" && add_log "$tick" "$extension" "Installed and enabled") ||
50+
(sudo pecl install -f "$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
3951
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
4052
fi
4153
sudo chmod 777 "$ini_file"
@@ -119,6 +131,7 @@ add_devtools() {
119131
fi
120132
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
121133
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
134+
configure_pecl
122135
}
123136

124137
# Function to setup the nightly build from master branch
@@ -138,10 +151,7 @@ setup_master() {
138151
add_pecl() {
139152
add_devtools
140153
$apt_install php-pear >/dev/null 2>&1
141-
sudo pear config-set php_ini "$ini_file" >/dev/null 2>&1
142-
sudo pear config-set auto_discover 1 >/dev/null 2>&1
143-
sudo pear channel-update pear.php.net >/dev/null 2>&1
144-
sudo pecl channel-update pecl.php.net >/dev/null 2>&1
154+
configure_pecl
145155
add_log "$tick" "PECL" "Added"
146156
}
147157

@@ -158,6 +168,7 @@ switch_version() {
158168
tick=""
159169
cross=""
160170
ppa_updated="false"
171+
pecl_config="false"
161172
version=$1
162173
apt_install="sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y"
163174
existing_version=$(php-config --version | cut -c 1-3)
@@ -171,7 +182,6 @@ sudo mkdir -p /run/php
171182
if [ "$existing_version" != "$version" ]; then
172183
if [ ! -e "/usr/bin/php$version" ]; then
173184
update_ppa
174-
ppa_updated=1
175185
if [ "$version" = "7.4" ]; then
176186
$apt_install php"$version" php"$version"-curl php"$version"-mbstring php"$version"-xml php"$version"-phpdbg >/dev/null 2>&1
177187
elif [ "$version" = "8.0" ]; then

0 commit comments

Comments
 (0)