bb491ba1d83035f13b0370fe6c3500188cff5bb2
[plcapi.git] / .github / workflows / ci.yml
1 name: CI
2
3 on: [push]
4
5 jobs:
6     test:
7         runs-on: ${{ matrix.operating-system }}
8         env:
9             HTTPSERVER: localhost
10             URI: /demo/server/server.php
11             HTTPSSERVER: localhost
12             HTTPSURI: /demo/server/server.php
13             PROXYSERVER: localhost:8080
14             # Travis currently compiles PHP with an oldish cURL/GnuTLS combination;
15             # to make the tests pass when Apache has a bogus SSL cert whe need the full set of options below.
16             # @todo check: is this necessary as well on GHA runners?
17             HTTPSVERIFYHOST: 0
18             HTTPSIGNOREPEER: 1
19             SSLVERSION: 0
20             DEBUG: 0
21         strategy:
22             fail-fast: false
23             matrix:
24                 operating-system: ['ubuntu-latest'] # @todo add 'windows-latest'
25                 # @todo use an older version of phpunit to enable testing on php 5.3 - 5.5
26                 php: ['8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6']
27         steps:
28             -
29                 uses: actions/checkout@v2
30             # Although this action is useful, we prefer to use the same script to set up php that we use for the
31             # docker image used for local testing. This allows us to make sure that script is always in good shape
32             #-
33             #    uses: shivammathur/setup-php@v2
34             #    with:
35             #        php-version: ${{ matrix.php }}
36             #        extensions: curl, dom, mbstring, xsl
37             #        ini-values: 'cgi.fix_pathinfo=1, always_populate_raw_post_data=-1'
38             #        #tools: phpunit/phpunit:a_version_compatible_with_php_5.3-5.5
39             #        # NB: this disables xdebug completely
40             #        coverage: none
41             -
42                 # @todo add config setup scripts for windows
43                 run: |
44                     chmod 755 ./tests/ci/setup/*.sh
45                     sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_perl.sh
46                     sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_apache.sh
47                     sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_privoxy.sh
48                     sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_php.sh ${{ matrix.php }}
49                     sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_composer.sh
50             # Avoid downloading composer deps on every workflow. Is this useful/working for us?
51             #-
52             #    uses: actions/cache@v2
53             #    with:
54             #        path: /tmp/composer-cache
55             #        key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
56             -
57                 run: 'composer install'
58             -
59                 if: ${{ matrix.php == '7.4' }}
60                 run: './tests/ci/setup/setup_code_coverage.sh enable'
61             -
62                 # @todo bring back $PHPUNIT_OPTS to trigger code coverage
63                 run: './vendor/bin/phpunit -v tests'
64             -
65                 run: 'python3 demo/client/python/test.py'
66             -
67                 run: 'perl demo/client/perl/test.pl'
68             -
69                 if: ${{ failure() }}
70                 run: |
71                     #env
72                     #php -i
73                     #ps auxwww
74                     dpkg --list | grep php
75                     ps auxwww | grep fpm
76                     #pwd
77                     #sudo env
78                     #systemctl status apache2.service
79                     #ls -la /etc/apache2/mods-enabled
80                     #ls -la /etc/apache2/conf-enabled
81                     #ls -la /etc/apache2/mods-available
82                     #ls -la /etc/apache2/conf-available
83                     #ls -la /etc/apache2/sites-available/
84                     #sudo cat /etc/apache2/envvars
85                     #sudo cat /etc/apache2/sites-available/000-default.conf
86                     ls -ltr /var/log
87                     ls -ltr /var/log/apache2
88                     sudo cat /var/log/privoxy/*
89                     sudo cat /var/log/apache2/error.log
90                     sudo cat /var/log/apache2/other_vhosts_access.log
91                     sudo cat /var/log/php*.log