name: CI

on:
    push:
    pull_request:

jobs:
    ci:
        runs-on: ubuntu-latest
        name: CI
        strategy:
            matrix:
                php: [ '7.4', '8.0', '8.1' ]
        steps:
            - name: Checkout
              uses: actions/checkout@v2

            - name: Setup PHP
              uses: shivammathur/setup-php@v2
              with:
                  php-version: ${{ matrix.php }}

            - name: Composer update
              run: composer update --prefer-dist

            - name: PHP CS check
              run: vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run --diff

            - name: Unit Tests
              run: vendor/bin/phpunit

            - name: Demo Run
              run: php demo/demo.php
