.github/workflows/main.yml
name: "CI"
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: "read"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# composer validation
composer:
name: "composer config validation"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "Validate composer.json"
run: "composer validate --strict"
# PHP lint and PHPStan for different PHP versions
php:
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
name: "PHP ${{ matrix.php-version }}"
steps:
- name: "git checkout"
uses: "actions/checkout@v3"
- name: "setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "xdebug"
- name: "check PHP version"
run: "php -v"
- name: "lint PHP files"
run: "php -l src/"
- name: "install composer dependencies"
run: "composer install --prefer-dist --no-progress"
# PHPStan
- name: "PHPStan static analysis"
uses: "php-actions/phpstan@v3"
with:
php_version: "${{ matrix.php-version }}"
configuration: "phpstan.neon"
path: "src/"
codesniffer:
runs-on: "ubuntu-latest"
steps:
- name: "git checkout"
uses: "actions/checkout@v3"
- name: "Install PHP_CodeSniffer"
run: "curl -OLf https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar"
- name: "check PHP_CodeSniffer version"
run: "php phpcs.phar --version"
- name: "PHP CodeSniffer"
run: "php phpcs.phar"