c4d6aa9f96faff1a1048902fbfd681e762e16dc1
[plcapi.git] / .github / workflows / ci.yml
1 name: CI
2
3 on: [push]
4
5 jobs:
6     test:
7         runs-on: ubuntu-latest
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                 php: ['8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4', '5.3']
24         steps:
25             -
26                 uses: shivammathur/setup-php@v2
27                 with:
28                     php-version: ${{ matrix.php }}
29                     extensions: curl, dom, mbstring, xsl
30                     #tools: phpunit
31             #-
32             #    run: 'php -v && env'
33             -
34                 uses: actions/checkout@v2
35             -
36                 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'
37             # Avoid downloading composer deps on every workflow. Is this useful for us?
38             #-
39             #    uses: actions/cache@v2
40             #    with:
41             #        path: /tmp/composer-cache
42             #        key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
43             -
44                 uses: php-actions/composer@v6
45                 # simpler alternative ?
46                 #run: 'composer install'
47             -
48                 if: ${{ matrix.php == '7.4' }}
49                 run: './tests/ci/setup/setup_code_coverage.sh enable'
50             -
51                 # @todo bring back $PHPUNIT_OPTS
52                 run: './vendor/bin/phpunit -v tests'
53             -
54                 run: 'python3 demo/client/python/test.py'
55             -
56                 run: 'perl demo/client/perl/test.pl'
57             -
58               if: ${{ failure() }}
59               run: 'systemctl status apache2.service; env; php -i; 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'