Skip to content

Add CI Workflow for backend #1

Add CI Workflow for backend

Add CI Workflow for backend #1

Workflow file for this run

name: CI for Express Backend Servers
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
env:
NODE_VERSION: "16"
COLLABORATION_SERVICE_URL: "http://localhost:8001/api"
MATCHING_SERVICE_URL: "http://localhost:8002/api"
QUESTION_SERVICE_URL: "http://localhost:8003/api"
USER_SERVICE_URL: "http://localhost:8004/api"
jobs:
collaboration_service:
runs-on: ubuntu-latest
name: Collaboration Service
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
working-directory: ./collaboration-service
run: npm install
- name: Build the service
working-directory: ./collaboration-service
run: npm run build
- name: Start the service
working-directory: ./collaboration-service
run: |
nohup npm run start & sleep 5
curl --fail ${{ env.COLLABORATION_SERVICE_URL }} || exit 1
- name: Stop the service
run: pkill node
matching_service:
runs-on: ubuntu-latest
name: Matching Service
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
working-directory: ./matching-service
run: npm install
- name: Build the service
working-directory: ./matching-service
run: npm run build
- name: Start the service
working-directory: ./matching-service
run: |
nohup npm run start & sleep 5
curl --fail ${{ env.MATCHING_SERVICE_URL }} || exit 1
- name: Stop the service
run: pkill node
question_service:
runs-on: ubuntu-latest
name: Question Service
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
working-directory: ./question-service
run: npm install
- name: Build the service
working-directory: ./question-service
run: npm run build
- name: Start the service
working-directory: ./question-service
run: |
nohup npm run start & sleep 5
curl --fail ${{ env.QUESTION_SERVICE_URL }} || exit 1
- name: Stop the service
run: pkill node
user_service:
runs-on: ubuntu-latest
name: User Service
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
working-directory: ./user-service
run: npm install
- name: Start the service
working-directory: ./user-service
run: |
nohup npm run start & sleep 5
curl --fail ${{ env.USER_SERVICE_URL }} || exit 1
- name: Stop the service
run: pkill node