bye bye Travis
[plcapi.git] / tests / ci / setup / setup_php.sh
index cc72a7f..03bf0be 100755 (executable)
@@ -2,8 +2,7 @@
 
 # Has to be run as admin
 
-# To be kept in sync with setup_php_travis.sh
-
+# @todo make it optional to install xdebug. It is fe. missing in sury's ppa for Xenial
 # @todo make it optional to disable xdebug ?
 
 set -e
@@ -37,6 +36,13 @@ if [ "${PHP_VERSION}" = default ]; then
         php${PHPSUFFIX}-mbstring \
         php${PHPSUFFIX}-xdebug
 else
+    # on GHA runners ubuntu version, php 7.4 and 8.0 seem to be preinstalled. Remove them if found
+    for PHP_CURRENT in $(dpkg -l | grep -E 'php.+-common' | awk '{print $2}'); do
+        if [ "${PHP_CURRENT}" != "php${PHP_VERSION}-common" ]; then
+            apt-get purge -y "${PHP_CURRENT}"
+        fi
+    done
+
     DEBIAN_FRONTEND=noninteractive apt-get install -y language-pack-en-base software-properties-common
     LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
     apt-get update