Bump actions/setup-node from 3 to 4 (#530) #1522
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: run-tests | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [8.2, 8.1, 8.0] | |
laravel: [10.0, 9.0] | |
ssr: [true, false] | |
dependency-version: [prefer-lowest, prefer-stable] | |
include: | |
- laravel: 9.0 | |
testbench: 7.* | |
- laravel: 10.0 | |
testbench: 8.* | |
exclude: | |
- ssr: true | |
dependency-version: prefer-lowest | |
- ssr: true | |
php: 8.1 | |
- ssr: true | |
php: 8.0 | |
- laravel: 10.0 | |
php: 8.0 | |
name: Test P${{ matrix.php }} - L${{ matrix.laravel }} - SSR ${{ matrix.ssr }} - ${{ matrix.dependency-version }} | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- 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 demo app | |
run: | | |
cd app | |
npm upgrade | |
cp .env.example .env | |
cp public/1.jpeg storage/app/public/1.jpeg | |
cp public/2.jpeg storage/app/public/2.jpeg | |
touch database/database.sqlite | |
composer require laravel/framework:^${{ matrix.laravel }} --no-interaction --no-suggest | |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest | |
php artisan storage:link | |
php artisan migrate:fresh --seed | |
- name: Prepare L9 | |
if: ${{ matrix.laravel == '9.0' }} | |
run: | | |
cd app | |
rm composer.lock | |
composer require illuminate/contracts:"<9.52" --no-interaction --no-suggest | |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest | |
- name: Prepare L10 | |
if: ${{ matrix.laravel == '10.0' }} | |
run: | | |
cd app | |
rm composer.lock | |
composer require illuminate/contracts:"<10.17" spatie/phpunit-snapshot-assertions:^5.0 phpunit/phpunit:^10.0 nunomaduro/collision:^7.0 --no-interaction --no-suggest | |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest | |
- name: Prepare tests | |
run: | | |
cd app | |
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 Laravel Websockets | |
run: | | |
cd app | |
php artisan websockets:serve & | |
- 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: Run Laravel Server | |
run: | | |
cd app | |
php artisan serve & | |
- name: Execute Feature/Unit tests | |
run: | | |
cd app | |
php artisan test | |
- name: Execute Dusk tests (except table tests) | |
uses: nick-invision/retry@v2 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 3 | |
command: cd app && php artisan dusk --stop-on-error --stop-on-failure --exclude-group=table | |
on_retry_command: cd app && php artisan migrate:fresh --seed | |
- 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 |