name: Unit Tests

on: [push, pull_request]

jobs:
  safe-writer:
    runs-on: ${{ matrix.operating-system }}
    strategy:
      fail-fast: false
      max-parallel: 15
      matrix:
        operating-system: [macOS-latest, ubuntu-latest, windows-latest]
        php-versions: ['7.3', '7.4', '8.0']
    name: PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
          extension-csv: mbstring, xmlwriter

      - name: Install dependencies
        run: composer update --no-progress --optimize-autoloader

      - name: Run tests
        run: composer test
