90 lines
2.5 KiB
YAML
90 lines
2.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
pull_request:
|
|
branches: [ main, master ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
php-version: ['8.0', '8.1', '8.2', '8.3', '8.4']
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
coverage: none
|
|
|
|
- name: Cache Composer
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.composer/cache
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-composer-
|
|
|
|
- name: Install dependencies
|
|
env:
|
|
COMPOSER_MEMORY_LIMIT: -1
|
|
run: composer install --no-progress --prefer-dist --no-interaction
|
|
|
|
- name: Dependency audit (Composer)
|
|
run: composer audit --no-interaction
|
|
|
|
- name: Run tests (PHPUnit)
|
|
run: vendor/bin/phpunit --configuration phpunit.xml --testdox
|
|
|
|
- name: Run static analysis (PHPStan)
|
|
run: vendor/bin/phpstan analyse -c phpstan.neon
|
|
lint:
|
|
name: PHP Lint & Basic Checks (matrix)
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
php: [ '8.0', '8.1', '8.2' ]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
|
|
- name: Show PHP version
|
|
run: php -v
|
|
|
|
- name: Install composer dependencies
|
|
run: |
|
|
composer --version || (curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer)
|
|
composer install --no-progress --no-suggest --prefer-dist --no-interaction
|
|
|
|
- name: PHP -l lint (all .php files)
|
|
run: |
|
|
set -euo pipefail
|
|
echo "Finding PHP files..."
|
|
find . -name '*.php' -not -path './vendor/*' -print0 | xargs -0 -n1 -P4 php -l
|
|
|
|
- name: Run PHPStan static analysis
|
|
run: |
|
|
set -euo pipefail
|
|
vendor/bin/phpstan analyse --no-progress -c phpstan.neon
|
|
|
|
- name: Run PHPUnit
|
|
run: |
|
|
set -euo pipefail
|
|
if [ -x vendor/bin/phpunit ]; then
|
|
vendor/bin/phpunit --configuration phpunit.xml --colors=always
|
|
else
|
|
echo 'phpunit not installed; skipping tests (composer install should have installed dev deps).'
|
|
exit 0
|
|
fi
|