Build assets #129
Workflow file for this run
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,phpunit.xml.dist}" | |
- ".github/workflows/tests.yml" | |
jobs: | |
tests: | |
name: Dusk Inertia ${{ matrix.inertia }} (${{ matrix.stack }}), App Mounting ${{ matrix.app_mounting }} | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
inertia: [v1, v2] | |
stack: [react, vue] | |
app_mounting: [auto, custom] | |
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' }} | |
run: | | |
cd demo-app | |
sed -i -e "s|APP_STACK=vue|APP_STACK=react|g" .env | |
- name: Build React library | |
if: ${{ matrix.stack == 'react' }} | |
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: Test React library | |
# if: ${{ matrix.stack == 'react' }} | |
# run: | | |
# cd react | |
# npm run test | |
- 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 install --no-progress --prefer-dist --optimize-autoloader | |
composer require inertiajs/inertia-laravel:${{ matrix.inertia == 'v1' && '^1.3' || '2.x-dev' }} | |
php artisan about | |
npm ci | |
npm install @inertiajs/react@${{ matrix.inertia == 'v1' && '1.2.0' || 'next' }} @inertiajs/vue3@${{ matrix.inertia == 'v1' && '1.2.0' || 'next' }} | |
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 |