Skip to content

Commit 0f097c8

Browse files
Add Pipelines, Basic README and composer with steroids
1 parent e2d8f35 commit 0f097c8

18 files changed

+870
-2
lines changed

.github/WORKFLOWS.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# GitHub Workflows Configuration
2+
3+
This project includes multiple workflow options for code style checking. Choose the approach that best fits your team's needs.
4+
5+
## Code Style Workflows
6+
7+
### Option 1: Strict Mode (Current)
8+
**File**: `.github/workflows/code-style.yml`
9+
10+
**Behavior**:
11+
- ❌ Fails CI if code style issues are found
12+
- 🛑 Requires manual fixing before merge
13+
- 📋 Shows exactly what needs to be fixed
14+
15+
**Best for**:
16+
- Open source projects
17+
- Teams focused on code quality education
18+
- Projects where every commit should be intentional
19+
20+
**Usage**: Already active in `ci.yml`
21+
22+
### Option 2: Auto-fix Mode
23+
**File**: `.github/workflows/code-style-fix.yml`
24+
25+
**Behavior**:
26+
- 🤖 Automatically fixes code style issues
27+
- 📝 Commits fixes with "Fix coding style issues with Pint 🤖"
28+
- ✅ Never blocks CI for style issues
29+
30+
**Best for**:
31+
- Private repositories
32+
- Teams prioritizing speed over strict processes
33+
- Projects with trusted contributors only
34+
35+
**Usage**: Uncomment in `ci.yml` and comment strict mode
36+
37+
## How to Switch
38+
39+
### To Auto-fix Mode:
40+
41+
1. Edit `.github/workflows/ci.yml`:
42+
```yaml
43+
jobs:
44+
tests:
45+
uses: ./.github/workflows/tests.yml
46+
47+
# Option 1: Strict mode (fails CI if code style issues found)
48+
# code-style:
49+
# uses: ./.github/workflows/code-style.yml
50+
51+
# Option 2: Auto-fix mode (automatically commits style fixes)
52+
code-style-fix:
53+
uses: ./.github/workflows/code-style-fix.yml
54+
55+
static-analysis:
56+
uses: ./.github/workflows/static-analysis.yml
57+
58+
quality-gate:
59+
runs-on: ubuntu-latest
60+
needs: [tests, code-style-fix, static-analysis]
61+
# ... rest of the config
62+
```
63+
64+
2. Optional: Delete `.github/workflows/code-style.yml` if not needed
65+
66+
### To Strict Mode:
67+
Current configuration (no changes needed)
68+
69+
## Recommendation
70+
71+
For this **public package**, we recommend **Strict Mode** because:
72+
- 🎯 Enforces quality standards
73+
- 📚 Educates contributors
74+
- 🔒 Prevents accidental style violations
75+
- 🧹 Keeps git history clean
76+
77+
Consider Auto-fix Mode only for:
78+
- Private team repositories
79+
- Rapid prototyping phases
80+
- Teams with established trust and processes

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
tests:
11+
uses: ./.github/workflows/tests.yml
12+
13+
code-style:
14+
uses: ./.github/workflows/code-style.yml
15+
16+
# code-style-fix:
17+
# uses: ./.github/workflows/code-style-fix.yml
18+
19+
static-analysis:
20+
uses: ./.github/workflows/static-analysis.yml
21+
22+
quality-gate:
23+
runs-on: ubuntu-latest
24+
needs: [tests, code-style, static-analysis]
25+
# needs: [tests, code-style-fix, static-analysis] # Use this if using auto-fix
26+
if: always()
27+
28+
steps:
29+
- name: Check quality gate
30+
run: |
31+
if [ "${{ needs.tests.result }}" != "success" ] || [ "${{ needs.code-style.result }}" != "success" ] || [ "${{ needs.static-analysis.result }}" != "success" ]; then
32+
echo "❌ Quality gate failed!"
33+
echo "Tests: ${{ needs.tests.result }}"
34+
echo "Code Style: ${{ needs.code-style.result }}"
35+
echo "Static Analysis: ${{ needs.static-analysis.result }}"
36+
exit 1
37+
else
38+
echo "✅ Quality gate passed!"
39+
fi
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Code Style (Auto-fix)
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: 8.4
25+
extensions: json, dom, curl, libxml, mbstring, zip
26+
coverage: none
27+
28+
- name: Install dependencies
29+
run: composer update --prefer-stable --prefer-dist --no-interaction
30+
31+
- name: Run Pint (fix mode)
32+
run: vendor/bin/pint
33+
34+
- name: Commit linted files
35+
uses: stefanzweifel/git-auto-commit-action@v5
36+
with:
37+
commit_message: "Fix coding style issues with Pint 🤖"
38+
skip_dirty_check: false

.github/workflows/code-style.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Code Style
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
pint:
11+
runs-on: ubuntu-latest
12+
name: Laravel Pint
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: 8.3
22+
extensions: dom, curl, libxml, mbstring, zip
23+
coverage: none
24+
25+
- name: Install dependencies
26+
run: composer update --prefer-stable --prefer-dist --no-interaction
27+
28+
- name: Check code style
29+
run: vendor/bin/pint --test
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Static Analysis
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
phpstan:
11+
runs-on: ubuntu-latest
12+
name: PHPStan
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: 8.3
22+
extensions: dom, curl, libxml, mbstring, zip
23+
coverage: none
24+
25+
- name: Install dependencies
26+
run: composer update --prefer-stable --prefer-dist --no-interaction
27+
28+
- name: Run static analysis
29+
run: vendor/bin/phpstan analyse --error-format=github
30+

.github/workflows/tests.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
php: [8.3, 8.4]
16+
laravel: [11.*, 12.*]
17+
stability: [prefer-stable]
18+
include:
19+
- laravel: 11.*
20+
testbench: 9.*
21+
- laravel: 12.*
22+
testbench: 9.*
23+
24+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Setup PHP
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: ${{ matrix.php }}
34+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
35+
coverage: xdebug
36+
37+
- name: Setup problem matchers
38+
run: |
39+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
40+
41+
- name: Install dependencies
42+
run: |
43+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
44+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
45+
46+
- name: List Installed Dependencies
47+
run: composer show -D
48+
49+
- name: Execute tests (PEST)
50+
run: vendor/bin/pest --coverage-text --coverage-clover=coverage.clover
51+
52+
- name: Code coverage
53+
uses: codecov/codecov-action@v3
54+
with:
55+
token: ${{ secrets.CODECOV_TOKEN }}
56+
file: ./coverage.clover

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
11
/vendor/
2+
composer.lock
3+
.env
4+
.env.local
5+
.env.*.local
6+
7+
# Generated files
8+
generated/
9+
10+
# IDE
11+
.vscode/
12+
.idea/
13+
*.swp
14+
*.swo
15+
*~
16+
17+
# Testing
18+
coverage/
19+
.phpunit.cache/
20+
phpunit.xml.bak
21+
.pest/
22+
23+
# Laravel Pint
24+
.php_cs.cache
25+
.php-cs-fixer.cache
26+
27+
# PHPStan
28+
phpstan.json
29+
30+
# Logs
31+
*.log
32+
33+
# OS generated files
34+
.DS_Store
35+
.DS_Store?
36+
._*
37+
.Spotlight-V100
38+
.Trashes
39+
ehthumbs.db
40+
Thumbs.db

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Changelog
2+
3+
All notable changes to `laravel-clean-architecture` will be documented in this file.
4+
5+
## [Unreleased]
6+
7+
### Added
8+
- Initial release of Laravel Clean Architecture package
9+
- `clean-arch:install` command to setup Clean Architecture structure
10+
- `clean-arch:make-domain` command to generate complete domain structure
11+
- `clean-arch:make-action` command to generate individual actions
12+
- `clean-arch:make-service` command to generate services
13+
- `clean-arch:make-controller` command to generate controllers
14+
- `clean-arch:generate-package` command to generate new packages
15+
- Complete set of stub templates for all components
16+
- Base classes for Model, Action, Service, Controller, Request
17+
- Domain events and enums support
18+
- Custom exceptions for domain, validation, and business logic
19+
- API Resources for consistent JSON responses
20+
- Feature tests templates
21+
- Configuration file for package customization
22+
- Comprehensive documentation and README
23+
24+
### Features
25+
- Clean Architecture implementation following DDD principles
26+
- Automatic generation of Domain, Application, and Infrastructure layers
27+
- Support for Laravel 11.x and 12.x
28+
- PHP 8.3+ compatibility
29+
- English validation messages and documentation
30+
- Comprehensive test coverage templates
31+
32+
## [1.0.0] - 2024-12-XX
33+
34+
### Added
35+
- Initial stable release

0 commit comments

Comments
 (0)