name: Integration tests

on:
  push:
    branches:
      - main
  pull_request:
    paths:
      - composer.json
      - composer.lock
      - src/**
      - integration/**

jobs:
  drupal8:
    strategy:
      matrix:
        php: ["7.2", "7.3", "7.4"]
    defaults:
      run:
        working-directory: integration/drupal8
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: shivammathur/setup-php@v2
        with:
          php-version: "${{ matrix.php }}"
          tools: composer
      - run: composer update
      - run: |
          php vendor/bin/drush site:install \
            --db-url=sqlite://sites/default/files/.ht.sqlite \
            --site-name="Nuxeo Drupal Integration" \
            --account-name=admin \
            --account-pass=admin \
            --site-mail=void@null.com \
            --yes \
            minimal
      - run: php vendor/bin/drush en nuxeo
      - run: php vendor/bin/drush cr
      - run: vendor/bin/phpunit
  drupal9:
    strategy:
      matrix:
        php: ["7.3", "7.4"]
    defaults:
      run:
        working-directory: integration/drupal9
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: shivammathur/setup-php@v2
        with:
          php-version: "${{ matrix.php }}"
          tools: composer
      - run: composer update
      - run: |
          php vendor/bin/drush site:install \
            --db-url=sqlite://sites/default/files/.ht.sqlite \
            --site-name="Nuxeo Drupal9 Integration" \
            --account-name=admin \
            --account-pass=admin \
            --site-mail=void@null.com \
            --yes \
            minimal
      - run: php vendor/bin/drush en nuxeo
      - run: php vendor/bin/drush cr
      - run: vendor/bin/phpunit
  symfony4:
    strategy:
      matrix:
        php: ["7.2", "7.3", "7.4"]
    defaults:
      run:
        working-directory: integration/symfony4
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: shivammathur/setup-php@v2
        with:
          php-version: "${{ matrix.php }}"
          tools: composer
      - run: composer update
      - run: vendor/bin/phpunit
  symfony5:
    strategy:
      matrix:
        php: ["7.2", "7.3", "7.4", "8.0", "8.1"]
    defaults:
      run:
        working-directory: integration/symfony5
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: shivammathur/setup-php@v2
        with:
          php-version: "${{ matrix.php }}"
          tools: composer
      - run: composer update
      - run: vendor/bin/phpunit
  laravel8:
    strategy:
      matrix:
        php: ["7.3", "7.4", "8.0", "8.1"]
    defaults:
      run:
        working-directory: integration/laravel8
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: shivammathur/setup-php@v2
        with:
          php-version: "${{ matrix.php }}"
          tools: composer
      - run: composer update
      - run: vendor/bin/phpunit
