Skip to content
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
.gitignore export-ignore
phpunit.xml export-ignore
README.md export-ignore
testbench.yaml export-ignore
tests/ export-ignore
UPGRADING.md export-ignore
workbench/ export-ignore
132 changes: 132 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: CI

on:
pull_request:
types: [ready_for_review, synchronize, opened]
paths-ignore:
- "README.md"
push:
branches: [main]
paths-ignore:
- "README.md"

jobs:
pest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ '8.2', '8.3', '8.4' ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
extensions: mbstring, dom, curl, json, libxml, xml, xmlwriter, simplexml, tokenizer, pdo, sqlite3
ini-values: error_reporting=E_ALL, display_errors=On, log_errors=Off

- name: Determine composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Validate composer.json
run: composer validate --no-check-publish

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction

- name: Run Pest
run: vendor/bin/pest --no-coverage
env:
CI: true

benchmark:
needs: pest
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
tools: composer:v2
coverage: none
extensions: mbstring, dom, curl, json, libxml, xml, xmlwriter, simplexml, tokenizer

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction

- name: Run benchmark
run: vendor/bin/testbench benchmark --ci > benchmark-comment.md

- name: Find existing comment
uses: peter-evans/find-comment@v3
id: find
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '## Benchmark Results'

- name: Post or update comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find.outputs.comment-id }}
edit-mode: replace
body-path: benchmark-comment.md

snapshot:
needs: pest
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
tools: composer:v2
coverage: none
extensions: mbstring, dom, curl, json, libxml, xml, xmlwriter, simplexml, tokenizer

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction

- name: Generate snapshot
run: vendor/bin/testbench benchmark --snapshot --ci

- name: Commit snapshot
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .github/benchmark-snapshot.json
git diff --staged --quiet || git commit -m "Update benchmark snapshot"
git push
51 changes: 0 additions & 51 deletions .github/workflows/tests.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ composer.lock
phpunit.xml.dist
.env
.env.testing
tests/fixtures/compiled/
tests/fixtures/blaze/
benchmark-snapshot.json
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
},
"autoload-dev": {
"psr-4": {
"Livewire\\Blaze\\Tests\\": "tests/"
"Livewire\\Blaze\\Tests\\": "tests/",
"Workbench\\App\\": "workbench/app/"
}
},
"extra": {
Expand All @@ -49,6 +50,8 @@
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"test": "vendor/bin/pest"
"test": "vendor/bin/pest",
"benchmark": "vendor/bin/testbench benchmark",
"benchmark:snapshot": "vendor/bin/testbench benchmark --snapshot"
}
}
}
7 changes: 7 additions & 0 deletions testbench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
laravel: '@testbench'

workbench:
install: true
discovers:
commands: true
views: true
Loading