Finesse/QueryScribe

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: Test
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        php-version: ['7.0', '7.1', '7.2', '7.3', '7.4']
        dependencies: ['low', 'high']
        include:
          - php-version: '7.0'
            dependencies: 'high'
            report-coverage: true
    name: PHP ${{ matrix.php-version }}, ${{ matrix.dependencies }} dependencies
    steps:
      - name: Checkout
        uses: actions/checkout@master
      - name: Install PHP
        uses: shivammathur/setup-php@1.5.6
        with:
          php-version: ${{ matrix.php-version }}
          extension-csv: dom, mbstring
      - name: Install dependencies
        run: |
          if [[ ${{ matrix.dependencies }} = high ]]
            then composer update
            else composer update --prefer-lowest
          fi
      - name: Test and publish code coverage
        if: matrix.report-coverage
        uses: paambaati/codeclimate-action@v2.3.0
        env:
          # Get it on https://codeclimate.com/repos/{repo id}/settings/test_reporter
          CC_TEST_REPORTER_ID: 736f54e5e97643f961e9ba86ba0d4816f417b7e0cad6846a29572ff4738e867d
        with:
          # The report file must be there, otherwise Code Climate won't find it
          coverageCommand: php vendor/bin/phpunit --coverage-text --coverage-clover ./clover.xml
          debug: true
      - name: Test
        if: "!matrix.report-coverage"
        run: php vendor/bin/phpunit --coverage-text