translation/laravel

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: Build Status

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        php:
          - 7.1
          - 7.2
          - 7.3
          - 7.4
          - 8.0
          - 8.1
          - 8.2
          - 8.3
        composer_flag:
          - --prefer-lowest
          -
        exclude:
          - php: 7.3       # Temporarily disabled, tests pass but something went wrong with spatie/laravel-ray just after: https://github.com/translation/laravel/runs/5251579489
            composer_flag: # => It shouldn't impact the package, just the tests. Try to uncomment later.
          - php: 7.4       # Temporarily disabled, tests pass but something went wrong with spatie/laravel-ray just after: https://github.com/translation/laravel/runs/5251579528
            composer_flag: # => It shouldn't impact the package, just the tests. Try to uncomment later.
          - php: 7.4
            composer_flag: --prefer-lowest # php-vcr 1.3 (--prefer-lowest) uses Symfony\Components\EventDispatcher\Event and is compatible for Laravel < 7  and PHP < 7.4
          - php: 8.0                       # php-vcr 1.4.4.4 (latest)      uses Symfony\Contracts\EventDispatcher\Event  and is compatible for Laravel >= 7 and PHP >= 7.1
            composer_flag: --prefer-lowest # => PHP >=7.4 cannot work with --prefer-lowest and resolve these contraints (only used for test environment in 'require-dev', no impact in production)
          - php: 8.1                       # /
            composer_flag: --prefer-lowest # /
          - php: 8.2                       # /
            composer_flag: --prefer-lowest # /
          - php: 8.3                       # /
            composer_flag: --prefer-lowest # /
    env:
      COMPOSER_MEMORY_LIMIT: -1
      CC_TEST_REPORTER_ID: 2f4620ac239cc7fdb27b299c24422281b04fd8012820ba173e92c70953385958
    steps:
      - uses: actions/checkout@v4
      - name: Install PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
        env:
          COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }}
      - name: Cache PHP dependencies
        uses: actions/cache@v4
        with:
          path: vendor
          key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.composer_flag }}-${{ hashFiles('**/composer.json') }}
          restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.composer_flag }}-
      - name: Install dependencies
        run: composer update --no-interaction --prefer-stable ${{ matrix.composer_flag }}
      - name: Run Specs
        run: vendor/bin/phpunit
      - name: Publish code coverage
        if: ${{ matrix.php == '8.1' && matrix.composer_flag == '' }} # only one is needed!
        uses: paambaati/codeclimate-action@v3.2.0
        with:
          coverageLocations: './build/logs/clover.xml:clover'
          debug: true
          verifyDownload: true