Add CI #1
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: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['8.1', '8.3'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Print PHP version | |
run: php -v | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v4 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Validate composer.json | |
run: composer validate | |
- name: Install dependencies | |
run: composer install --optimize-autoloader --no-progress --no-interaction --prefer-dist | |
- name: Run tests | |
run: vendor/bin/phpunit --testdox | |
- name: Run PHPStan | |
run: vendor/bin/phpstan analyse --level 8 --no-interaction --no-progress src | |
- name: Run PHPCS | |
run: vendor/bin/phpcs src tests --standard=psr2 -s |