|
| 1 | +name: Unit tests |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + unit-tests: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + php: [7.4, 7.3] |
| 12 | + laravel: [8.*, 7.*] |
| 13 | + include: |
| 14 | + - laravel: 8.* |
| 15 | + testbench: 6.* |
| 16 | + - laravel: 7.* |
| 17 | + testbench: ^5.2 |
| 18 | + |
| 19 | + name: PHP${{ matrix.php }} - L${{ matrix.laravel }} |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout code |
| 23 | + uses: actions/checkout@v1 |
| 24 | + |
| 25 | + - name: Setup PHP |
| 26 | + uses: shivammathur/setup-php@v2 |
| 27 | + with: |
| 28 | + php-version: ${{ matrix.php }} |
| 29 | + tools: composer:v2, phive |
| 30 | + coverage: xdebug |
| 31 | + |
| 32 | + - name: Get Composer Cache Directory |
| 33 | + id: composer-cache |
| 34 | + run: | |
| 35 | + echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 36 | +
|
| 37 | + - uses: actions/cache@v2 |
| 38 | + with: |
| 39 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 40 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.php }}-php${{ matrix.php }}-L${{ matrix.laravel }} |
| 41 | + restore-keys: | |
| 42 | + ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.php }}-php${{ matrix.php }} |
| 43 | + ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.php }} |
| 44 | + ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 45 | + ${{ runner.os }}-composer- |
| 46 | +
|
| 47 | + - name: Install dependencies |
| 48 | + run: | |
| 49 | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update |
| 50 | + composer update --prefer-dist --no-interaction --no-suggest |
| 51 | + phive --no-progress install --trust-gpg-keys 4AA394086372C20A,CF1A108D0E7AE720,E82B2FB314E9906E |
| 52 | +
|
| 53 | + - name: Execute unit tests |
| 54 | + run: |
| 55 | + tools/phpunit tests/Unit |
| 56 | + |
| 57 | + - name: Execute feature tests |
| 58 | + run: |
| 59 | + tools/phpunit tests/Feature |
0 commit comments