From e1ee6df250dfd0de2bfa03309ff243aee229cca8 Mon Sep 17 00:00:00 2001 From: Evan Yan <103996156+evanyan13@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:36:18 +0800 Subject: [PATCH] Path CICD errors (#124) * Fix Backend CI checks * Update backend cicd workflow --- .github/workflows/backend-ci-workflow.yaml | 26 +++++++++---------- .../workflows/docker-build-push-gcloud.yaml | 5 ++-- .../question-service/src/app.controller.ts | 1 - backend/question-service/src/app.service.ts | 2 +- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/backend-ci-workflow.yaml b/.github/workflows/backend-ci-workflow.yaml index a6d6c48b0e..c026747b7a 100644 --- a/.github/workflows/backend-ci-workflow.yaml +++ b/.github/workflows/backend-ci-workflow.yaml @@ -1,6 +1,6 @@ name: Backend CI Workflow -on: +on: pull_request: branches: - main @@ -22,32 +22,32 @@ jobs: - name: Install Dependencies for Each Service run: | - cd backend - for service in auth-service question-service user-service matching-service gateway-service collaboration-service; do + services=("auth-service" "code-execution-service" "collaboration-service" "gateway-service" "matching-service" "question-service" "user-service" "y-websocket-service") + for service in "${services[@]}"; do echo "Installing dependencies for $service" - cd $service + cd backend/$service npm install - cd .. + cd ../.. done # Build Check for Each Service - name: Build Each Service run: | - cd backend - for service in auth-service question-service user-service matching-service gateway-service collaboration-service; do + services=("auth-service" "code-execution-service" "collaboration-service" "gateway-service" "matching-service" "question-service" "user-service" "y-websocket-service") + for service in "${services[@]}"; do echo "Building $service" - cd $service + cd backend/$service npm run build - cd .. + cd ../.. done # Lint Check for Each Service - name: Lint Each Service run: | - cd backend - for service in auth-service question-service user-service matching-service gateway-service collaboration-service; do + services=("auth-service" "code-execution-service" "collaboration-service" "gateway-service" "matching-service" "question-service" "user-service" "y-websocket-service") + for service in "${services[@]}"; do echo "Linting $service" - cd $service + cd backend/$service npm run lint - cd .. + cd ../.. done diff --git a/.github/workflows/docker-build-push-gcloud.yaml b/.github/workflows/docker-build-push-gcloud.yaml index 2e7be2ef7f..a031048518 100644 --- a/.github/workflows/docker-build-push-gcloud.yaml +++ b/.github/workflows/docker-build-push-gcloud.yaml @@ -30,10 +30,9 @@ jobs: env: GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} GCP_REGION: ${{ secrets.GCP_REGION }} - SERVICES: ${{ vars.SERVICES }} run: | - # Convert the comma-separated SERVICES string to an array - IFS=',' read -ra services <<< "$SERVICES" + # Define an array with the names of your services + services=("auth-service" "code-execution-service" "collaboration-service" "gateway-service" "matching-service" "question-service" "user-service" "y-websocket-service") # Loop over each service, build and push its Docker image for service in "${services[@]}"; do diff --git a/backend/question-service/src/app.controller.ts b/backend/question-service/src/app.controller.ts index dc554ffa7f..c89cf25ea8 100644 --- a/backend/question-service/src/app.controller.ts +++ b/backend/question-service/src/app.controller.ts @@ -8,7 +8,6 @@ import { GetQuestionsDto, UpdateQuestionDto, FindQuestionByIdDto, - UpdateQuestionTestCasesDto, } from './dto'; @Controller() diff --git a/backend/question-service/src/app.service.ts b/backend/question-service/src/app.service.ts index e3d5395fd8..441dddf03c 100644 --- a/backend/question-service/src/app.service.ts +++ b/backend/question-service/src/app.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { InjectModel } from '@nestjs/mongoose'; import { Model, Types } from 'mongoose'; import { Question } from './schema/question.schema'; -import { CreateQuestionDto, GetQuestionsResponse, TestCase } from './dto'; +import { CreateQuestionDto, GetQuestionsResponse } from './dto'; import { RpcException } from '@nestjs/microservices'; import { QUESTION_CATEGORIES } from './constants/question-categories.constant';