name: CI

on: [push, pull_request]

jobs:
  tests:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        php: [7.2, 7.3]

    env:
      CODECEPTION_VERSION: 'dev-4.2-backport-useless-test-event as 4.2.0'

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

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          coverage: xdebug

      - name: Prepare dependencies
        run: |
          wget https://robo.li/robo.phar
          php robo.phar prepare:dependencies
          composer update --prefer-source
          php robo.phar prepare:tests
          php robo.phar prepare:test-autoloading
          composer dump-autoload

      - name: Run test suite
        run: |
          php ./codecept run -c vendor/codeception/module-asserts/
          php ./codecept run unit -g core
          php ./codecept run cli