Updating README.md File
نجحت جميع الفحوصات
CI/CD Pipeline of Fruit API / build-and-test (push) Successful in 50s
CI/CD Pipeline of Fruit API / deploy (push) Has been skipped
CI/CD Pipeline of Fruit API / build_and_push_image (push) Successful in 49s

هذا الالتزام موجود في:
ahmedgamalyousef
2025-10-20 23:49:05 +03:00
الأصل c36a8c9206
التزام 6c3849efdc

عرض الملف

@@ -16,7 +16,7 @@ fruit-api/
│── fruit_api.log # API logs
│── README.md # Documentation
│── .gitignore # Ignore venv/logs
│── .github/workflows/ci.yml # CI workflow for testing
│── .github/workflows/cicd.yml # CI workflow for testing
```
@@ -29,9 +29,7 @@ fruit-api/
- Bash script for monitoring logs (`log_monitor.sh`) with **error alerts (4xx/5xx)**
- Bash script for automated API testing (`test_api.sh`) with ✅ / ❌ results
- Swagger/OpenAPI documentation at `/docs`
- `CI/CD` pipeline for automated testing
- `CI/CD`via GitPasha Actions → Ghaymah Cloud Deployment
## ⚙️ Setup Instructions
@@ -87,7 +85,7 @@ http://localhost:5000
## 📑 Example Usage (with curl)
## 📑 Example Usage (with curl) Locally
- **Get all fruits**
```bash
@@ -104,7 +102,7 @@ curl -X POST http://localhost:5000/fruits -H "Content-Type: application/json"
curl -X PUT http://localhost:5000/fruits/1 -H "Content-Type: application/json" -d '{"name":"Green Apple","price":1.8}'
```
---
## 📝 Logging
@@ -168,12 +166,39 @@ After starting the API, open:
## ⚡ CI/CD Pipeline
### Workflow
- Triggered on every **push** or **pull request** to `main` branch.
- Installs dependencies (`requirements.txt`).
- Starts the API in the background.
- Runs automated tests (`test_api.sh`).
- Pipeline **fails** if any test ❌ fails.
- Triggered on every **git push** or **pull request** to `main` branch.
- GitPasha Actions automatically :
1. Installs dependencies (`requirements.txt`).
2. Starts the API in the background.
3. Runs automated tests (`test_api.sh`).
4. Pipeline **fails** if any test ❌ fails.
5. Builds the Docker image
6. Deploys to Ghaymah Cloud
✅ Deployment URL :
```bash
https://building-api-and-monitoring-logs-1e053dacf5df.hosted.ghaymah.systems
```
✅ API Documentation URL :
```bash
https://building-api-and-monitoring-logs-1e053dacf5df.hosted.ghaymah.systems/docs
```
## 📑 Example Usage (with curl) on Ghaymah Cloud
- **Get all fruits**
```bash
curl https://building-api-and-monitoring-logs-1e053dacf5df.hosted.ghaymah.systems/fruits
```
- **Add a fruit**
```bash
curl -X POST curl https://building-api-and-monitoring-logs-1e053dacf5df.hosted.ghaymah.systems/fruits -H "Content-Type: application/json" -d '{"name":"Mango","color":"Yellow","price":2.5,"quantity":50,"category":"Tropical"}'
```
- **Update a fruit**
```bash
curl -X PUT curl https://building-api-and-monitoring-logs-1e053dacf5df.hosted.ghaymah.systems/fruits/1 -H "Content-Type: application/json" -d '{"name":"Green Apple","price":1.8}'
```
## 🐳 Docker Support