Skip to content

docs

docs #25

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.operating-system }}
env:
HTTPSERVER: localhost
HTTPSSERVER: localhost
HTTPSVERIFYHOST: 2
HTTPSIGNOREPEER: 0
SSLVERSION: 0
DEBUG: 0
strategy:
fail-fast: false
matrix:
include:
# @see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
# @todo run some tests on 'windows-latest' (needs test env setup scripts for windows to be developed)
- php: '8.3'
operating-system: ubuntu-22.04
- php: '8.2'
operating-system: ubuntu-22.04
- php: '8.1'
operating-system: ubuntu-22.04
- php: '8.0'
operating-system: ubuntu-22.04
- php: '7.4'
operating-system: ubuntu-22.04
# nb: the version of phpunit we use does not support code coverage generation on php 8
code-coverage: true
- php: '7.3'
operating-system: ubuntu-22.04
- php: '7.2'
operating-system: ubuntu-20.04
- php: '7.1'
operating-system: ubuntu-20.04
- php: '7.0'
operating-system: ubuntu-20.04
- php: '5.6'
operating-system: ubuntu-20.04
- php: '5.5'
operating-system: ubuntu-22.04
- php: '5.4'
operating-system: ubuntu-20.04
steps:
- name: checkout code
uses: actions/checkout@v3
# Although this action is quite nice, we prefer to use the same script to set up php that we use for the
# docker image used for local testing. This allows us to make sure that script is always in good shape
#- name: set up php
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ matrix.php }}
# extensions: curl, dom, mbstring, xsl
# ini-values: 'cgi.fix_pathinfo=1, always_populate_raw_post_data=-1'
# #tools: ${{ matrix.phpunit-version }}
# coverage: ${{ matrix.code-coverage}}
- name: set up env
# @todo add env setup scripts for windows
run: |
chmod 755 ./tests/ci/setup/*.sh
sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_apache.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
# fix fs perms for recent Apache versions configuration (ie. starting from Jammy)
f="$(pwd)"; while [[ $f != / ]]; do sudo chmod +rx "$f"; f=$(dirname "$f"); done;
find . -type d -exec chmod +rx {} \;
find . -type f -exec chmod +r {} \;
# Avoid downloading composer deps on every workflow run. Is this useful for us? Caching the installation of
# php/apache would be more useful...
#-
# uses: actions/cache@v2
# with:
# path: /tmp/composer-cache
# key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: install dependencies
# NB: we do require the test code of phpxmlrpc, which is not part of the tarball, so no --prefer-dist
run: 'composer install --no-progress'
- name: run tests and upload coverage info if needed
run: |
if [ -z "${{ matrix.code-coverage }}" ]; then
./vendor/bin/phpunit -v tests
else
./tests/ci/setup/setup_code_coverage.sh enable
./vendor/bin/phpunit -v --coverage-clover=coverage.clover tests
if [ -f coverage.clover ]; then
wget https://uploader.codecov.io/latest/linux/codecov && \
chmod +x codecov && \
./codecov -f coverage.clover
else
echo "WARNING: code coverage not generated. Is xdebug disabled?"
fi
fi
# NB: the current phpunit dependencies break with --prefer-lowest and php >= 7.1. We only lower phpxmlrpc
- name: reset dependencies to the lowest version
run: 'composer update --prefer-lowest phpxmlrpc/phpxmlrpc'
- name: run tests again
run: ./vendor/bin/phpunit -v tests
# @todo would it be useful to run a 2nd test with composer --prefer-lowest? After all the only dependencies we have are testing tools
- name: failure troubleshooting
if: ${{ failure() }}
run: |
#env
#php -i
#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
if [ -d /var/log/apache2 ]; then sudo cat /var/log/apache2/error.log; fi
if [ -d /var/log/apache2 ]; then sudo cat /var/log/apache2/other_vhosts_access.log; fi
sudo cat /var/log/php*.log