diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..aea2f08 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,93 @@ +name: CI +on: [push,pull_request] +jobs: + Backend: + runs-on: ubuntu-latest + services: + mongo: + image: mongo:6 # Specify the desired MongoDB version + ports: + - 27017:27017 # Expose the default MongoDB port + options: >- + --health-cmd "mongosh --eval 'db.runCommand({ ping: 1 })'" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + env: + PORT: 8000 + MONGODB_URL: mongodb://mongo:27017/testdb + JWT_SECRET: dummy + + TWILIO_ACCOUNT_SID: ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + TWILIO_AUTH_TOKEN: dummy + TWILIO_PHONE_NUMBER: dummy + + CLOUDINARY_NAME: dummy + CLOUDINARY_API_KEY: dummy + CLOUDINARY_SECRET_KEY: dummy + + FIREBASE_API_KEY: dummy + FIREBASE_AUTH_DOMAIN: dummy + FIREBASE_PROJECT_ID: dummy + FIREBASE_STORAGE_BUCKET: dummy + FIREBASE_MESSAGING_SENDER_ID: dummy + FIREBASE_APP_ID: dummy + FIREBASE_MEASUREMENT_ID: dummy + + GOOGLE_CLIENT_ID: dummy + steps: + - name: Checkout + uses: actions/checkout@v5.0.0 + with: + path: . + - name: Setup Node + uses: actions/setup-node@v5.0.0 + - name: Install Dependencies and Run + run: | + cd backend + npm install + npm start & + sleep 5 + curl -f http://localhost:${{ env.PORT }} || exit 1 + pkill -f "node" + + + Frontend: + runs-on: ubuntu-latest + env: + VITE_GOOGLE_CLIENT_ID: dummy + steps: + - name: Checkout + uses: actions/checkout@v5.0.0 + with: + path: . + - name: Setup Node + uses: actions/setup-node@v5.0.0 + - name: Install Dependencies and Run #User + run: | + cd user + npm install + npm run dev & + sleep 5 + curl -f http://localhost:5173 || exit 1 + pkill -f "node" + - name: Install Dependencies and Run #Employee + run: | + cd employee + npm install + npm run dev & + sleep 5 + curl -f http://localhost:5173 || exit 1 + pkill -f "node" + - name: Install Dependencies and Run #Admin + run: | + cd admin + npm install + npm run dev & + sleep 5 + curl -f http://localhost:5173 || exit 1 + pkill -f "node" + + + + diff --git a/backend/package-lock.json b/backend/package-lock.json index 7ff2c3c..ab4ad2c 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -18,6 +18,8 @@ "express": "^4.21.2", "firebase": "^10.14.0", "google-auth-library": "^10.3.0", + "helmet": "^8.1.0", + "hpp": "^0.2.3", "jsonwebtoken": "^9.0.2", "mongoose": "^8.6.3", "multer": "^1.4.5-lts.1", @@ -1996,6 +1998,28 @@ "node": ">= 0.4" } }, + "node_modules/helmet": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-8.1.0.tgz", + "integrity": "sha512-jOiHyAZsmnr8LqoPGmCjYAaiuWwjAPLgY8ZX2XrmHawt99/u1y6RgrZMTeoPfpUbV96HOalYgz1qzkRbw54Pmg==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/hpp": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/hpp/-/hpp-0.2.3.tgz", + "integrity": "sha512-4zDZypjQcxK/8pfFNR7jaON7zEUpXZxz4viyFmqjb3kWNWAHsLEUmWXcdn25c5l76ISvnD6hbOGO97cXUI3Ryw==", + "license": "ISC", + "dependencies": { + "lodash": "^4.17.12", + "type-is": "^1.6.12" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", diff --git a/backend/package.json b/backend/package.json index 1840fb9..10c829d 100644 --- a/backend/package.json +++ b/backend/package.json @@ -21,6 +21,8 @@ "express": "^4.21.2", "firebase": "^10.14.0", "google-auth-library": "^10.3.0", + "helmet": "^8.1.0", + "hpp": "^0.2.3", "jsonwebtoken": "^9.0.2", "mongoose": "^8.6.3", "multer": "^1.4.5-lts.1",