Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/workflows/run-stub-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: run-stub-tests

on: [push, pull_request]

jobs:
stub-test:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1, 8.0]
laravel: [9.*]
dependency-version: [prefer-lowest, prefer-stable]

name: Test Stubs ${{ matrix.os }} - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, mysql, mysqli, pdo_mysql, fileinfo
coverage: none

- name: Setup Laravel
run: |
composer create-project laravel/laravel:^9.3 .
composer require protonemedia/laravel-splade

- name: Remove installed Splade (Unix)
run: rm -rf vendor/protonemedia/laravel-splade
if: matrix.os == 'ubuntu-latest'

- name: Remove installed Splade (Windows)
run: rd "vendor/protonemedia/laravel-splade" /s /q
shell: cmd
if: matrix.os == 'windows-latest'

- name: Checkout code
uses: actions/checkout@v3.1.0
with:
path: "vendor/protonemedia/laravel-splade"

- name: Install Splade
run: |
composer dump
php artisan splade:install

- name: Install NPM dependencies
run: |
npm i
npm i autosize choices.js flatpickr

- name: Remove installed Splade and copy front-end build from Checkout (Unix)
run: |
rm -rf node_modules/@protonemedia/laravel-splade/dist
cp -R vendor/protonemedia/laravel-splade/dist node_modules/@protonemedia/laravel-splade/
if: matrix.os == 'ubuntu-latest'

- name: Remove installed Splade and copy front-end build from Checkout (Windows)
run: |
rd "node_modules/@protonemedia/laravel-splade/dist" /s /q
mkdir "node_modules/@protonemedia/laravel-splade/dist"
xcopy "vendor/protonemedia/laravel-splade/dist" "node_modules/@protonemedia/laravel-splade/dist" /E /I
shell: cmd
if: matrix.os == 'windows-latest'

- name: Compile assets
run: npm run build

- name: Run Laravel Server (Unix)
run: php artisan serve &
if: matrix.os == 'ubuntu-latest'

- name: Run Test (Unix)
run: php vendor/protonemedia/laravel-splade/TestStubs.php
if: matrix.os == 'ubuntu-latest'

- name: Run Laravel Server (Windows) and Run Test
run: |
start /b cmd /v:on /c "(php artisan serve) &"
php vendor/protonemedia/laravel-splade/TestStubs.php
shell: cmd
if: matrix.os == 'windows-latest'

- name: Start SSR server (Unix)
run: |
echo "SPLADE_SSR_ENABLED=true" >> .env
node bootstrap/ssr/ssr.mjs &
if: matrix.os == 'ubuntu-latest'

- name: Run Test command (Unix)
run: php artisan splade:ssr-test
if: matrix.os == 'ubuntu-latest'

- name: Start SSR server (Windows) and Run Test command
run: |
echo "SPLADE_SSR_ENABLED=true" >> .env
node bootstrap/ssr/ssr.mjs &
php artisan splade:ssr-test
if: matrix.os == 'windows-latest'
204 changes: 204 additions & 0 deletions .github/workflows/run-table-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
name: run-table-tests

on: [push, pull_request]

jobs:
table-test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.1, 8.0]
laravel: [9.*]
db: [mysql, postgres, sqlite]
ssr: [true, false]
dependency-version: [prefer-lowest, prefer-stable]
exclude:
- db: mysql
ssr: true
- db: postgres
ssr: true

name: Test P${{ matrix.php }} - L${{ matrix.laravel }} - DB ${{ matrix.db }} - SSR ${{ matrix.ssr }} - ${{ matrix.dependency-version }}

services:
mysql:
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: no
MYSQL_USER: protone_media_db_test
MYSQL_DATABASE: protone_media_db_test_mysql
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: secret
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:15.0
env:
POSTGRES_USER: protone_media_db_test
POSTGRES_PASSWORD: secret
POSTGRES_DB: protone_media_db_test_postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Checkout code
uses: actions/checkout@v3.1.0

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- if: ${{ steps.cache-npm.outputs.cache-hit == 'false' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- name: "Install locked dependencies with npm"
run: |
npm ci --ignore-scripts

- name: Build package
run: |
npm run build
npm pack
rm -rf node_modules

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
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: Prepare environment file (MySQL)
if: ${{ matrix.db == 'mysql' }}
run: |
cd app
cp .env.example.mysql .env

- name: Prepare environment file (PostgreSQL)
if: ${{ matrix.db == 'postgres' }}
run: |
cd app
cp .env.example.postgres .env

- name: Prepare environment file (SQLite)
if: ${{ matrix.db == 'sqlite' }}
run: |
cd app
cp .env.example .env
touch database/database.sqlite

- name: Prepare demo app
run: |
cd app
npm upgrade
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
npm run build
php artisan dusk:chrome-driver `/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1`

- name: Start Chrome Driver
run: |
cd app
./vendor/laravel/dusk/bin/chromedriver-linux &

- name: Start SSR server
run: |
cd app
sed -i -e "s|SPLADE_SSR_ENABLED=false|SPLADE_SSR_ENABLED=true|g" .env
node bootstrap/ssr/ssr.mjs &
if: matrix.ssr == true

- name: Migrate DB and Run Laravel Server (MySQL)
run: |
cd app
php artisan migrate:fresh --seed
php artisan serve &
if: ${{ matrix.db == 'mysql' }}
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}

- name: Migrate DB and Run Laravel Server (PostgreSQL)
run: |
cd app
php artisan migrate:fresh --seed
php artisan serve &
if: ${{ matrix.db == 'postgres' }}
env:
DB_PORT: ${{ job.services.postgres.ports[5432] }}

- name: Migrate DB and Run Laravel Server (SQLite)
if: ${{ matrix.db == 'sqlite' }}
run: |
cd app
php artisan migrate:fresh --seed
php artisan serve &

- name: Execute Dusk tests (only table tests - MySQL)
if: ${{ matrix.db == 'mysql' }}
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: cd app && php artisan dusk --stop-on-error --stop-on-failure --group=table
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}

- name: Execute Dusk tests (only table tests - PostgreSQL)
if: ${{ matrix.db == 'postgres' }}
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: cd app && php artisan dusk --stop-on-error --stop-on-failure --group=table
env:
DB_PORT: ${{ job.services.postgres.ports[5432] }}

- name: Execute Dusk tests (only table tests - SQLite)
if: ${{ matrix.db == 'sqlite' }}
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: cd app && php artisan dusk --stop-on-error --stop-on-failure --group=table

- name: Upload Screenshots
if: failure()
uses: actions/upload-artifact@v3
with:
name: screenshots
path: app/tests/Browser/screenshots

- name: Upload Snapshots
if: failure()
uses: actions/upload-artifact@v3
with:
name: snapshots
path: app/tests/Browser/__snapshots__

- name: Upload Console Logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: console
path: app/tests/Browser/console

- name: Upload Logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: logs
path: app/storage/logs
Loading