Skip to content

Commit d95704c

Browse files
committed
laravel 12
1 parent f81c3c7 commit d95704c

File tree

11 files changed

+216
-50
lines changed

11 files changed

+216
-50
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: dependabot-auto-merge
2+
on: pull_request_target
3+
4+
permissions:
5+
pull-requests: write
6+
contents: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
if: ${{ github.actor == 'dependabot[bot]' }}
13+
steps:
14+
15+
- name: Dependabot metadata
16+
id: metadata
17+
uses: dependabot/fetch-metadata@v2.3.0
18+
with:
19+
github-token: "${{ secrets.GITHUB_TOKEN }}"
20+
21+
- name: Auto-merge Dependabot PRs for semver-minor updates
22+
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
23+
run: gh pr merge --auto --merge "$PR_URL"
24+
env:
25+
PR_URL: ${{github.event.pull_request.html_url}}
26+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
27+
28+
- name: Auto-merge Dependabot PRs for semver-patch updates
29+
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
30+
run: gh pr merge --auto --merge "$PR_URL"
31+
env:
32+
PR_URL: ${{github.event.pull_request.html_url}}
33+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Fix PHP code style issues
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
php-code-styling:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.head_ref }}
21+
22+
- name: Fix PHP code style issues
23+
uses: aglipanci/laravel-pint-action@2.5
24+
25+
- name: Commit changes
26+
uses: stefanzweifel/git-auto-commit-action@v5
27+
with:
28+
commit_message: Fix styling

.github/workflows/phpstan.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,24 @@ on:
55
paths:
66
- '**.php'
77
- 'phpstan.neon.dist'
8-
pull_request:
9-
paths:
10-
- '**.php'
11-
- 'phpstan.neon.dist'
12-
8+
- '.github/workflows/phpstan.yml'
139

1410
jobs:
1511
phpstan:
1612
name: phpstan
1713
runs-on: ubuntu-latest
14+
timeout-minutes: 5
1815
steps:
1916
- uses: actions/checkout@v4
2017

2118
- name: Setup PHP
2219
uses: shivammathur/setup-php@v2
2320
with:
24-
php-version: '8.0'
21+
php-version: '8.3'
2522
coverage: none
2623

2724
- name: Install composer dependencies
28-
uses: ramsey/composer-install@v1
25+
uses: ramsey/composer-install@v3
2926

3027
- name: Run PHPStan
3128
run: ./vendor/bin/phpstan --error-format=github

.github/workflows/pint.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/run-tests.yml

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
name: Run Tests - Current
22

33
on:
4-
- push
5-
- pull_request
4+
push:
5+
paths:
6+
- '**.php'
7+
- '.github/workflows/run-tests.yml'
8+
- 'phpunit.xml.dist'
9+
- 'composer.json'
10+
- 'composer.lock'
611

712
jobs:
813
test:
9-
runs-on: ubuntu-latest
14+
runs-on: ${{ matrix.os }}
15+
timeout-minutes: 5
1016

1117
strategy:
12-
fail-fast: false
18+
fail-fast: true
1319
matrix:
14-
php: [8.3, 8.2, 8.1, 8.0, 7.4]
15-
laravel: ['8.*', '9.*', '10.*', '11.*']
20+
os: [ubuntu-latest]
21+
php: [8.4, 8.3, 8.2, 8.1, 8.0, 7.4]
22+
laravel: ['8.*', '9.*', '10.*', '11.*', '12.*']
1623
dependency-version: [prefer-lowest, prefer-stable]
1724
exclude:
1825
- laravel: 10.*
@@ -34,14 +41,16 @@ jobs:
3441
- laravel: 11.*
3542
php: 7.4
3643
include:
44+
- laravel: 12.*
45+
testbench: 10.*
46+
- laravel: 11.*
47+
testbench: 9.*
3748
- laravel: 10.*
3849
testbench: 8.*
3950
- laravel: 9.*
4051
testbench: 7.*
4152
- laravel: 8.*
4253
testbench: 6.*
43-
- laravel: 11.*
44-
testbench: 9.*
4554

4655
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
4756

@@ -59,14 +68,24 @@ jobs:
5968
uses: shivammathur/setup-php@v2
6069
with:
6170
php-version: ${{ matrix.php }}
62-
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
63-
coverage: pcov
71+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
72+
coverage: none
73+
74+
- name: Setup problem matchers
75+
run: |
76+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
77+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
6478
6579
- name: Install dependencies
6680
run: |
67-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "symfony/console:>=4.3.4" "mockery/mockery:^1.3.2" --no-interaction --no-update
68-
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
69-
cp .env.example .env
81+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
82+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
83+
84+
- name: Copy .env.example
85+
run: cp .env.example .env
86+
87+
- name: List Installed Dependencies
88+
run: composer show -D
7089

7190
- name: Execute tests
72-
run: vendor/bin/phpunit
91+
run: vendor/bin/pest --ci
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Update Changelog"
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
update:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
ref: main
20+
21+
- name: Update Changelog
22+
uses: stefanzweifel/changelog-updater-action@v1
23+
with:
24+
latest-version: ${{ github.event.release.name }}
25+
release-notes: ${{ github.event.release.body }}
26+
27+
- name: Commit updated CHANGELOG
28+
uses: stefanzweifel/git-auto-commit-action@v5
29+
with:
30+
branch: main
31+
commit_message: Update CHANGELOG
32+
file_pattern: CHANGELOG.md

composer.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@
2323
},
2424
"require-dev": {
2525
"mockery/mockery": "^1.4",
26-
"orchestra/testbench": "^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
27-
"phpstan/extension-installer": "^1.1",
28-
"phpstan/phpstan-deprecation-rules": "^1.0",
29-
"phpstan/phpstan-phpunit": "^1.0",
30-
"phpunit/phpunit": "^8.4 || ^9.3.3 || ^10.0"
26+
"larastan/larastan": "^2.9||^3.0",
27+
"laravel/pint": "^1.14",
28+
"nunomaduro/collision": "^8.1.1||^7.10.0",
29+
"orchestra/testbench": "^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0",
30+
"pestphp/pest": "^3.0||^2.34",
31+
"pestphp/pest-plugin-arch": "^3.0||^2.7",
32+
"pestphp/pest-plugin-laravel": "^3.0||^2.3",
33+
"phpstan/extension-installer": "^1.3||^2.0",
34+
"phpstan/phpstan-deprecation-rules": "^1.1||^2.0",
35+
"phpstan/phpstan-phpunit": "^1.3||^2.0",
36+
"spatie/laravel-ray": "^1.35"
3137
},
3238
"autoload": {
3339
"psr-4": {
@@ -36,7 +42,8 @@
3642
},
3743
"autoload-dev": {
3844
"psr-4": {
39-
"Tapp\\Airtable\\Tests\\": "tests"
45+
"Tapp\\Airtable\\Tests\\": "tests",
46+
"Workbench\\App\\": "workbench/app/"
4047
}
4148
},
4249
"scripts": {

phpunit.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
>
7+
<testsuites>
8+
<testsuite name="Test Suite">
9+
<directory suffix="Test.php">./tests</directory>
10+
</testsuite>
11+
</testsuites>
12+
<source>
13+
<include>
14+
<directory suffix=".php">./app</directory>
15+
<directory suffix=".php">./src</directory>
16+
</include>
17+
</source>
18+
</phpunit>

tests/Feature/ExampleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
test('example', function () {
4+
expect(true)->toBeTrue();
5+
});

tests/Pest.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
/*
4+
|--------------------------------------------------------------------------
5+
| Test Case
6+
|--------------------------------------------------------------------------
7+
|
8+
| The closure you provide to your test functions is always bound to a specific PHPUnit test
9+
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
10+
| need to change it using the "uses()" function to bind a different classes or traits.
11+
|
12+
*/
13+
14+
// uses(Tests\TestCase::class)->in('Feature');
15+
16+
/*
17+
|--------------------------------------------------------------------------
18+
| Expectations
19+
|--------------------------------------------------------------------------
20+
|
21+
| When you're writing tests, you often need to check that values meet certain conditions. The
22+
| "expect()" function gives you access to a set of "expectations" methods that you can use
23+
| to assert different things. Of course, you may extend the Expectation API at any time.
24+
|
25+
*/
26+
27+
expect()->extend('toBeOne', function () {
28+
return $this->toBe(1);
29+
});
30+
31+
/*
32+
|--------------------------------------------------------------------------
33+
| Functions
34+
|--------------------------------------------------------------------------
35+
|
36+
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
37+
| project that you don't want to repeat in every file. Here you can also expose helpers as
38+
| global functions to help you to reduce the number of lines of code in your test files.
39+
|
40+
*/
41+
42+
function something()
43+
{
44+
// ..
45+
}

0 commit comments

Comments
 (0)