# Run coverage report and upload it
name: Coverage
on:
  push:
    branches: [master]
jobs:
  coverage:
    name: coverage
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Setup PHP, with composer and extensions
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.0
          extensions: mbstring, dom, json, libxml, xml, xmlwriter
          coverage: pcov
      - name: Install dependencies
        run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
      - name: Generate coverage report
        run: composer coverage:clover
      - name: Upload coverage report to Scrutinizer
        uses: sudo-bot/action-scrutinizer@latest
        with:
          cli-args: "--format=php-clover clover.xml"
