Skip to content

Commit 5738833

Browse files
committed
build:pipline migration fixed
1 parent b23d61c commit 5738833

File tree

2 files changed

+33
-111
lines changed

2 files changed

+33
-111
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
image: mysql:8.0
2424
env:
2525
MYSQL_ROOT_PASSWORD: password
26-
MYSQL_DATABASE: laravel
26+
MYSQL_DATABASE: laravel_test
2727
options: >-
2828
--health-cmd="mysqladmin ping"
2929
--health-interval=10s
@@ -62,21 +62,41 @@ jobs:
6262
run: |
6363
cp .env.example .env
6464
php artisan key:generate
65-
php artisan config:cache
65+
66+
- name: Configure test database
67+
run: |
68+
echo "DB_CONNECTION=mysql" >> .env
69+
echo "DB_HOST=127.0.0.1" >> .env
70+
echo "DB_PORT=3306" >> .env
71+
echo "DB_DATABASE=laravel_test" >> .env
72+
echo "DB_USERNAME=root" >> .env
73+
echo "DB_PASSWORD=password" >> .env
74+
echo "CACHE_DRIVER=redis" >> .env
75+
echo "SESSION_DRIVER=redis" >> .env
76+
echo "QUEUE_CONNECTION=sync" >> .env
77+
echo "REDIS_HOST=127.0.0.1" >> .env
78+
echo "REDIS_PORT=6379" >> .env
79+
php artisan config:clear
80+
cat .env
81+
82+
- name: Wait for services
83+
run: |
84+
echo "Waiting for MySQL..."
85+
while ! mysqladmin ping -h"127.0.0.1" -P"3306" -u"root" -p"password" --silent; do
86+
sleep 2
87+
done
88+
echo "MySQL is ready!"
89+
90+
echo "Waiting for Redis..."
91+
while ! redis-cli -h 127.0.0.1 -p 6379 ping; do
92+
sleep 2
93+
done
94+
echo "Redis is ready!"
6695
6796
- name: Run tests
6897
run: |
6998
php artisan migrate --force
7099
php artisan test
71-
env:
72-
DB_CONNECTION: mysql
73-
DB_HOST: 127.0.0.1
74-
DB_PORT: 3306
75-
DB_DATABASE: laravel
76-
DB_USERNAME: root
77-
DB_PASSWORD: password
78-
REDIS_HOST: 127.0.0.1
79-
REDIS_PORT: 6379
80100
81101
82102
deploy:

README.md

Lines changed: 2 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ app/
3030
│ ├── Entities/ # Domain entities (Post, Category)
3131
│ ├── UseCases/ # Business logic (CreatePost, GetPosts, etc.)
3232
│ ├── IO/Http/ # Controllers and HTTP layer
33-
│ ├── Specs/ # Domain tests
33+
│ ├── Testing/ # Domain tests
3434
│ └── BlogServiceProvider.php
3535
```
3636

@@ -46,7 +46,7 @@ app/
4646
- PHP 8.1 or higher
4747
- Composer
4848
- Node.js and npm (for asset compilation)
49-
- MySQL or SQLite database
49+
- MySQL database
5050

5151
### Setup Steps
5252

@@ -115,19 +115,6 @@ php artisan serve
115115

116116
Visit `http://localhost:8000` to see your blog!
117117

118-
## Usage
119-
120-
### Public Access
121-
- **Home Page**: Browse all published posts
122-
- **Category Filter**: Click category buttons to filter posts
123-
- **Post Details**: Click on any post to read the full content
124-
125-
### Admin Access
126-
1. **Register**: Create an account at `/register`
127-
2. **Login**: Access admin at `/login`
128-
3. **Dashboard**: Overview at `/admin/dashboard`
129-
4. **Manage Posts**: Create, edit, delete posts at `/admin/posts`
130-
5. **Manage Categories**: Organize content at `/admin/categories`
131118

132119
### Default Admin Account
133120
If you ran the seeder:
@@ -142,88 +129,3 @@ The application includes comprehensive tests following the clean architecture:
142129
```bash
143130
# Run all tests
144131
php artisan test
145-
146-
# Run specific test suite
147-
php artisan test --testsuite=Feature
148-
php artisan test --testsuite=Unit
149-
150-
# Run with coverage
151-
php artisan test --coverage
152-
```
153-
154-
### Test Structure
155-
- **Domain Tests**: `app/Blog/Specs/` - Tests for use cases and business logic
156-
- **Feature Tests**: `tests/Feature/` - End-to-end HTTP tests
157-
- **Unit Tests**: `tests/Unit/` - Individual component tests
158-
159-
## API Documentation
160-
161-
### Public Endpoints
162-
- `GET /` - Blog home page
163-
- `GET /blog` - Blog posts listing
164-
- `GET /blog/{slug}` - Individual post view
165-
- `GET /?category={id}` - Filter posts by category
166-
167-
### Admin Endpoints
168-
- `GET /admin/dashboard` - Admin dashboard
169-
- `GET|POST /admin/posts` - Posts management
170-
- `GET|POST /admin/categories` - Categories management
171-
172-
## File Upload
173-
174-
The application supports image uploads for blog posts:
175-
- **Supported formats**: JPEG, PNG, JPG, GIF
176-
- **Max size**: 2MB
177-
- **Storage**: `storage/app/public/posts/`
178-
- **URL**: Accessible via `storage/posts/filename.jpg`
179-
180-
## Security Features
181-
182-
- **Authentication**: Laravel's built-in authentication
183-
- **Authorization**: Route protection with middleware
184-
- **CSRF Protection**: All forms include CSRF tokens
185-
- **File Upload Validation**: Secure image upload handling
186-
- **Input Validation**: Comprehensive form validation
187-
188-
## Performance Considerations
189-
190-
- **Eager Loading**: Related models loaded efficiently
191-
- **Pagination**: Large post lists are paginated
192-
- **Image Optimization**: Proper image handling and storage
193-
- **Caching**: Ready for Redis/Memcached implementation
194-
195-
## Deployment
196-
197-
### Production Checklist
198-
1. Set `APP_ENV=production` in `.env`
199-
2. Set `APP_DEBUG=false`
200-
3. Configure production database
201-
4. Run `composer install --optimize-autoloader --no-dev`
202-
5. Run `php artisan config:cache`
203-
6. Run `php artisan route:cache`
204-
7. Run `php artisan view:cache`
205-
8. Set up proper file permissions
206-
9. Configure web server (Apache/Nginx)
207-
208-
### AWS Deployment
209-
This project is configured for AWS deployment:
210-
- **EC2**: Application server
211-
- **RDS**: Database
212-
- **S3**: File storage (configure for images)
213-
- **CloudFront**: CDN for static assets
214-
215-
## Contributing
216-
217-
1. Fork the repository
218-
2. Create a feature branch
219-
3. Follow the clean architecture patterns
220-
4. Add appropriate tests
221-
5. Submit a pull request
222-
223-
## License
224-
225-
This project is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
226-
227-
## Support
228-
229-
For support and questions, please create an issue in the repository.

0 commit comments

Comments
 (0)