|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + schedule: |
| 7 | + - cron: '30 7 * * 1' |
| 8 | + |
| 9 | +jobs: |
| 10 | + tests: |
| 11 | + if: (github.event_name == 'schedule' && github.repository == 'e-commit/doctrine-orm-refetch') || (github.event_name != 'schedule') |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - php-version: '7.2' |
| 17 | + composer-flags: '--prefer-stable --prefer-lowest' |
| 18 | + description: 'with lowest' |
| 19 | + - php-version: '7.2' |
| 20 | + - php-version: '7.3' |
| 21 | + - php-version: '7.4' |
| 22 | + - php-version: '8.0' |
| 23 | + - php-version: '8.0' |
| 24 | + description: 'with Coding Standards' |
| 25 | + coding-standards: true |
| 26 | + |
| 27 | + name: PHP ${{ matrix.php-version }} ${{ matrix.description }} |
| 28 | + |
| 29 | + runs-on: 'ubuntu-latest' |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v2 |
| 34 | + |
| 35 | + - name: Setup PHP |
| 36 | + uses: shivammathur/setup-php@v2 |
| 37 | + with: |
| 38 | + php-version: ${{ matrix.php-version }} |
| 39 | + extensions: "pdo_sqlite" |
| 40 | + coverage: none |
| 41 | + env: |
| 42 | + update: true |
| 43 | + |
| 44 | + - name: Display versions |
| 45 | + run: | |
| 46 | + php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;' |
| 47 | + php -i |
| 48 | +
|
| 49 | + - name: Get Composer cache directory |
| 50 | + id: composer-cache |
| 51 | + run: echo "::set-output name=dir::$(composer config cache-dir)" |
| 52 | + |
| 53 | + - name: Cache dependencies |
| 54 | + uses: actions/cache@v2 |
| 55 | + with: |
| 56 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 57 | + key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}-${{ matrix.composer-flags }} |
| 58 | + restore-keys: composer-${{ runner.os }}-${{ matrix.php-version }}- |
| 59 | + |
| 60 | + - name: Install dependencies |
| 61 | + run: composer update --no-interaction --no-progress ${{ matrix.composer-flags }} |
| 62 | + |
| 63 | + - name: Run PHPUnit |
| 64 | + if: matrix.coding-standards != true |
| 65 | + run: php vendor/phpunit/phpunit/phpunit |
| 66 | + |
| 67 | + - name: Run PHP CS Fixer |
| 68 | + if: matrix.coding-standards |
| 69 | + env: |
| 70 | + PHP_CS_FIXER_IGNORE_ENV: 1 |
| 71 | + run: php vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --diff --dry-run -v |
0 commit comments