name: Bundle CI
on:
  push:
    branches: ['main']
  pull_request:
  schedule:
    - cron: '0 */12 * * *'

jobs:
  tests:
    name: "Tests ${{ matrix.php-version }} deps ${{ matrix.dependency-versions }}"
    runs-on: ubuntu-18.04

    strategy:
      fail-fast: false
      matrix:
        # normal, highest, non-dev installs
        php-version: ['7.2', '7.3', '7.4', '8.0', '8.1']
        dependency-versions: ['highest']
        include:
          # testing lowest PHP version with lowest dependencies
          - php-version: '7.2.5'
            dependency-versions: 'lowest'

          # testing dev versions with highest PHP
          - php-version: '8.0'
            dependency-versions: 'highest'

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

      - name: "Install PHP"
        uses: "shivammathur/setup-php@v2"
        with:
            coverage: "none"
            php-version: "${{ matrix.php-version }}"

      - name: Install Global Dependencies
        run: |
          composer global require --no-progress --no-scripts --no-plugins symfony/flex @dev

      - name: "Composer install"
        uses: "ramsey/composer-install@v2"
        with:
            dependency-versions: "${{ matrix.dependency-versions }}"
            composer-options: "--prefer-dist --no-progress"

      - name: Run tests
        env:
          SYMFONY_DEPRECATIONS_HELPER: "max[self]=0"
          SYMFONY_PHPUNIT_VERSION: "8.5"
        run: ./vendor/bin/simple-phpunit
