Skip to content

Commit

Permalink
Add CI Workflow for backend
Browse files Browse the repository at this point in the history
  • Loading branch information
delishad21 authored Sep 9, 2024
1 parent 0ce003a commit 1b07674
Showing 1 changed file with 129 additions and 0 deletions.
129 changes: 129 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
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

0 comments on commit 1b07674

Please sign in to comment.