diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1cd4ea2..512652a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,48 +1,84 @@ name: CI on: - push: - branches: [ master ] - pull_request: - branches: [ master ] + push: + branches: [ master ] + pull_request: + branches: [ master ] jobs: - checks: - runs-on: ubuntu-latest - name: 'Check' - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Get composer cache directory - id: composer-cache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - coverage: pcov - tools: infection, pint, phpstan - - - name: Install dependencies - run: composer install - - - name: Check platform requirements - run: composer check-platform-reqs - - - name: Pint - run: pint --test - - - name: Infection - run: infection --min-msi=100 - - - name: PHPStan - run: phpstan + checks: + runs-on: ubuntu-latest + name: 'Check' + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + coverage: pcov + tools: infection, pint, phpstan + + - name: Install dependencies + run: composer install + + - name: Check platform requirements + run: composer check-platform-reqs + + - name: Pint + run: pint --test + + - name: Infection + run: infection --min-msi=100 + + - name: PHPStan + run: phpstan + tests: + runs-on: ubuntu-latest + name: 'Test' + strategy: + matrix: + php-version: ['8.1', '8.2', '8.3'] + phpunit-versions: ['^9.0', '^10.0', '^11.0'] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-php-${{ matrix.php-versions}}-phpunit-${{ matrix.phpunit-versions }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-php-${{ matrix.php-versions}}-phpunit-${{ matrix.phpunit-versions }}-composer- + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: pcov + tools: infection, pint, phpstan + + - name: Install dependencies + run: | + composer require phpunit/phpunit:${{ matrix.phpunit-versions }} --no-update + composer update + + - name: PHPUnit + run: ./vendor/bin/phpunit