name: "Code Coverage"

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

env:
  COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"

jobs:
  tests:
    name: "Code Coverage"

    runs-on: ubuntu-latest

    steps:
      - name: "Checkout"
        uses: "actions/checkout@v4"

      - name: "Install PHP"
        uses: "shivammathur/setup-php@v2"
        with:
          extensions: "intl, zip"
          ini-values: "memory_limit=-1, phar.readonly=0, error_reporting=E_ALL, display_errors=On"
          php-version: "7.4"
          tools: composer
          coverage: xdebug2

      - name: "Update dependencies"
        run: "composer update ${{ env.COMPOSER_FLAGS }}"

      - name: "Run coverage"
        run: "composer coverage"
