name: CI

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  build-lowest:
    name: Build lowest
    runs-on: ubuntu-latest

    steps:
      - name: Set up PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '5.5'
          coverage: none
          extensions: mbstring, intl

      - name: Set up Node
        uses: actions/setup-node@v1
        with:
          node-version: '14.x'

      - name: Setup Problem Matchers for PHPUnit
        run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

      - name: Checkout code
        uses: actions/checkout@v2

      - name: Download dependencies
        run: composer update --no-interaction --no-progress --prefer-stable --prefer-lowest

      - name: Run tests
        run: make test

  build:
    name: Build
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 10
      matrix:
        php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4']

    steps:
      - name: Set up PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          coverage: none
          extensions: mbstring, intl

      - name: Set up Node
        uses: actions/setup-node@v1
        with:
          node-version: '14.x'

      - name: Setup Problem Matchers for PHPUnit
        run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

      - name: Checkout code
        uses: actions/checkout@v2

      - name: Download dependencies
        run: composer update --no-interaction --no-progress

      - name: Run tests
        run: make test
