bye bye Travis
[plcapi.git] / .github / workflows / ci.yml
index 2799537..d4d2fc9 100644 (file)
@@ -11,8 +11,9 @@ jobs:
             HTTPSSERVER: localhost
             HTTPSURI: /demo/server/server.php
             PROXYSERVER: localhost:8080
-            # Travis currently compiles PHP with an oldish cURL/GnuTLS combination;
-            # to make the tests pass when Apache has a bogus SSL cert whe need the full set of options below
+            # @todo check: is this necessary as well on GHA runners?
+            # was: Travis currently compiles PHP with an oldish cURL/GnuTLS combination;
+            # to make the tests pass when Apache has a bogus SSL cert whe need the full set of options below.
             HTTPSVERIFYHOST: 0
             HTTPSIGNOREPEER: 1
             SSLVERSION: 0
@@ -20,8 +21,12 @@ jobs:
         strategy:
             fail-fast: false
             matrix:
-                operating-system: ['ubuntu-latest'] # @todo add 'windows-latest'
-                # @todo use an older version of phpunit to enable testing on php 5.3 - 5.5
+                # @see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
+                # @todo fix: atm our tests fail when using ubuntu 20 (focal) and php 5.6 - 7.1, when using
+                #       an ssl stream context for connecting to localhost via https
+                operating-system: ['ubuntu-18.04'] # @todo add 'windows-latest'
+                # @todo use an older version of phpunit to enable testing on php 5.3 - 5.5 . Also: we will most likely
+                #       have to resort to using shivammathur/setup-php@v2 instead of sury's ppa to get php installed
                 php: ['8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6']
         steps:
             -
@@ -38,14 +43,14 @@ jobs:
             #        # NB: this disables xdebug completely
             #        coverage: none
             -
-                # @todo add config setup scripts for windows
+                # @todo add env 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
-                    sudo ./tests/ci/setup/setup_php.sh ${{ matrix.php }}
-                    sudo ./tests/ci/setup/setup_composer.sh
+                    sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_perl.sh
+                    sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_apache.sh
+                    sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_privoxy.sh
+                    sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_php.sh ${{ matrix.php }}
+                    sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_composer.sh
             # Avoid downloading composer deps on every workflow. Is this useful/working for us?
             #-
             #    uses: actions/cache@v2
@@ -56,9 +61,12 @@ jobs:
                 run: 'composer install'
             -
                 if: ${{ matrix.php == '7.4' }}
-                run: './tests/ci/setup/setup_code_coverage.sh enable'
+                run: |
+                    ./tests/ci/setup/setup_code_coverage.sh enable
+                    ./vendor/bin/phpunit -v --coverage-clover=coverage.clover tests
+                    wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover
             -
-                # @todo bring back $PHPUNIT_OPTS to trigger code coverage
+                if: ${{ matrix.php != '7.4' }}
                 run: './vendor/bin/phpunit -v tests'
             -
                 run: 'python3 demo/client/python/test.py'
@@ -67,14 +75,24 @@ jobs:
             -
                 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
+                    #ps auxwww
+                    #dpkg --list | grep php
+                    #ps auxwww | grep fpm
+                    #pwd
+                    #sudo env
+                    #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
+                    #ls -la /etc/apache2/sites-available/
+                    #sudo cat /etc/apache2/envvars
+                    #sudo cat /etc/apache2/sites-available/000-default.conf
+                    #ls -ltr /var/log
+                    #ls -ltr /var/log/apache2
+                    sudo cat /var/log/privoxy/*
+                    sudo cat /var/log/apache2/error.log
+                    sudo cat /var/log/apache2/other_vhosts_access.log
+                    sudo cat /var/log/php*.log