Skip to content

Commit 261890a

Browse files
authored
Merge pull request #33 from me-shaon/feature/package-improvements
Feature/package improvements
2 parents 898351b + 6670f77 commit 261890a

63 files changed

Lines changed: 4473 additions & 593 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/phpstan.yml

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

.github/workflows/rector.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Fix code with Rector
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'rector.php'
8+
- '.github/workflows/rector.yml'
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
rector:
15+
name: rector
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 5
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
ref: ${{ github.head_ref }}
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: '8.1'
28+
coverage: none
29+
30+
- name: Install composer dependencies
31+
uses: ramsey/composer-install@v3
32+
33+
- name: Run Rector
34+
run: ./vendor/bin/rector process
35+
36+
- name: Commit changes
37+
uses: stefanzweifel/git-auto-commit-action@v6
38+
with:
39+
commit_message: Apply Rector changes

.github/workflows/run-tests.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,25 @@ jobs:
1616
strategy:
1717
fail-fast: true
1818
matrix:
19-
os: [ubuntu-latest, windows-latest]
19+
os: [ubuntu-latest]
2020
php: [8.3, 8.2, 8.1]
21-
laravel: [10.*]
21+
laravel: [10.*, 11.*, 12.*]
2222
stability: [prefer-lowest, prefer-stable]
2323
include:
2424
- laravel: 10.*
2525
testbench: 8.*
2626
carbon: ^2.63
27+
- laravel: 11.*
28+
testbench: 9.*
29+
carbon: ^2.63
30+
- laravel: 12.*
31+
testbench: 10.*
32+
carbon: ^3.0
33+
exclude:
34+
- laravel: 11.*
35+
php: 8.1
36+
- laravel: 12.*
37+
php: 8.1
2738

2839
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2940

@@ -52,4 +63,4 @@ jobs:
5263
run: composer show -D
5364

5465
- name: Execute tests
55-
run: vendor/bin/pest --ci
66+
run: vendor/bin/phpunit --no-coverage

.husky/pre-commit

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
# Get staged PHP files (exclude deleted files)
5+
STAGED_FILES=$(git diff --cached --name-only --diff-filter=AM | grep -E '\.php$' || true)
6+
7+
if [ -z "$STAGED_FILES" ]; then
8+
echo "No staged PHP files to process. Skipping quality checks."
9+
exit 0
10+
fi
11+
12+
# Filter out files that don't exist (in case of race conditions)
13+
EXISTING_FILES=""
14+
for file in $STAGED_FILES; do
15+
if [ -f "$file" ]; then
16+
EXISTING_FILES="$EXISTING_FILES $file"
17+
fi
18+
done
19+
20+
# Trim leading whitespace
21+
EXISTING_FILES=$(echo "$EXISTING_FILES" | sed 's/^ *//')
22+
23+
if [ -z "$EXISTING_FILES" ]; then
24+
echo "No existing PHP files to process. Skipping quality checks."
25+
exit 0
26+
fi
27+
28+
echo "Running Pint on staged files..."
29+
if ! ./vendor/bin/pint $EXISTING_FILES; then
30+
echo "Pint failed"
31+
exit 1
32+
fi
33+
34+
# Add formatted files back to staging
35+
git add $EXISTING_FILES
36+
37+
echo "Running Rector on staged files..."
38+
if ! ./vendor/bin/rector process $EXISTING_FILES; then
39+
echo "Rector failed"
40+
exit 1
41+
fi
42+
43+
# Add any files that Rector may have modified back to staging
44+
git add $EXISTING_FILES
45+
46+
echo "All checks and fixes completed!"

0 commit comments

Comments
 (0)