wip github actions CI
[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             HTTPSVERIFYHOST: 0
17             HTTPSIGNOREPEER: 1
18             SSLVERSION: 0
19             DEBUG: 0
20         strategy:
21             fail-fast: false
22             matrix:
23                 operating-system: ['ubuntu-latest'] # @todo add 'windows-latest'
24                 # @todo use an older version of phpunit to enable testing on php 5.3 - 5.5
25                 php: ['8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6']
26         steps:
27             -
28                 uses: shivammathur/setup-php@v2
29                 with:
30                     php-version: ${{ matrix.php }}
31                     extensions: curl, dom, mbstring, xsl
32                     ini-values: 'cgi.fix_pathinfo=1, always_populate_raw_post_data=-1'
33                     #tools: phpunit/phpunit:a_version_compatible_with_php_5.3-5.5
34                     # NB: this disables xdebug completely
35                     coverage: none
36             #-
37             #    run: 'php -v && env'
38             -
39                 uses: actions/checkout@v2
40             -
41                 # @todo add config setup scripts for windows
42                 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'
43             # Avoid downloading composer deps on every workflow. Is this useful for us?
44             #-
45             #    uses: actions/cache@v2
46             #    with:
47             #        path: /tmp/composer-cache
48             #        key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
49             -
50                 # simpler alternative ? Atm, php-actions/composer also fails because of missing php xsl extension!
51                 #uses: php-actions/composer@v6
52                 run: 'composer install'
53             -
54                 if: ${{ matrix.php == '7.4' }}
55                 run: './tests/ci/setup/setup_code_coverage.sh enable'
56             -
57                 # @todo bring back $PHPUNIT_OPTS to trigger code coverage
58                 run: './vendor/bin/phpunit -v tests'
59             -
60                 run: 'python3 demo/client/python/test.py'
61             -
62                 run: 'perl demo/client/perl/test.pl'
63             -
64               if: ${{ failure() }}
65               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'
66               #run: 'env; php -i; sudo cat /var/log/privoxy/*; sudo cat /var/log/php*.log'