|
| 1 | +name: tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +jobs: |
| 12 | + tests: |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + |
| 15 | + strategy: |
| 16 | + fail-fast: true |
| 17 | + matrix: |
| 18 | + os: [ ubuntu-latest ] |
| 19 | + php: [ 8.4, 8.3, 8.2, 8.1, 8.0, 7.4, 7.2 ] |
| 20 | + laravel: [ 12.*, 11.*, 10.*, 9.*, 8.*, 7.*, 6.*, ^5.6 ] |
| 21 | + stability: [ prefer-lowest, prefer-stable ] |
| 22 | + include: |
| 23 | + - laravel: 12.* |
| 24 | + testbench: 10.* |
| 25 | + carbon: ^3.8.4 |
| 26 | + phpunit: ^11.5.3 |
| 27 | + - laravel: 11.* |
| 28 | + testbench: 9.* |
| 29 | + carbon: ^2.63 |
| 30 | + phpunit: ^10.5 |
| 31 | + - laravel: 10.* |
| 32 | + testbench: 8.* |
| 33 | + carbon: ^2.63 |
| 34 | + phpunit: ^10.5 |
| 35 | + - laravel: 9.* |
| 36 | + testbench: 7.* |
| 37 | + carbon: ^2.63 |
| 38 | + phpunit: ^9.5 |
| 39 | + - laravel: 8.* |
| 40 | + testbench: ^6.44 |
| 41 | + carbon: ^2.63 |
| 42 | + phpunit: ^9.5 |
| 43 | + - laravel: 7.* |
| 44 | + testbench: 5.* |
| 45 | + carbon: ^2.63 |
| 46 | + phpunit: ^8.5 |
| 47 | + - laravel: 6.* |
| 48 | + testbench: 4.* |
| 49 | + carbon: ^2.63 |
| 50 | + phpunit: ^8.5 |
| 51 | + - laravel: ^5.6 |
| 52 | + testbench: ^3.6 |
| 53 | + carbon: ^2.63 |
| 54 | + phpunit: ^8.5 |
| 55 | + exclude: |
| 56 | + - laravel: 12.* |
| 57 | + php: 8.1 |
| 58 | + - laravel: 12.* |
| 59 | + php: 8.0 |
| 60 | + - laravel: 12.* |
| 61 | + php: 7.4 |
| 62 | + - laravel: 12.* |
| 63 | + php: 7.2 |
| 64 | + - laravel: 11.* |
| 65 | + php: 8.1 |
| 66 | + - laravel: 11.* |
| 67 | + php: 8.0 |
| 68 | + - laravel: 11.* |
| 69 | + php: 7.4 |
| 70 | + - laravel: 11.* |
| 71 | + php: 7.2 |
| 72 | + - laravel: 10.* |
| 73 | + php: 8.0 |
| 74 | + - laravel: 10.* |
| 75 | + php: 7.4 |
| 76 | + - laravel: 10.* |
| 77 | + php: 7.2 |
| 78 | + - laravel: 9.* |
| 79 | + php: 7.4 |
| 80 | + - laravel: 9.* |
| 81 | + php: 7.2 |
| 82 | + - laravel: 8.* |
| 83 | + php: 7.2 |
| 84 | + - laravel: 7.* |
| 85 | + php: 8.4 |
| 86 | + - laravel: 7.* |
| 87 | + php: 8.3 |
| 88 | + - laravel: 7.* |
| 89 | + php: 8.2 |
| 90 | + - laravel: 7.* |
| 91 | + php: 8.1 |
| 92 | + - laravel: 6.* |
| 93 | + php: 8.4 |
| 94 | + - laravel: 6.* |
| 95 | + php: 8.3 |
| 96 | + - laravel: 6.* |
| 97 | + php: 8.2 |
| 98 | + - laravel: 6.* |
| 99 | + php: 8.1 |
| 100 | + - laravel: ^5.6 |
| 101 | + php: 8.4 |
| 102 | + - laravel: ^5.6 |
| 103 | + php: 8.3 |
| 104 | + - laravel: ^5.6 |
| 105 | + php: 8.2 |
| 106 | + - laravel: ^5.6 |
| 107 | + php: 8.1 |
| 108 | + - laravel: ^5.6 |
| 109 | + php: 8.0 |
| 110 | + |
| 111 | + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} |
| 112 | + |
| 113 | + steps: |
| 114 | + - name: Checkout code |
| 115 | + uses: actions/checkout@v4 |
| 116 | + |
| 117 | + - name: Install SQLite 3 |
| 118 | + run: | |
| 119 | + sudo apt-get update |
| 120 | + sudo apt-get install sqlite3 -y |
| 121 | +
|
| 122 | + - name: Setup PHP |
| 123 | + uses: shivammathur/setup-php@v2 |
| 124 | + with: |
| 125 | + php-version: ${{ matrix.php }} |
| 126 | + extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv |
| 127 | + coverage: ${{ startsWith(github.event.head_commit.message, 'coverage') && matrix.php == '8.4' && matrix.laravel == '12.*' && matrix.stability == 'prefer-stable' && 'xdebug' || 'none' }} |
| 128 | + |
| 129 | + - name: Install dependencies |
| 130 | + run: | |
| 131 | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" "phpunit/phpunit:${{ matrix.phpunit }}" --no-interaction --no-update |
| 132 | + composer update --${{ matrix.stability }} --prefer-dist --no-interaction |
| 133 | +
|
| 134 | + - name: Execute tests |
| 135 | + run: | |
| 136 | + vendor/bin/phpunit ${{ startsWith(github.event.head_commit.message, 'coverage') && matrix.php == '8.4' && matrix.laravel == '12.*' && matrix.stability == 'prefer-stable' && '--coverage-clover=clover.xml' || '' }} |
| 137 | +
|
| 138 | + - name: Make code coverage badge |
| 139 | + if: startsWith(github.event.head_commit.message, 'coverage') && matrix.php == '8.4' && matrix.laravel == '12.*' && matrix.stability == 'prefer-stable' |
| 140 | + uses: timkrase/phpunit-coverage-badge@v1.2.1 |
| 141 | + with: |
| 142 | + coverage_badge_path: .github/coverage.svg |
| 143 | + push_badge: true |
| 144 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments