From da47351416fa2aea8ed8ddfd1d80a0cff0d982f9 Mon Sep 17 00:00:00 2001 From: I-shie Date: Wed, 1 Oct 2025 10:57:25 +0530 Subject: [PATCH 01/14] Added ci workflow --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4019cac --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: Paisable CI +on: [push,pull_request] +jobs: + CI: + runs-on: ubuntu-latest + services: + mongo: + image: mongo:6 + ports: + - 27017:27017 + options: >- + --health-cmd "mongosh --eval 'db.runCommand({ ping: 1 })'" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + env: + PORT: 5000 + MONGO_URI: mongodb://mongo:27017/testdb + JWT_SECRET: your-secret-key + GEMINI_API_KEY: your-gemini-api-key + VITE_API_URL: http://localhost:5000/api + steps: + - name: Checkout + uses: actions/checkout@v5.0.0 + with: + path: . + - name: Setup Node + uses: actions/setup-node@v5.0.0 + - name: Install Backend & Run + run: | + cd backend + npm install + npm run dev || exit 1 & + sleep 6 + curl http://localhost:5000 || exit 1 + pkill -f "node" + - name: Install Frontend & Run + run: | + cd frontend + npm install + npm run dev || exit 1 & + sleep 6 + curl http://localhost:5173 || exit 1 + pkill -f "node" + + + + + From 77273e18d5c170ef2bd524bb634ca06cb192f3ff Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Thu, 2 Oct 2025 11:50:33 +0530 Subject: [PATCH 02/14] Update ci.yml --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4019cac..8b243af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,16 +31,16 @@ jobs: cd backend npm install npm run dev || exit 1 & - sleep 6 - curl http://localhost:5000 || exit 1 + sleep 15 + curl -f http://localhost:5000 || exit 1 pkill -f "node" - name: Install Frontend & Run run: | cd frontend npm install npm run dev || exit 1 & - sleep 6 - curl http://localhost:5173 || exit 1 + sleep 15 + curl -f http://localhost:5173 || exit 1 pkill -f "node" From 2554b63b1d6e13da9bb77864b7226f4658b97f88 Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 00:30:00 +0530 Subject: [PATCH 03/14] Update ci.yml --- .github/workflows/ci.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b243af..d742168 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,18 +30,12 @@ jobs: run: | cd backend npm install - npm run dev || exit 1 & - sleep 15 - curl -f http://localhost:5000 || exit 1 - pkill -f "node" + npm run test - name: Install Frontend & Run run: | cd frontend npm install - npm run dev || exit 1 & - sleep 15 - curl -f http://localhost:5173 || exit 1 - pkill -f "node" + npm run test From 06090fc4938c9ae8d89de1570a039c5fc5a7db0a Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 00:33:25 +0530 Subject: [PATCH 04/14] Update ci.yml --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d742168..cf5f9c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,11 +26,11 @@ jobs: path: . - name: Setup Node uses: actions/setup-node@v5.0.0 - - name: Install Backend & Run - run: | - cd backend - npm install - npm run test + # - name: Install Backend & Run + # run: | + # cd backend + # npm install + # npm run test - name: Install Frontend & Run run: | cd frontend From cedecd99e186385903243c27cf79e0fc60ac692b Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 00:44:46 +0530 Subject: [PATCH 05/14] Update ci.yml --- .github/workflows/ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf5f9c2..9d7d9ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,16 +26,17 @@ jobs: path: . - name: Setup Node uses: actions/setup-node@v5.0.0 - # - name: Install Backend & Run - # run: | - # cd backend - # npm install - # npm run test + - name: Install Backend & Run + run: | + cd backend + npm install + npm run test - name: Install Frontend & Run run: | cd frontend npm install npm run test + npm run build From 7329749f7c20cc6d51e6a59759b9ddeea3a0d432 Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 00:58:40 +0530 Subject: [PATCH 06/14] Update ci.yml --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d7d9ed..6f237da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,6 @@ jobs: run: | cd frontend npm install - npm run test npm run build From 15cce260767caf7bf0e3f50dffa2d67787990a9c Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 01:04:05 +0530 Subject: [PATCH 07/14] Update ci.yml --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f237da..4c0ebf9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,10 +27,10 @@ jobs: - name: Setup Node uses: actions/setup-node@v5.0.0 - name: Install Backend & Run - run: | - cd backend - npm install - npm run test + # run: | + # cd backend + # npm install + # npm run test - name: Install Frontend & Run run: | cd frontend From 53c26d85f0df73df0ac7d0021df488958ea1c410 Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 01:07:00 +0530 Subject: [PATCH 08/14] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c0ebf9..396ad9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: path: . - name: Setup Node uses: actions/setup-node@v5.0.0 - - name: Install Backend & Run + # - name: Install Backend & Run # run: | # cd backend # npm install From d6266c344d4f71e66e95650e318118bc98733f75 Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 01:41:37 +0530 Subject: [PATCH 09/14] Update ci.yml --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 396ad9d..8bdeba0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,15 +26,34 @@ jobs: path: . - name: Setup Node uses: actions/setup-node@v5.0.0 - # - name: Install Backend & Run - # run: | - # cd backend - # npm install - # npm run test + - name: Install Backend & Run + run: | + cd backend + npm install + # npm run test + node run dev > server.log 2>&1 & + server_pid=$! + echo "Server started with PID: $server_pid" + + for i in {1..15}; do + if curl -fs http://localhost:5000 > /dev/null; then + echo "Server is up!" + kill $server_pid + echo "No issues found!" + exit 0 + fi + echo "Waiting for server... (attempt $i/15)" + sleep 2 + done + + echo "Server failed to start. Printing logs:" + cat server.log + kill $server_pid - name: Install Frontend & Run run: | cd frontend - npm install + npm install + # npm run test npm run build From 5f783bb6f60b87bbd4c6027fc9e04d18c75e6b25 Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 01:44:53 +0530 Subject: [PATCH 10/14] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8bdeba0..603c4e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: cd backend npm install # npm run test - node run dev > server.log 2>&1 & + npm run dev > server.log 2>&1 & server_pid=$! echo "Server started with PID: $server_pid" From 7d0530efe5f8feadbf2cc0b2975d90a77cc1e60f Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 01:54:39 +0530 Subject: [PATCH 11/14] Update ci.yml --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 603c4e2..acdfaee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ jobs: env: PORT: 5000 MONGO_URI: mongodb://mongo:27017/testdb - JWT_SECRET: your-secret-key - GEMINI_API_KEY: your-gemini-api-key + JWT_SECRET: ${{ secrets.JWT_SECRET }} + GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} VITE_API_URL: http://localhost:5000/api steps: - name: Checkout @@ -49,6 +49,7 @@ jobs: echo "Server failed to start. Printing logs:" cat server.log kill $server_pid + exit 1 - name: Install Frontend & Run run: | cd frontend From 77289ad4614409c713d0a3d3ea12b366e68cabed Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 01:59:24 +0530 Subject: [PATCH 12/14] Update ci.yml --- .github/workflows/ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acdfaee..b85f502 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,16 +3,16 @@ on: [push,pull_request] jobs: CI: runs-on: ubuntu-latest - services: - mongo: - image: mongo:6 - ports: - - 27017:27017 - options: >- - --health-cmd "mongosh --eval 'db.runCommand({ ping: 1 })'" - --health-interval=10s - --health-timeout=5s - --health-retries=5 + # services: + # mongo: + # image: mongo:6 + # ports: + # - 27017:27017 + # options: >- + # --health-cmd "mongosh --eval 'db.runCommand({ ping: 1 })'" + # --health-interval=10s + # --health-timeout=5s + # --health-retries=5 env: PORT: 5000 MONGO_URI: mongodb://mongo:27017/testdb From 95e37532068e08475a9341f49d8f7614f0048af4 Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 02:06:20 +0530 Subject: [PATCH 13/14] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b85f502..14bc0fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: run: | cd backend npm install - # npm run test + npm run test npm run dev > server.log 2>&1 & server_pid=$! echo "Server started with PID: $server_pid" From 271609fed49e053b0d997805b94513debb223bed Mon Sep 17 00:00:00 2001 From: Kumar Ayush Date: Mon, 6 Oct 2025 02:13:40 +0530 Subject: [PATCH 14/14] Update auth.test.js --- backend/__tests__/auth.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/__tests__/auth.test.js b/backend/__tests__/auth.test.js index a122d16..b784b02 100644 --- a/backend/__tests__/auth.test.js +++ b/backend/__tests__/auth.test.js @@ -5,7 +5,7 @@ const { app, server } = require('../server'); const User = require('../models/User'); let mongoServer; - +jest.setTimeout(30000); beforeAll(async () => { mongoServer = await MongoMemoryServer.create(); const mongoUri = mongoServer.getUri(); @@ -101,4 +101,4 @@ describe('Auth API', () => { expect(setupResponse.body.message).toBe('Default currency is required'); }); -}); \ No newline at end of file +});