bkdotcom/CssXpath

View on GitHub
.github/workflows/phpunit.yml

Summary

Maintainability
Test Coverage
name: PHPUnit
on: [push, pull_request]
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']
    name: PHP ${{ matrix.php-version }} Test on ${{ matrix.operating-system }}
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    - name: Install PHP
      uses: shivammathur/setup-php@v2 # https://github.com/marketplace/actions/setup-php-action
      with:
        php-version: ${{ matrix.php-version }}
        extensions: intl #optional
        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@v3
      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@v4.0.0
      if: matrix.php-version == '8.2' && ${{ github.ref_name == 'master' }}
      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