phpunit #468
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: phpunit | |
on: | |
workflow_dispatch: | |
inputs: | |
debug: | |
type: boolean | |
default: false | |
push: ~ | |
jobs: | |
phpunit: | |
runs-on: ubuntu-latest | |
services: | |
rabbitmq: | |
image: rabbitmq | |
ports: | |
- 5672:5672 | |
strategy: | |
matrix: | |
# the actual arche-core is run inside the docker container | |
# using the PHP version as provided by the build/docker/Dockerfile | |
# but it allows to check dependencies as the "composer update" is run locally | |
php: [8.1, 8.2, 8.3, 8.4] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
java-package: jdk | |
distribution: oracle | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: gd,json,mbstring,pcre,xmlreader,yaml | |
coverage: xdebug | |
env: | |
fail-fast: true | |
- name: composer update | |
run: | | |
composer update | |
- name: environment | |
run: | | |
docker build -t arche-dev build/docker | |
mkdir log | |
docker run --name arche-dev -v `pwd`:/var/www/html -e USER_UID=`id -u` -e USER_GID=`id -g` -d arche-dev | |
sleep 10 | |
- uses: mxschmitt/action-tmate@v3 | |
if: inputs.debug | |
- name: test-mod_php | |
run: | | |
docker exec -t -e XDEBUG_MODE=coverage -u www-data arche-dev vendor/bin/phpunit | |
- name: test-php_fpm | |
run: | | |
docker exec arche-dev a2dissite mod_php | |
docker exec arche-dev a2ensite php_fpm | |
docker exec -w /root arche-dev supervisorctl restart apache2 | |
docker exec -t -e XDEBUG_MODE=coverage -u www-data arche-dev vendor/bin/phpunit --display-deprecations --display-phpunit-deprecations --display-notices --display-warnings | |
- name: coveralls | |
run: | | |
export COVERALLS_RUN_LOCALLY=1 | |
export COVERALLS_REPO_TOKEN=${{ secrets.coverallsToken }} | |
rm -fR composer.json composer.lock vendor | |
composer require php-coveralls/php-coveralls | |
sudo rm -fR /var/www/html | |
sudo ln -s "`pwd`" /var/www/html | |
vendor/bin/php-coveralls -v | |
- name: debug | |
if: ${{ always() }} | |
run: | | |
echo "---------- config.yaml:" | |
cat tests/config.yaml | |
echo "---------- apache.conf:" | |
docker exec arche-dev cat /etc/apache2/sites-available/000-default.conf | |
echo "---------- apache error log" | |
docker exec arche-dev cat /var/log/apache2/error.log | |
echo "---------- apache access log" | |
docker exec arche-dev cat /var/log/apache2/access.log | |
echo "---------- txlog:" | |
docker exec arche-dev cat /tmp/arche-core/log/txlog | |
echo "---------- restlog:" | |
docker exec arche-dev cat /tmp/arche-core/log/restlog | |
phpstan: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.4 | |
- uses: actions/cache@v4 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: composer | |
run: composer update | |
- name: phpstan | |
run: vendor/bin/phpstan analyse -l 8 src tests || true | |