name: CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        php: [7.x, 8.x]

    steps:
      - uses: actions/checkout@v3
      - name: Use PHP ${{ matrix.php }}
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          tools: composer:v2
          coverage: none
      - name: Setup problem matchers
        run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
      - name: Install latest dependencies
        uses: nick-invision/retry@v2
        with:
          timeout_minutes: 5
          max_attempts: 5
          command: composer update --no-interaction --no-progress
      - run: vendor/bin/phpunit
