bkdotcom/HttpMessage

View on GitHub
.github/workflows/phpunit.yml

Summary

Maintainability
Test Coverage
name: PHPUnit
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
jobs:
  run:
    runs-on: ${{ matrix.operating-system }}
    strategy:
      matrix:
        # windows-latest, macOS-latest
        operating-system: [ubuntu-latest]
        php-version: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
    name: PHP ${{ matrix.php-version }} Test on ${{ matrix.operating-system }}
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Install PHP
      uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action
      with:
        php-version: ${{ matrix.php-version }}
        extensions: intl
        ini-values: post_max_size=256M, memory_limit=512M
        coverage: xdebug #optional
    - name: Check PHP Version
      run: php -v
    - name: Validate composer.json and composer.lock
      run: composer validate --strict
    - name: Cache composer packages
      uses: actions/cache@v2
      id: composer-cache
      with:
        path: vendor
        key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
        restore-keys: |
          ${{ runner.os }}-php-
    - name: Install dependencies
      run: |
        composer --version
        composer install --prefer-dist --no-progress
    - name: Unit test
      run: composer run test
    - name: Publish code coverage
      uses: paambaati/codeclimate-action@v3.0.0
      if: ${{ matrix.php-version == '7.4' && github.ref_name == 'main' }}
      continue-on-error: true
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
      with:
        debug: false
        coverageCommand: vendor/bin/phpunit --coverage-clover coverage/clover.xml
        coverageLocations: coverage/clover.xml:clover
    - name: Coverage summary
      if: ${{ matrix.php-version == '7.4' && github.ref_name == 'main' }}
      continue-on-error: true
      run: php -f vendor/bdk/devutil/src/coverageChecker.php -- coverage/clover.xml