11name : Tests
22
33on :
4- # Run testing on all push and pull requests for the main branch that have committed changes in PHP files
4+ # Run testing on all push and pull requests that have committed changes in PHP files
55 push :
6- branches : [ "main" ]
76 paths :
8- - ' **.php'
7+ - ' **/* .php'
98 pull_request :
10- branches : [ "main" ]
119 paths :
12- - ' **.php'
10+ - ' **/* .php'
1311 # Make it possible to run the workflow manually
1412 workflow_dispatch :
1513
@@ -19,58 +17,62 @@ permissions:
1917jobs :
2018 test :
2119
22- runs-on : ${{ matrix.os }}
20+ runs-on : ubuntu-latest
2321
24- # Define the matrix of different PHP and dependency versions
22+ # Define the matrix of different PHP, Laravel, and testbench versions
2523 strategy :
2624 # Fail the whole workflow if one of the jobs fails
2725 fail-fast : true
2826 matrix :
29- os : [ ubuntu-latest ]
30- php : [ 8.2, 8.3, 8.4 ]
31- dependency-version : [ prefer-lowest, prefer-stable ]
32-
33- name : ${{ matrix.os }} / PHP ${{ matrix.php }} / ${{ matrix.dependency-version }}
27+ php : [ 8.3, 8.4, 8.5 ]
28+ laravel : [ 11.*, 12.* ]
29+ dependency-version : [ prefer-stable ]
30+ include :
31+ # Laravel 12 uses Orchestra Testbench 10
32+ - laravel : 12.*
33+ testbench : 10.*
34+ # Laravel 11 uses Orchestra Testbench 9
35+ - laravel : 11.*
36+ testbench : 9.*
37+ name : PHP ${{ matrix.php }} / L${{ matrix.laravel }} / ${{ matrix.dependency-version }}
3438
3539 steps :
3640
3741 # - name: Configure operating system
38- # if: matrix.os == 'ubuntu-latest'
3942 # run: sudo apt-get update && sudo apt-get install -y locales locales-all
4043
4144 - name : Checkout code
42- uses : actions/checkout@v4
45+ uses : actions/checkout@v7
4346 with :
44- ref : ${{ github.head_ref }}
47+ ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
4548
4649 - name : Validate composer.json and composer.lock
4750 run : composer validate --strict
4851
4952 - name : Cache Composer packages
5053 id : composer-cache
51- uses : actions/cache@v3
54+ uses : actions/cache@v6
5255 with :
5356 path : vendor
54- key : ${{ runner.os }}-php -${{ matrix.php }}-${{ matrix.dependency-version }}-${{ hashFiles('**/composer.lock') }}
57+ key : php- ${{ matrix.php }}-laravel -${{ matrix.laravel }}-${{ matrix.dependency-version }}-${{ hashFiles('**/composer.lock') }}
5558
5659 - name : Setup PHP
57- uses : shivammathur/setup-php@v2
60+ uses : shivammathur/setup-php@2.37.2
5861 with :
5962 php-version : ${{ matrix.php }}
60- coverage : xdebug
63+ coverage : none
6164 # extensions: mbstring, gd, intl
6265
6366 - name : Install dependencies
64- run : composer update --prefer-dist --no-progress --${{ matrix.dependency-version }}
67+ run : |
68+ composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
69+ composer require "orchestra/testbench:${{ matrix.testbench }}" --dev --no-interaction --no-update
70+ composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress --no-interaction --no-scripts
6571
66- - name : Run test suite
67- run : composer test -- --coverage-clover ./coverage.xml
72+ - name : Setup testbench environment
73+ run : |
74+ composer setup
75+ sed -i 's/APP_ENV=local/APP_ENV=testing/' workbench/.env
6876
69- - name : Upload coverage reports to Codecov
70- # Make sure the Codecov action is only executed once
71- if : matrix.os == 'ubuntu-latest' && matrix.php == '8.2' && matrix.dependency-version == 'prefer-stable'
72- uses : codecov/codecov-action@v5
73- with :
74- token : ${{ secrets.CODECOV_TOKEN }}
75- files : ./coverage.xml
76- verbose : true
77+ - name : Run test suite
78+ run : vendor/bin/pest --ci --parallel
0 commit comments