From: gggeek <giunta.gaetano@gmail.com>
Date: Tue, 7 Dec 2021 10:52:45 +0000 (+0000)
Subject: wip github actions CI
X-Git-Tag: 4.6.0~24
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=e6e1579cece03e00e0b0c931f43694c90357aa4f;p=plcapi.git

wip github actions CI
---

diff --git a/tests/ci/setup/setup_apache.sh b/tests/ci/setup/setup_apache.sh
index b7ac4e80..b5917296 100755
--- a/tests/ci/setup/setup_apache.sh
+++ b/tests/ci/setup/setup_apache.sh
@@ -16,6 +16,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y apache2
 a2enmod rewrite proxy_fcgi setenvif ssl
 
 # in case mod-php was enabled (this is the case on at least github's ubuntu with php 5.x and shivammathur/setup-php)
+# @todo silence errors in a smarter way
 rm /etc/apache2/mods-enabled/php* || true
 
 # configure apache virtual hosts
diff --git a/tests/ci/setup/setup_php.sh b/tests/ci/setup/setup_php.sh
index ad16d3db..1a7c69c3 100755
--- a/tests/ci/setup/setup_php.sh
+++ b/tests/ci/setup/setup_php.sh
@@ -57,9 +57,18 @@ PHPVER=$(php -r 'echo implode(".",array_slice(explode(".",PHP_VERSION),0,2));' 2
 
 configure_php_ini /etc/php/${PHPVER}/fpm/php.ini
 
-# use a nice name for the php-fpm service, so that it does not depend on php version running
+# use a nice name for the php-fpm service, so that it does not depend on php version running. Try to make that work
+# both for docker and VMs
 service "php${PHPVER}-fpm" stop
-ln -s "/etc/init.d/php${PHPVER}-fpm" /etc/init.d/php-fpm
+if [ -f "/etc/init.d/php${PHPVER}-fpm" ]; then
+    ln -s "/etc/init.d/php${PHPVER}-fpm" /etc/init.d/php-fpm
+fi
+if [ -f "/lib/systemd/system/php${PHPVER}-fpm.service" ]; then
+    ln -s "/lib/systemd/system/php${PHPVER}-fpm.service" /lib/systemd/system/php-fpm.service
+    if [ ! -f /.dockerenv ]; then
+        systemctl daeamon-reload
+    fi
+fi
 
 # @todo shall we configure php-fpm?
 
diff --git a/tests/ci/vm.sh b/tests/ci/vm.sh
index d688514a..6e7493a6 100755
--- a/tests/ci/vm.sh
+++ b/tests/ci/vm.sh
@@ -6,7 +6,7 @@ set -e
 
 ACTION="${1}"
 
-# Valid values: 'default', 5.6, 7.0 .. 7.4, 8.0
+# Valid values: 'default', 5.6, 7.0 .. 7.4, 8.0 .. 8.1
 export PHP_VERSION=${PHP_VERSION:-default}
 # Valid values: precise (12), trusty (14), xenial (16), bionic (18), focal (20)
 # We default to the same version we use on Travis
@@ -42,7 +42,7 @@ Options:
     -h                print help
 
 Environment variables: to be set before the 'build' action
-    PHP_VERSION       default value: 'default', ie. the stock php version from the Ubuntu version in use. Other possible values: 7.0 .. 8.0
+    PHP_VERSION       default value: 'default', ie. the stock php version from the Ubuntu version in use. Other possible values: 5.6, 7.0 .. 8.1
     UBUNTU_VERSION    default value: xenial. Other possible values: bionic, focal
 "
 }