wip github actions CI
authorgggeek <giunta.gaetano@gmail.com>
Mon, 6 Dec 2021 18:10:39 +0000 (18:10 +0000)
committergggeek <giunta.gaetano@gmail.com>
Mon, 6 Dec 2021 18:10:39 +0000 (18:10 +0000)
.github/workflows/ci.yml
tests/ci/setup/setup_php_github.sh [new file with mode: 0644]

index f922a51..021d7db 100644 (file)
@@ -39,7 +39,7 @@ jobs:
                 uses: actions/checkout@v2
             -
                 # @todo add config setup scripts for windows
-                run: 'chmod 755 ./tests/ci/setup/*.sh && sudo ./tests/ci/setup/setup_perl.sh && sudo ./tests/ci/setup/setup_apache.sh && sudo ./tests/ci/setup/setup_privoxy.sh'
+                run: 'chmod 755 ./tests/ci/setup/*.sh && sudo ./tests/ci/setup/setup_perl.sh && sudo ./tests/ci/setup/setup_apache.sh && sudo ./tests/ci/setup/setup_privoxy.sh && sudo ./tests/ci/setup/setup_php_github.sh'
             # Avoid downloading composer deps on every workflow. Is this useful for us?
             #-
             #    uses: actions/cache@v2
@@ -61,6 +61,16 @@ jobs:
             -
                 run: 'perl demo/client/perl/test.pl'
             -
-              if: ${{ failure() }}
-              run: 'systemctl status apache2.service; ls -la /etc/apache2/mods-enabled; ls -la /etc/apache2/conf-enabled; sudo cat /var/log/apache2/error.log; sudo cat /var/log/apache2/other_vhosts_access.log'
-              #run: 'env; php -i; sudo cat /var/log/privoxy/*; sudo cat /var/log/php*.log'
+                if: ${{ failure() }}
+                run: |
+                    systemctl status apache2.service
+                    ls -la /etc/apache2/mods-enabled
+                    ls -la /etc/apache2/conf-enabled
+                    ls -la /etc/apache2/mods-available
+                    ls -la /etc/apache2/conf-available
+                    sudo cat /var/log/apache2/error.log
+                    sudo cat /var/log/apache2/other_vhosts_access.log
+                    #env
+                    #php -i
+                    #sudo cat /var/log/privoxy/*
+                    #sudo cat /var/log/php*.log
diff --git a/tests/ci/setup/setup_php_github.sh b/tests/ci/setup/setup_php_github.sh
new file mode 100644 (file)
index 0000000..f82acb2
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# Has to be run as admin
+
+# To be kept in sync with setup_php_travis.sh
+
+# @todo make it optional to disable xdebug ?
+
+set -e
+
+configure_php_ini() {
+    # note: these settings are not required for cli config
+    echo "cgi.fix_pathinfo = 1" >> "${1}"
+    echo "always_populate_raw_post_data = -1" >> "${1}"
+
+    # we disable xdebug for speed for both cli and web mode
+    phpdismod xdebug
+}
+
+PHPVER=$(php -r 'echo implode(".",array_slice(explode(".",PHP_VERSION),0,2));' 2>/dev/null)
+
+# this is done via shivammathur/setup-php
+#configure_php_ini /etc/php/${PHPVER}/fpm/php.ini
+
+# install php-fpm
+apt-get install php$PHPVER-fpm
+cp /usr/sbin/php-fpm$PHPVER /usr/bin/php-fpm # copy to /usr/bin
+
+# use a nice name for the php-fpm service, so that it does not depend on php version running
+#service "php${PHPVER}-fpm" stop
+#ln -s "/etc/init.d/php${PHPVER}-fpm" /etc/init.d/php-fpm
+
+# @todo shall we configure php-fpm?
+
+service php$PHPVER-fpm start
+service php$PHPVER-fpm status
+
+# configure apache
+a2enconf php${PHPVER}-fpm
+service apache2 restart