Skip to content

Commit 59ec1ae

Browse files
authored
Merge pull request #3 from khaled-sadek/chore/laravel-11-12-support-ci
Support Laravel 11 & 12; add CI matrix, static analysis, and code style
2 parents 694e921 + c1faff3 commit 59ec1ae

File tree

14 files changed

+9500
-47
lines changed

14 files changed

+9500
-47
lines changed

.github/workflows/tests.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [ "**" ]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
test:
14+
name: PHP ${{ matrix.php }} / Laravel ${{ matrix.laravel }} / Testbench ${{ matrix.testbench }}
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- laravel: "10.*"
21+
testbench: "^8.0"
22+
php: "8.2"
23+
- laravel: "11.*"
24+
testbench: "^9.0"
25+
php: "8.2"
26+
- laravel: "12.*"
27+
testbench: "^10.0"
28+
php: "8.3"
29+
- laravel: "12.*"
30+
testbench: "^10.0"
31+
php: "8.4"
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: ${{ matrix.php }}
41+
coverage: none
42+
tools: composer:v2
43+
extensions: mbstring, dom
44+
45+
- name: Get Composer cache directory
46+
id: composer-cache
47+
run: echo "dir=$(composer config cache-dir)" >> $GITHUB_OUTPUT
48+
49+
- name: Cache Composer dependencies
50+
uses: actions/cache@v4
51+
with:
52+
path: ${{ steps.composer-cache.outputs.dir }}
53+
key: ${{ runner.os }}-php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-testbench-${{ matrix.testbench }}-composer-${{ hashFiles('**/composer.json') }}
54+
restore-keys: |
55+
${{ runner.os }}-php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-testbench-${{ matrix.testbench }}-composer-
56+
57+
- name: Validate composer.json
58+
run: composer validate --strict
59+
60+
- name: Install dependencies (Laravel ${{ matrix.laravel }})
61+
run: |
62+
composer update "illuminate/support:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" \
63+
--with-all-dependencies --no-interaction --prefer-dist
64+
65+
- name: Run tests
66+
run: vendor/bin/phpunit
67+
68+
analysis:
69+
name: PHPStan (PHP 8.4 / Laravel 12)
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v4
74+
75+
- name: Setup PHP
76+
uses: shivammathur/setup-php@v2
77+
with:
78+
php-version: 8.4
79+
coverage: none
80+
tools: composer:v2
81+
extensions: mbstring, dom
82+
83+
- name: Get Composer cache directory
84+
id: composer-cache
85+
run: echo "dir=$(composer config cache-dir)" >> $GITHUB_OUTPUT
86+
87+
- name: Cache Composer dependencies
88+
uses: actions/cache@v4
89+
with:
90+
path: ${{ steps.composer-cache.outputs.dir }}
91+
key: ${{ runner.os }}-php-8.4-laravel-12-testbench-10-composer-${{ hashFiles('**/composer.json') }}
92+
restore-keys: |
93+
${{ runner.os }}-php-8.4-laravel-12-testbench-10-composer-
94+
95+
- name: Validate composer.json
96+
run: composer validate --strict
97+
98+
- name: Install dependencies (Laravel 12)
99+
run: |
100+
composer update "illuminate/support:12.*" "orchestra/testbench:^10.0" \
101+
--with-all-dependencies --no-interaction --prefer-dist
102+
103+
- name: Run PHPStan
104+
run: vendor/bin/phpstan analyse --no-progress --memory-limit=1G
105+
106+
style:
107+
name: Pint (PHP 8.4 / Laravel 12)
108+
runs-on: ubuntu-latest
109+
steps:
110+
- name: Checkout
111+
uses: actions/checkout@v4
112+
113+
- name: Setup PHP
114+
uses: shivammathur/setup-php@v2
115+
with:
116+
php-version: 8.4
117+
coverage: none
118+
tools: composer:v2
119+
extensions: mbstring, dom
120+
121+
- name: Get Composer cache directory
122+
id: composer-cache
123+
run: echo "dir=$(composer config cache-dir)" >> $GITHUB_OUTPUT
124+
125+
- name: Cache Composer dependencies
126+
uses: actions/cache@v4
127+
with:
128+
path: ${{ steps.composer-cache.outputs.dir }}
129+
key: ${{ runner.os }}-php-8.4-laravel-12-testbench-10-composer-${{ hashFiles('**/composer.json') }}
130+
restore-keys: |
131+
${{ runner.os }}-php-8.4-laravel-12-testbench-10-composer-
132+
133+
- name: Validate composer.json
134+
run: composer validate --strict
135+
136+
- name: Install dependencies (Laravel 12)
137+
run: |
138+
composer update "illuminate/support:12.*" "orchestra/testbench:^10.0" \
139+
--with-all-dependencies --no-interaction --prefer-dist
140+
141+
- name: Run Pint (dry-run)
142+
run: vendor/bin/pint --test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
composer.lock
21
vendor
32
phpunit.xml
43
.phpunit.result.cache
4+
build/

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# blade-boring-avatars
22

3+
[![tests](https://github.com/khaled-sadek/blade-boring-avatars/actions/workflows/tests.yml/badge.svg)](https://github.com/khaled-sadek/blade-boring-avatars/actions/workflows/tests.yml)
4+
35
A Blade version of [Boring Avatars](https://github.com/boringdesigners/boring-avatars). Built using Laravel Blade.
46

57
Based on Boring Avatar's description,
68
> Boring Avatars a tiny JavaScript React library that generates custom, SVG-based, round avatars from any username and color palette.
79
8-
Here I make a blade component to use in your laravel projects
10+
This package provides a Blade component you can use directly in your Laravel projects.
911

1012
## Features
1113

@@ -17,6 +19,15 @@ Here I make a blade component to use in your laravel projects
1719
composer require khaled-sadek/blade-boring-avatars
1820
```
1921

22+
## Compatibility
23+
24+
- **PHP**: 8.2 or higher
25+
- **Laravel**: 10 – 12
26+
27+
> **Note for Laravel 7-9 users**: If you're using an older version of Laravel, please use version 1.x of this package which supports PHP 8.1 and Laravel 7-9.
28+
29+
This package auto-discovers its service provider, so no manual registration is required.
30+
2031
## Props
2132

2233
Props:
@@ -34,19 +45,21 @@ Props:
3445
Basic usage (with default props):
3546

3647
```html
37-
<Avatar />
48+
<x-avatar />
3849
```
3950

4051
With props:
4152

4253
```html
4354
<!--
4455
view.blade.php
45-
Where $colors is php valid array
56+
where $colors is a valid PHP array
4657
-->
47-
<Avatar size="80" name="Khaled Sadek" :colors="$colors" />
58+
<x-avatar size="80" name="Khaled Sadek" :colors="$colors" />
4859
```
4960

61+
Backward compatibility: the PascalCase tag `<x-Avatar />` remains available.
62+
5063
## Credits
5164

5265
Credits to [@hihayk](https://twitter.com/hihayk) ([GitHub](https://github.com/hihayk)) and [@josep_martins](https://twitter.com/josep_martins) ([GitHub](https://github.com/josepmartins)) for creating the original [Boring Avatars](https://github.com/boringdesigners/boring-avatars) library at [boringdesigners](https://github.com/boringdesigners)!

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^8.1",
13+
"php": "^8.2",
1414
"ext-json": "*",
15-
"illuminate/support": "^7.0|^8.0|^9.0|^10.0"
15+
"illuminate/support": "^7.0|^8.0|^9.0|^10.0|^11.0|^12.0"
1616
},
1717
"require-dev": {
18-
"nunomaduro/collision": "^7.0",
19-
"orchestra/testbench": "^5.0|^6.0|^7.0|^8.0",
20-
"phpunit/phpunit": "^10.0"
18+
"laravel/pint": "^1.25.1",
19+
"nunomaduro/collision": "^7.0|^8.0|^9.0",
20+
"orchestra/testbench": "^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
21+
"phpstan/phpstan": "^1.11",
22+
"phpunit/phpunit": "^10.0|^11.0"
2123
},
2224
"autoload": {
2325
"psr-4": {

0 commit comments

Comments
 (0)