Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# GitHub Actions CI/CD

This directory contains the GitHub Actions workflows for the Codify project.

## Workflows

### 1. CI Pipeline (`ci.yml`)
- **Trigger**: Pull requests and pushes to main branch
- **Jobs**:
- **Frontend**: Tests the React/Vite client application
- **Backend**: Tests the Node.js/Express server application

### 2. Issue Automation (`issue-create-automate-message.yml`)
- **Trigger**: When new issues are created
- **Purpose**: Automatically comments on new issues with helpful information

### 3. PR Automation (`pr-create-automate-message.yml`)
- **Trigger**: When new pull requests are opened
- **Purpose**: Automatically comments on new PRs with review guidelines

### 4. Test Build (`test-build.yml`)
- **Trigger**: Manual workflow dispatch
- **Purpose**: Manual testing of build processes

## Common Issues and Solutions

### Node.js Version
- All workflows use Node.js 18 for consistency
- Ensure your local development uses the same version

### Dependencies
- Frontend dependencies are installed from `./client/package.json`
- Backend dependencies are installed from `./server/package.json`
- Root `package.json` should not have conflicting dependencies

### Environment Variables
- CI uses dummy values for external APIs during testing
- Real environment variables should be configured in repository secrets

### Health Checks
- Frontend health check hits `http://localhost:5173`
- Backend health check hits `http://localhost:5050`
- Both use 20-second startup delays to ensure services are ready

## Troubleshooting

1. **Build Failures**: Check Node.js version compatibility
2. **Dependency Issues**: Ensure package.json files are properly configured
3. **Health Check Failures**: Verify port numbers and startup times
4. **Action Version Issues**: Keep GitHub Actions versions updated

## Maintenance

- Review and update GitHub Actions versions quarterly
- Test CI pipeline changes in feature branches
- Monitor workflow run times and optimize if needed
99 changes: 59 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,79 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
path: .
uses: actions/checkout@v4
- name: Setup Node
uses: actions/[email protected]
- name: Install Dependencies
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Frontend Dependencies
working-directory: ./client
run: npm install
- name: Build Frontend
working-directory: ./client
env:
VITE_SERVER_API: http://localhost:5050
VITE_YOUTUBE_API: dummy
VITE_GITHUB_TOKEN: dummy
VITE_RAPIDAPI_KEY: dummy
run: npm run build
- name: Check Health
working-directory: ./client
env:
VITE_SERVER_API : http://localhost:5050
VITE_YOUTUBE_API : dummy
VITE_GITHUB_TOKEN : dummy
VITE_RAPIDAPI_KEY : dummy
VITE_SERVER_API: http://localhost:5050
VITE_YOUTUBE_API: dummy
VITE_GITHUB_TOKEN: dummy
VITE_RAPIDAPI_KEY: dummy
run: |
cd client
npm install
npm run dev || exit 1 &
sleep 15
curl -f http://localhost:5173 || exit 1
pkill -f "node"
npm run dev &
DEV_PID=$!
sleep 20
if curl -f http://localhost:5173; then
echo "Frontend health check passed"
else
echo "Frontend health check failed"
exit 1
fi
kill $DEV_PID
Backend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
path: .
uses: actions/checkout@v4
- name: Setup Node
uses: actions/[email protected]
- name: Install Dependencies
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Backend Dependencies
working-directory: ./server
run: npm install
- name: Check Server Directory
run: |
cd server
ls
working-directory: ./server
run: ls -la
- name: Check Health
working-directory: ./server
env:
MONGODB_URI : "mongodb+srv://publicuser:[email protected]/"
MONGODB_URI: "mongodb+srv://publicuser:[email protected]/"
PORT: 5050
JWT_SECRET : your_jwt_secret
CLIENT_CORS : "*"
EMAIL_USER : [email protected]
EMAIL_PASS : demo1234
GOOGLE_CLIENT_ID : dummy
GOOGLE_CLIENT_SECRET : dummy
GOOGLE_LOGIN_CALLBACK_URL : http://localhost:5050/api/v1/auth/google/login/callback
GOOGLE_SIGNUP_CALLBACK_URL : http://localhost:5050/api/v1/auth/google/signup/callback
FRONTEND_URL : http://localhost:5173
YOUTUBE_API_KEY : dummy
JWT_SECRET: your_jwt_secret
CLIENT_CORS: "*"
EMAIL_USER: [email protected]
EMAIL_PASS: demo1234
GOOGLE_CLIENT_ID: dummy
GOOGLE_CLIENT_SECRET: dummy
GOOGLE_LOGIN_CALLBACK_URL: http://localhost:5050/api/v1/auth/google/login/callback
GOOGLE_SIGNUP_CALLBACK_URL: http://localhost:5050/api/v1/auth/google/signup/callback
FRONTEND_URL: http://localhost:5173
YOUTUBE_API_KEY: dummy
run: |
cd server
npm install
npm run server || exit 1 &
sleep 15
curl -f http://localhost:5050 || exit 1
pkill -f "node"
npm run server &
SERVER_PID=$!
sleep 20
if curl -f http://localhost:5050; then
echo "Backend health check passed"
else
echo "Backend health check failed"
exit 1
fi
kill $SERVER_PID

2 changes: 1 addition & 1 deletion .github/workflows/issue-create-automate-message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add Comment to Issue
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const issueNumber = context.issue.number;
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-create-automate-message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Comment on PR
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const prNumber = context.issue.number;
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test Build

on:
workflow_dispatch:

jobs:
test-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: client/package-lock.json

- name: Install client dependencies
working-directory: ./client
run: npm ci

- name: Build client
working-directory: ./client
env:
VITE_SERVER_API: http://localhost:5050
VITE_YOUTUBE_API: dummy
VITE_GITHUB_TOKEN: dummy
VITE_RAPIDAPI_KEY: dummy
run: npm run build

test-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: server/package-lock.json

- name: Install server dependencies
working-directory: ./server
run: npm ci

- name: Check server syntax
working-directory: ./server
run: node --check server.js
2 changes: 1 addition & 1 deletion client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const PythonFundamentals = lazy(() =>
import("./pages/Notes/PythonFundamentals/PythonFundamentals.jsx")
);
const NodeJSFundamentals = lazy(() =>
import("./pages/Notes/NodeJsFundamentals/NodeJsFundamentals.jsx")
import("./pages/Notes/NodeJSFundamentals/NodeJSFundamentals.jsx")
);

// Admin layout
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/Signup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useLoading } from "../components/loadingContext";
import { FaUser, FaEnvelope, FaPhone, FaLock, FaUserPlus, FaExclamationCircle } from "react-icons/fa";
import { Link } from "react-router-dom";
import OtpModal from "../components/OtpModal";
import PasswordStrength from "../../components/PasswordStrength";
import PasswordStrength from "../components/PasswordStrength";

function Signup() {
const [user, setUser] = useState({
Expand Down
23 changes: 7 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,14 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "vite"
"install:client": "cd client && npm install",
"install:server": "cd server && npm install",
"install:all": "npm run install:client && npm run install:server",
"dev:client": "cd client && npm run dev",
"dev:server": "cd server && npm run server",
"build:client": "cd client && npm run build"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"vite": "^7.1.3"
},
"dependencies": {
"@codemirror/lang-cpp": "^6.0.3",
"@codemirror/lang-javascript": "^6.2.4",
"@codemirror/lang-python": "^6.2.1",
"@codemirror/theme-one-dark": "^6.1.3",
"@uiw/react-codemirror": "^4.25.1",
"axios": "^1.11.0",
"quill": "^2.0.3",
"react": "^19.2.0",
"react-dom": "^19.2.0"
}
"license": "ISC"
}
Loading