Skip to content

Commit 8407cb4

Browse files
committed
enhance github actions
1 parent e2f7412 commit 8407cb4

File tree

1 file changed

+6
-51
lines changed

1 file changed

+6
-51
lines changed

.github/workflows/app_test.yml

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11-
test-package:
11+
laravel-12-tests:
1212
runs-on: ubuntu-latest
1313
timeout-minutes: 5 # Add timeout to prevent indefinite runs
1414

@@ -64,30 +64,17 @@ jobs:
6464
# Add local package repository
6565
composer config repositories.local-microscope '{"type": "path", "url": "../laravel-microscope", "options": {"symlink": true}}'
6666
67-
# Update only specific packages instead of full update
68-
# Require Laravel 12 if needed (uncomment if needed)
69-
# composer require "laravel/framework:^12.0" --no-interaction
70-
7167
# Require local package
7268
composer require "imanghafoori/laravel-microscope:@dev" --no-interaction
7369
7470
# Update PHPUnit based on PHP version
75-
# if [[ "${{ matrix.php }}" == "8.5" ]] || [[ "${{ matrix.php }}" == "8.4" ]]; then
71+
if [[ "${{ matrix.php }}" == "8.5" ]] || [[ "${{ matrix.php }}" == "8.4" ]]; then
7672
# PHP 8.4+ requires PHPUnit 11+
77-
# composer require "phpunit/phpunit:^11.0" --dev --no-interaction
78-
# else
73+
composer update "phpunit/phpunit:^11.0" -W --no-interaction
74+
else
7975
# PHP 8.2-8.3 work with PHPUnit 10+
80-
# composer require "phpunit/phpunit:^10.0" --dev --no-interaction
81-
# fi
82-
83-
# Update testbench for Laravel 12 (uncomment if needed)
84-
# composer require "orchestra/testbench:^10.0" --dev --no-interaction
85-
86-
# Update common dependencies for Laravel 12
87-
# composer require "symfony/console:^7.0" --no-interaction 2>/dev/null || true
88-
# composer require "symfony/http-foundation:^7.0" --no-interaction 2>/dev/null || true
89-
# composer require "league/flysystem:^3.0" --no-interaction 2>/dev/null || true
90-
76+
composer update "phpunit/phpunit:^10.0" -W --no-interaction
77+
fi
9178
- name: Verify installations
9279
run: |
9380
cd laravel-app
@@ -112,28 +99,6 @@ jobs:
11299
# Clear caches
113100
php artisan config:clear 2>/dev/null || true
114101
php artisan cache:clear 2>/dev/null || true
115-
116-
# Set up SQLite database for testing
117-
mkdir -p database
118-
touch database/database.sqlite
119-
echo "DB_CONNECTION=sqlite" >> .env
120-
echo "DB_DATABASE=$(pwd)/database/database.sqlite" >> .env
121-
122-
- name: Publish package assets if needed
123-
run: |
124-
cd laravel-app
125-
# Check if package has config to publish
126-
if grep -q "MicroscopeServiceProvider" vendor/composer/installed.json 2>/dev/null; then
127-
php artisan vendor:publish --provider="Imanghafoori\LaravelMicroscope\MicroscopeServiceProvider" --tag=config --force 2>/dev/null || true
128-
php artisan vendor:publish --provider="Imanghafoori\LaravelMicroscope\MicroscopeServiceProvider" --tag=views --force 2>/dev/null || true
129-
fi
130-
131-
- name: Run migrations if needed
132-
run: |
133-
cd laravel-app
134-
if [ -d "database/migrations" ] && [ -n "$(ls -A database/migrations/*.php 2>/dev/null)" ]; then
135-
php artisan migrate --force 2>/dev/null || true
136-
fi
137102
138103
- name: Run tests with Laravel 12
139104
if: always()
@@ -160,16 +125,6 @@ jobs:
160125
cd laravel-microscope
161126
composer global require php-coveralls/php-coveralls
162127
php-coveralls --coverage_clover=clover.xml --json_path=coverall.xml -v
163-
# - name: Upload test artifacts on failure
164-
# if: failure()
165-
# uses: actions/upload-artifact@v3
166-
# with:
167-
# name: failure-details-php-${{ matrix.php }}
168-
# path: |
169-
# laravel-app/storage/logs/
170-
# laravel-app/bootstrap/cache/
171-
# laravel-app/vendor/composer/installed.json
172-
# retention-days: 14
173128
laravel-11-tests:
174129
runs-on: ubuntu-latest
175130
timeout-minutes: 5

0 commit comments

Comments
 (0)