Update composer.json #181
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
paths: | |
- "**.js" | |
- "**.jsx" | |
- "**.php" | |
- "**.vue" | |
- "**/composer.json" | |
- "**/package-lock.json" | |
- "demo-app/{.env.example,composer.json,package.json,phpunit.xml.dist}" | |
- ".github/workflows/tests.yml" | |
jobs: | |
tests: | |
name: Dusk L${{ matrix.laravel }} - Inertia ${{ matrix.inertia }} (${{ matrix.stack }}), App Mounting ${{ matrix.app_mounting }} | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
laravel: [12.0, 11.0, 10.0] | |
inertia: [v1, v2] | |
stack: [react-18, react-19, vue] | |
app_mounting: [auto, custom] | |
exclude: | |
- inertia: v2 | |
laravel: 10.0 | |
- inertia: v1 | |
laravel: 12.0 | |
- laravel: 12.0 | |
stack: react-18 | |
- laravel: 12.0 | |
stack: react-19 | |
- laravel: 11.0 | |
stack: react-18 | |
- laravel: 11.0 | |
stack: react-19 | |
env: | |
APP_URL: "http://127.0.0.1:8000" | |
DB_CONNECTION: sqlite | |
APP_STACK: ${{ matrix.stack }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, mysql, mysqli, pdo_mysql | |
coverage: none | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.composer-cache.outputs.dir }} | |
~/.npm | |
key: ${{ runner.os }}-${{ matrix.stack }}-${{ matrix.inertia }}-${{ hashFiles('**/composer.lock', '**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.stack }}-${{ matrix.inertia }}- | |
${{ runner.os }}-${{ matrix.stack }}- | |
${{ runner.os }}- | |
- name: Prepare The Environment | |
run: | | |
cd demo-app | |
cp .env.example .env | |
- name: Set React Environment Variables | |
if: ${{ matrix.stack == 'react-18' || matrix.stack == 'react-19' }} | |
run: | | |
cd demo-app | |
sed -i -e "s|APP_STACK=vue|APP_STACK=react|g" .env | |
- name: Build React library | |
if: ${{ matrix.stack == 'react-18' || matrix.stack == 'react-19' }} | |
run: | | |
# we need eslint-plugin-vue for files like helpers.js | |
cd vue | |
npm ci | |
npm list @inertiajs/vue3 | |
cd ../react | |
npm ci | |
npm list @inertiajs/react | |
npm run build | |
- name: Build Vue library | |
if: ${{ matrix.stack == 'vue' }} | |
run: | | |
cd vue | |
npm ci | |
npm list @inertiajs/vue3 | |
npm run build | |
- name: Test Vue library | |
if: ${{ matrix.stack == 'vue' }} | |
run: | | |
cd vue | |
npm run test | |
- name: Switch to custom app mounting | |
if: ${{ matrix.app_mounting == 'custom' }} | |
run: | | |
cd demo-app/resources/js | |
mv app-custom-mount.js app.js | |
mv app-custom-mount.jsx app.jsx | |
- name: Prepare Laravel app | |
run: | | |
cd demo-app | |
composer require laravel/framework:^${{ matrix.laravel }} inertiajs/inertia-laravel:${{ matrix.inertia == 'v1' && '^1.3' || '^2.0' }} | |
composer install --no-progress --prefer-dist --optimize-autoloader | |
php artisan about | |
npm ci | |
if [ "${{ matrix.stack }}" == "react-18" ]; then | |
npm install react@^18.2.0 react-dom@^18.2.0 | |
elif [ "${{ matrix.stack }}" == "react-19" ]; then | |
npm install react@^19.0.0 react-dom@^19.0.0 | |
fi | |
npm list react react-dom vue | |
npm install @inertiajs/react@${{ matrix.inertia == 'v1' && '1.3.0' || '2.0.0' }} @inertiajs/vue3@${{ matrix.inertia == 'v1' && '1.3.0' || '2.0.0' }} | |
npm install --install-links ../react | |
npm install --install-links ../vue | |
test -d node_modules/@inertiaui/modal-react || exit 1 | |
test -d node_modules/@inertiaui/modal-vue || exit 1 | |
npm list @inertiajs/react @inertiajs/vue3 @inertiaui/modal-react @inertiaui/modal-vue | |
npm run build | |
php artisan key:generate | |
touch database/database.sqlite | |
php artisan migrate:fresh --seed | |
php artisan dusk:chrome-driver --detect | |
- name: Run tests | |
run: | | |
cd demo-app | |
php artisan test | |
- name: Start servers | |
run: | | |
cd demo-app | |
php artisan serve --no-reload & | |
./vendor/laravel/dusk/bin/chromedriver-linux --port=9515 & | |
- name: Run Dusk tests | |
run: | | |
cd demo-app | |
php artisan migrate:fresh --seed | |
php artisan dusk | |
- name: Upload artifacts on failure | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dusk-artifacts | |
path: | | |
demo-app/tests/Browser/screenshots | |
demo-app/tests/Browser/__snapshots__ | |
demo-app/tests/Browser/console | |
demo-app/storage/logs |