Skip to content

Commit edbda4a

Browse files
committed
ci: enable matrix-based Laravel version testing via dynamic Composer require
Replaces static `composer install` with dynamic `composer require` to match Laravel/Testbench versions based on CI matrix. Ensures compatibility across Laravel 10–12 and PHP 8.2–8.4. Improves future-proofing and prevents dependency conflicts.
1 parent db0d058 commit edbda4a

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,24 @@ jobs:
8787
sleep 1
8888
done
8989
90-
- name: Install dependencies
90+
- name: Adjust Laravel/Testbench version per matrix
9191
run: |
92-
composer install --no-interaction --prefer-dist --no-progress
92+
composer remove laravel/framework orchestra/testbench --no-update || true
93+
composer require laravel/framework:^${{ matrix.laravel }} --no-update
94+
95+
if [[ "${{ matrix.laravel }}" == "10" ]]; then
96+
composer require orchestra/testbench:^8.0 --dev --no-update
97+
elif [[ "${{ matrix.laravel }}" == "11" ]]; then
98+
composer require orchestra/testbench:^9.0 --dev --no-update
99+
elif [[ "${{ matrix.laravel }}" == "12" ]]; then
100+
composer require orchestra/testbench:^10.0 --dev --no-update
101+
fi
102+
103+
composer update --no-interaction --prefer-dist --no-progress
93104
94105
- name: Ensure coverage directory exists
95106
run: mkdir -p coverage
96-
107+
97108
- name: Run Tests
98109
run: vendor/bin/phpunit --coverage-clover=coverage/clover.xml --path-coverage
99110

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
"php": "^8.2",
1414
"ext-pdo_mysql": "*",
1515
"doctrine/dbal": "^3.0",
16-
"laravel/framework": "^12.0",
16+
"laravel/framework": "^10.0 || ^11.0 || ^12.0",
1717
"marcj/topsort": "^1.1"
1818
},
1919
"require-dev": {
20-
"phpunit/phpunit": "^11.0",
21-
"orchestra/testbench": "^10.0"
20+
"phpunit/phpunit": "^10.0 || ^11.0",
21+
"orchestra/testbench": "^8.0 || ^9.0 || ^10.0"
2222
},
2323
"autoload": {
2424
"psr-4": {

0 commit comments

Comments
 (0)