Skip to content

Commit 496115d

Browse files
committed
add laravel 11 tests to github actions
1 parent a1e1de1 commit 496115d

File tree

2 files changed

+99
-52
lines changed

2 files changed

+99
-52
lines changed

.github/workflows/app_test.yml

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,102 @@ jobs:
169169
# laravel-app/storage/logs/
170170
# laravel-app/bootstrap/cache/
171171
# laravel-app/vendor/composer/installed.json
172-
# retention-days: 14
172+
# retention-days: 14
173+
laravel-11-tests:
174+
runs-on: ubuntu-latest
175+
timeout-minutes: 5
176+
strategy:
177+
matrix:
178+
php: ["8.2", "8.3"] # Note: Laravel 11 supports PHP 8.2-8.3
179+
180+
name: Laravel 11 (PHP ${{ matrix.php }})
181+
182+
steps:
183+
- name: Checkout package repository
184+
uses: actions/checkout@v4
185+
with:
186+
path: laravel-microscope
187+
188+
- name: Checkout Laravel test application
189+
uses: actions/checkout@v4
190+
with:
191+
repository: imanghafoori1/laravel-microscope-tester
192+
path: laravel-app
193+
194+
- name: Setup PHP
195+
uses: shivammathur/setup-php@v2
196+
with:
197+
php-version: ${{ matrix.php }}
198+
extensions: mbstring, xml, ctype, iconv, intl, libxml, bcmath, tokenizer, json
199+
# coverage: xdebug
200+
201+
- name: Get composer cache directory
202+
id: composer-cache
203+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
204+
205+
- name: Cache composer dependencies for Laravel 11
206+
uses: actions/cache@v3
207+
with:
208+
path: ${{ steps.composer-cache.outputs.dir }}
209+
key: ${{ runner.os }}-composer-laravel11-php-${{ matrix.php }}-${{ hashFiles('laravel-app/composer.json') }}
210+
restore-keys: |
211+
${{ runner.os }}-composer-laravel11-php-${{ matrix.php }}-
212+
${{ runner.os }}-composer-
213+
214+
- name: Configure Laravel 11 and local package
215+
timeout-minutes: 2
216+
run: |
217+
cd laravel-app
218+
219+
# First, install without updating
220+
composer install --no-interaction --no-progress
221+
222+
# Remove Laravel 12 and install Laravel 11
223+
composer remove laravel/framework --no-interaction 2>/dev/null || true
224+
composer require "laravel/framework:^11.0" --no-interaction --no-update
225+
226+
# Update composer to use Laravel 11 dependencies
227+
composer update --no-interaction --with-all-dependencies
228+
229+
# Remove any existing version of the package
230+
composer remove imanghafoori/laravel-microscope --no-interaction 2>/dev/null || true
231+
232+
# Add local package repository
233+
composer config repositories.local-microscope '{"type": "path", "url": "../laravel-microscope", "options": {"symlink": true}}'
234+
235+
# Require local package
236+
composer require "imanghafoori/laravel-microscope:@dev" --no-interaction
237+
238+
- name: Verify installations
239+
run: |
240+
cd laravel-app
241+
echo "=== Installed Versions ==="
242+
composer show laravel/framework 2>/dev/null || echo "laravel/framework not installed"
243+
composer show phpunit/phpunit 2>/dev/null || echo "phpunit/phpunit not installed"
244+
composer show imanghafoori/laravel-microscope 2>/dev/null || echo "Package not found"
245+
echo "=========================="
246+
247+
- name: Prepare Laravel environment
248+
run: |
249+
cd laravel-app
250+
251+
# Create .env if not exists
252+
if [ ! -f ".env" ]; then
253+
cp .env.example .env 2>/dev/null || echo "APP_NAME=Test\nAPP_ENV=testing\nAPP_KEY=" > .env
254+
fi
255+
256+
# Generate app key
257+
php artisan key:generate --force 2>/dev/null || true
258+
259+
# Clear caches
260+
php artisan config:clear 2>/dev/null || true
261+
php artisan cache:clear 2>/dev/null || true
262+
263+
- name: Run tests with Laravel 11
264+
if: always()
265+
run: |
266+
cd laravel-app
267+
268+
# Check if there are test files mentioning microscope
269+
echo "running tests..."
270+
php artisan test --colors=always 2>/dev/null || false

.github/workflows/run-tests.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)