readme #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ${{ matrix.operating-system }} | |
# @todo enable testing of server-side, using apache + php-fpm | |
#env: | |
# HTTPSERVER: localhost | |
# URI: /tests/server.php | |
# DEBUG: 0 | |
strategy: | |
fail-fast: false | |
matrix: | |
# @see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners for available os versions | |
include: | |
# These 2 php versions should be supported on either Ubuntu 20 or 22, but we need a lower phpunit version in composer.json | |
#- php: 5.4 | |
# operating-system: 'ubuntu-20.04' | |
# code-coverage: none- | |
#- php: 5.5 | |
# operating-system: 'ubuntu-20.04' | |
# code-coverage: none | |
- php: 5.6 | |
operating-system: 'ubuntu-20.04' | |
code-coverage: none | |
- php: 7.0 | |
operating-system: 'ubuntu-20.04' | |
code-coverage: none | |
- php: 7.1 | |
operating-system: 'ubuntu-20.04' | |
code-coverage: codecov | |
- php: 7.2 | |
operating-system: 'ubuntu-22.04' | |
code-coverage: none | |
- php: 7.3 | |
operating-system: 'ubuntu-22.04' | |
code-coverage: none | |
- php: 7.4 | |
operating-system: 'ubuntu-22.04' | |
code-coverage: xdebug | |
- php: 8.0 | |
operating-system: 'ubuntu-22.04' | |
code-coverage: none | |
- php: 8.1 | |
operating-system: 'ubuntu-22.04' | |
code-coverage: none | |
- php: 8.2 | |
operating-system: 'ubuntu-22.04' | |
code-coverage: none | |
- php: 8.3 | |
operating-system: 'ubuntu-22.04' | |
code-coverage: none | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
# @todo stop any unused service and process to save ram/cpu: php-fpm (esp. if a != php version), docker, | |
# containerd, snapd, ModemManager?, pakagekit?, xsp4.exe | |
#- name: set up apache | |
# run: | | |
# sudo apt-get update -qq | |
# chmod 755 ./tests/ci/setup/*.sh | |
# sudo ./tests/ci/setup/setup_apache.sh | |
# @todo when setting up apache, we most likely will have to configure php-fpm. Maybe we are better off with | |
# setup_php than with shivammathur/setup-php... | |
- name: set up php | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: 'dom, curl, mbstring, xdebug, xmlrpc' | |
ini-values: 'cgi.fix_pathinfo=1, always_populate_raw_post_data=-1' | |
coverage: ${{ matrix.code-coverage }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# @todo make sure we always build and enable the xmlrpc extension, when not available via shivammathur | |
# @todo add caching of composer dependencies | |
- name: install dependencies | |
run: composer install --no-progress --prefer-dist | |
- name: run tests with phpunit and upload code coverage if needed | |
run: | | |
if [ "${{ matrix.code-coverage }}" != 'none' ]; then | |
vendor/bin/phpunit -v --coverage-clover=coverage.clover tests | |
else | |
vendor/bin/phpunit -v tests | |
fi | |
if [ -f coverage.clover ]; then | |
curl -Os https://uploader.codecov.io/latest/linux/codecov && \ | |
chmod +x codecov && \ | |
./codecov -f coverage.clover | |
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 | |
- name: troubleshoot | |
if: ${{ failure() }} | |
run: | | |
# Troubleshoot test env build problems | |
#ps auxwww | |
#'sudo find /etc/php | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/"' | |
php -i | |
#ls -la /run/php | |
#ls -ltr /var/log | |
#sudo ls -ltr /var/log/apache2 | |
#'sudo find /etc/apache2 | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/"' | |
# Show as much info as we can to help developers | |
#sudo cat /var/log/apache2/error.log | |
#sudo cat /var/log/apache2/other_vhosts_access.log | |
sudo cat /var/log/php*.log |