kylekatarnls/carbonite

View on GitHub
.github/workflows/tests.yml

Summary

Maintainability
Test Coverage
name: Tests

on:
  push:
    branches: [ '**' ]
  pull_request:
    branches: [ '**' ]

jobs:
  tests:
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        php: [ '8.2', '8.3' ]
        setup: [ 'lowest', 'stable', 'next' ]

    name: PHP ${{ matrix.php }} - ${{ matrix.setup }}

    steps:
      - uses: actions/checkout@v2

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          extensions: json
          tools: composer:v2
          coverage: none

      - name: Cache Composer packages
        id: composer-cache
        uses: actions/cache@v3
        with:
          path: vendor
          key: ${{ runner.os }}-php-${{ matrix.php }}-c-${{ startsWith(matrix.carbon, '^3') && '3' || '2' }}-${{ matrix.setup }}-${{ hashFiles('**/composer.json') }}
          restore-keys: |
            ${{ runner.os }}-php-${{ matrix.php }}-c-${{ startsWith(matrix.carbon, '^3') && '3' || '2' }}-${{ matrix.setup }}-

      - name: Install dependencies
        if: steps.composer-cache.outputs.cache-hit != 'true'
        run: |
          composer remove --no-update phpstan/phpstan phan/phan vimeo/psalm phpmd/phpmd squizlabs/php_codesniffer friendsofphp/php-cs-fixer --no-interaction;
          composer update --prefer-dist --no-progress ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }};

      - name: Run test suite
        run: vendor/bin/phpunit --display-incomplete --display-skipped --display-deprecations --display-errors --display-notices --display-warnings