diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cee7e75 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: CI Pipeline + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + backend: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install dependencies + run: | + cd backend + pip install -r requirements.txt + + - name: Run Django checks + run: | + cd backend + python manage.py check + + frontend: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Install and Build + run: | + cd frontend + npm install + npm run build \ No newline at end of file diff --git a/frontend/src/App.js b/frontend/src/App.js index 4bf580b..4f064d9 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -1,5 +1,5 @@ import { getTickets, updateTicket, getStats } from "./services/api"; -import { useEffect, useState } from "react"; +import { useEffect, useState, useCallback } from "react"; import TicketForm from "./components/TicketForm"; @@ -18,7 +18,7 @@ function App() { // Load tickets from backend with filters + search - const loadTickets = async () => { + const loadTickets = useCallback(async () => { let query = "?"; // Add filters if selected @@ -29,8 +29,7 @@ function App() { const data = await getTickets(query); setTickets(data); - }; - + }, [categoryFilter, priorityFilter, statusFilter, searchTerm]); /** * Load dashboard stats from backend */ @@ -48,9 +47,8 @@ function App() { // Reload tickets whenever filter changes useEffect(() => { loadTickets(); - loadStats(); - }, [categoryFilter, priorityFilter, statusFilter, searchTerm]); - + }, [loadTickets]); + return (