|
1 | 1 | name: Tests |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | | - paths: |
6 | | - - 'config/**' |
7 | | - - 'src/**' |
8 | | - - 'tests/**' |
9 | | - - '.github/workflows/tests.yml' |
10 | | - - 'composer.json' |
11 | | - push: |
12 | | - branches: ['main'] |
13 | | - paths: |
14 | | - - 'config/**' |
15 | | - - 'src/**' |
16 | | - - 'tests/**' |
17 | | - - '.github/workflows/tests.yml' |
18 | | - - 'composer.json' |
19 | | - workflow_dispatch: |
| 4 | + push: |
| 5 | + pull_request: |
20 | 6 |
|
21 | 7 | jobs: |
22 | | - test: |
23 | | - name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} |
24 | | - runs-on: 'ubuntu-latest' |
25 | | - |
26 | | - strategy: |
27 | | - matrix: |
28 | | - php: |
29 | | - - "8.1" |
30 | | - - "8.2" |
31 | | - - "8.3" |
32 | | - - "8.4" |
33 | | - laravel: |
34 | | - - "9" |
35 | | - - "10" |
36 | | - - "11" |
37 | | - exclude: |
38 | | - - php: "8.1" |
39 | | - laravel: "11" |
40 | | - |
41 | | - steps: |
42 | | - - name: Checkout code |
43 | | - uses: actions/checkout@v4 |
44 | | - |
45 | | - - name: Setup PHP |
46 | | - uses: shivammathur/setup-php@v2 |
47 | | - with: |
48 | | - php-version: ${{ matrix.php }} |
49 | | - extensions: ctype, dom, grpc, json, mbstring, openssl, xml, zip, zlib |
50 | | - coverage: xdebug |
51 | | - |
52 | | - - name: Install dependencies |
53 | | - run: | |
54 | | - composer require -W "illuminate/contracts:^${{ matrix.laravel }}.0" |
55 | | - composer require -W --dev orchestra/testbench |
56 | | -
|
57 | | - - name: Setup Problem Matchers |
58 | | - run: | |
59 | | - echo "::add-matcher::${{ runner.tool_cache }}/php.json" |
60 | | - echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
61 | | -
|
62 | | - - name: Run PHPUnit |
63 | | - run: vendor/bin/phpunit --coverage-clover=coverage.xml --log-junit=test-report.xml --testdox |
64 | | - |
65 | | - - name: Upload code coverage |
66 | | - uses: codecov/codecov-action@v5 |
67 | | - with: |
68 | | - token: ${{ secrets.CODECOV_TOKEN }} |
| 8 | + test: |
| 9 | + runs-on: 'ubuntu-latest' |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + php: ['7.4'] |
| 14 | + laravel: ['6.0', '7.0', '8.0'] |
| 15 | + include: |
| 16 | + - laravel: '8.0' |
| 17 | + testbench: '6.0' |
| 18 | + - laravel: '7.0' |
| 19 | + testbench: '5.2' |
| 20 | + - laravel: '6.0' |
| 21 | + testbench: '4.8' |
| 22 | + |
| 23 | + name: Laravel ${{ matrix.laravel }} |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout code |
| 27 | + uses: actions/checkout@v2 |
| 28 | + |
| 29 | + - name: Setup PHP |
| 30 | + uses: shivammathur/setup-php@v2 |
| 31 | + with: |
| 32 | + php-version: ${{ matrix.php }} |
| 33 | + extensions: ctype, dom, json, mbstring, openssl, xml, zip, zlib |
| 34 | + coverage: xdebug |
| 35 | + |
| 36 | + - name: Get Composer Cache Directory |
| 37 | + id: composer-cache |
| 38 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 39 | + |
| 40 | + - name: Cache dependencies |
| 41 | + uses: actions/cache@v2 |
| 42 | + with: |
| 43 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 44 | + key: ${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} |
| 45 | + |
| 46 | + - name: Install dependencies |
| 47 | + run: | |
| 48 | + composer require "laravel/framework:^${{ matrix.laravel }}" "orchestra/testbench:^${{ matrix.testbench }}" --no-interaction --no-update |
| 49 | + composer update --prefer-dist --no-interaction --no-suggest |
| 50 | +
|
| 51 | + - name: Setup Problem Matchers for PHPUnit |
| 52 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 53 | + |
| 54 | + - name: Execute tests |
| 55 | + run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml --log-junit=test-report.xml |
| 56 | + |
| 57 | + - name: Upload code coverage |
| 58 | + uses: codecov/codecov-action@v1 |
| 59 | + with: |
| 60 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments