Skip to content

Commit

Permalink
chore: support Laravel 11 (#352)
Browse files Browse the repository at this point in the history
Co-authored-by: Enzo Innocenzi <enzo@innocenzi.dev>
  • Loading branch information
laravel-shift and innocenzi committed Mar 4, 2024
1 parent d74a9e8 commit 9e66dbc
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 27 deletions.
61 changes: 44 additions & 17 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,113 @@ name: Run tests

on:
push:
branches: [main]
branches:
- main
paths-ignore:
- "docs/**"
- "README.md"
- docs/**
- README.md
pull_request:
branches: [main]
branches:
- main

jobs:
vite:
if: ${{ !startsWith(github.event.head_commit.message, 'release:') }}
if: "${{ !startsWith(github.event.head_commit.message, 'release:') }}"


runs-on: ${{ matrix.os }}


strategy:
matrix:
node-version: [16.x]
os: [ubuntu-latest, windows-latest]
node-version:
- 16.x
os:
- ubuntu-latest
- windows-latest


name: Vite - Node ${{ matrix.os }} - ${{ matrix.os }}


steps:
- uses: actions/checkout@v2


- name: Install pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: 6.24.4


- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
cache: "pnpm"
cache: pnpm

- run: pnpm install


- name: Build
run: pnpm run build


- name: Test
run: pnpm run test:vite

php:
if: ${{ !startsWith(github.event.head_commit.message, 'release:') }}
if: "${{ !startsWith(github.event.head_commit.message, 'release:') }}"


runs-on: ${{ matrix.os }}


strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1, 8.0]
laravel: ["8.*", "9.*", 10.*]
php: [8.1, 8.2]
laravel: ['10.*', '11.*']
stability: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: "8.*"
testbench: 6.*
- laravel: "9.*"
testbench: 7.x-dev
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.1


name: PHP ${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}


steps:
- name: Checkout code
uses: actions/checkout@v2


- 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, fileinfo
coverage: none


- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/pest
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
"require": {
"php": "^8.0",
"guzzlehttp/guzzle": "^6.0|^7.2",
"illuminate/contracts": "^8.0|^9.0|^10.0",
"illuminate/contracts": "^10.0|^11.0",
"spatie/ignition": "^1.3",
"spatie/laravel-package-tools": "^1.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.5",
"orchestra/testbench": "^6.0|^7.0|^8.0",
"pestphp/pest": "^1.21",
"phpunit/phpunit": "^9.3",
"symfony/process": "^5.3|^6.0"
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^1.21|^2.34",
"phpunit/phpunit": "^9.3|^10.5",
"symfony/process": "^6.0|^7.0"
},
"autoload": {
"files": [
Expand Down
6 changes: 1 addition & 5 deletions tests/Features/Commands/UpdateTsconfigCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,10 @@

it('asks for confirmation before running in production', function () {
sandbox(function () {
$isLaravel10OrGreater = version_compare(app()->version(), '10.0.0', '>=');

set_env('production');
this()->artisan('vite:tsconfig')
->expectsConfirmation(
question: $isLaravel10OrGreater
? 'Are you sure you want to run this command?'
: 'Do you really wish to run this command?',
question: 'Are you sure you want to run this command?',
answer: 'yes'
)
->assertExitCode(0);
Expand Down

0 comments on commit 9e66dbc

Please sign in to comment.