https://github.com/yashpandey1405/github-actions-cicd-testing
A mini-project demonstrating CI/CD pipeline setup using GitHub Actions for a Node.js Express API, with automated testing via Jest and Supertest
https://github.com/yashpandey1405/github-actions-cicd-testing
cicd-pipeline github-actions testing
Last synced: 5 days ago
JSON representation
A mini-project demonstrating CI/CD pipeline setup using GitHub Actions for a Node.js Express API, with automated testing via Jest and Supertest
- Host: GitHub
- URL: https://github.com/yashpandey1405/github-actions-cicd-testing
- Owner: YashPandey1405
- Created: 2025-07-10T09:19:38.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-07-10T09:39:57.000Z (3 months ago)
- Last Synced: 2025-07-10T17:46:28.715Z (3 months ago)
- Topics: cicd-pipeline, github-actions, testing
- Language: JavaScript
- Homepage: http://bit.ly/4nFwVch
- Size: 200 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# โ๏ธ CI/CD Pipeline with GitHub Actions & API Testing
A mini-project demonstrating **CI/CD pipeline implementation using GitHub Actions** and **automated API route testing** with **Jest** and **Supertest** for a Node.js Express application.
---
## ๐ What is CI/CD?
**CI/CD** stands for:
- **Continuous Integration (CI)** โ Automatically test and build your app whenever you push code to the repository.
- **Continuous Deployment (CD)** โ Automatically deploy the app when the tests pass, ensuring your latest code is always live.These pipelines:
- Detect code changes (`git push`)
- Run test suites
- Deploy only on success
- Eliminate manual errors & reduce dev-ops overhead---
## โ๏ธ What are GitHub Actions?
**GitHub Actions** is an automation tool provided by GitHub. You can define custom workflows in `.yml` files to:
- Run tests
- Build and deploy code
- Trigger jobs based on events like commits or pull requestsThis project uses a GitHub Action to:
1. Install dependencies
2. Run tests
3. Deploy via a Render deploy hook (only if all tests pass โ )---
## ๐งช What is Unit Testing using Jest & Supertest?
### **Jest**:
A JavaScript testing framework by Facebook for writing unit tests. It supports:
- Assertions (`expect(...)`)
- Mocks and spies
- Test runners### **Supertest**:
A high-level abstraction to test HTTP endpoints. It simulates requests and checks responses without needing to deploy the server externally.
### ๐ Example:
```js
it("GET / returns Hello World", async () => {
const res = await request(app).get("/");
expect(res.statusCode).toBe(200);
expect(res.text).toBe("Hello World");
});
```---
## ๐ Project Overview
This mini-project includes:
- A simple Express server with two routes:
- `/` โ Returns `Hello World`
- `/:id` โ Returns `Hello World `- Test cases for both routes using **Jest** and **Supertest**
- A GitHub Actions workflow to automatically:- Install dependencies
- Run tests
- Deploy to Render (if tests pass)---
## โ Correct Test Results
When the routes are implemented correctly, **all test cases pass** successfully:

---
## โ Failed Test Results
If any route is broken or missing, **relevant test cases fail**, ensuring reliability:
## 
---
## โ Automated Testing via GitHub Actions
Every code push triggers **automated testing on GitHub Actions**.
If any route fails, the pipeline halts โ ensuring only **fully tested, reliable code** gets deployed.
---
## ๐ Tech Stack
- **Node.js / Express**
- **Jest** for testing logic
- **Supertest** for endpoint testing
- **GitHub Actions** for CI/CD automation
- **Render** for deployment (via deploy hook)---
## ๐ง Learning Outcomes
โ Understand CI/CD and GitHub Actions
โ Build & test Express routes
โ Automate testing and deployment pipeline
โ Visualize real test outcomes (pass vs fail)---
## ๐งโ๐ Author
**Made with ๐ป, โ and GitHub Actions** by [Yash Pandey](https://github.com/YashPandey-dev)