From 8906c03336e410b8f7de7dba842d4b9dbf39324c Mon Sep 17 00:00:00 2001 From: "Xenos F." Date: Wed, 6 Nov 2024 16:05:02 +0800 Subject: [PATCH] Update CI tests to include new services --- .github/workflows/server-test.yml | 58 +++++++++++++++++++++ .github/workflows/system-test.yml | 2 + server/ai-service/package.json | 3 +- server/ai-service/server.test.js | 4 ++ server/collaboration-service/package.json | 3 +- server/collaboration-service/server.test.js | 4 ++ 6 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 server/ai-service/server.test.js create mode 100644 server/collaboration-service/server.test.js diff --git a/.github/workflows/server-test.yml b/.github/workflows/server-test.yml index 9806f224ec..d432b8ec53 100644 --- a/.github/workflows/server-test.yml +++ b/.github/workflows/server-test.yml @@ -96,5 +96,63 @@ jobs: sort_keys: false - name: Install User Service Dependencies run: npm ci + - name: Run Tests + run: npm run test + collaboration-service: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + defaults: + run: + working-directory: ./server/collaboration-service + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: '0' + - uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Make envfile + uses: SpicyPizza/create-envfile@v2.0 + with: + envkey_ENV: PROD + envkey_PORT_COLLABORATION: 3004 + directory: . + file_name: .env + fail_on_empty: false + sort_keys: false + - name: Install Collaboration Service Dependencies + run: npm ci + - name: Run Tests + run: npm run test + ai-service: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + defaults: + run: + working-directory: ./server/ai-service + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: '0' + - uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Make envfile + uses: SpicyPizza/create-envfile@v2.0 + with: + envkey_ENV: PROD + envkey_PORT_AI: 3005 + directory: . + file_name: .env + fail_on_empty: false + sort_keys: false + - name: Install AI Service Dependencies + run: npm ci - name: Run Tests run: npm run test \ No newline at end of file diff --git a/.github/workflows/system-test.yml b/.github/workflows/system-test.yml index 6d7c922ab6..6434bdc54c 100644 --- a/.github/workflows/system-test.yml +++ b/.github/workflows/system-test.yml @@ -42,6 +42,8 @@ jobs: envkey_PORT_USER: 3001 envkey_PORT_QUESTION: 3002 envkey_PORT_MATCHING: 3003 + envkey_PORT_COLLABORATION: 3004 + envkey_PORT_AI: 3005 envkey_DB_URI_QUESTION: mongodb://localhost:27017/question envkey_DB_URI_USER: mongodb://localhost:27017/user envkey_JWT_SECRET: secret diff --git a/server/ai-service/package.json b/server/ai-service/package.json index 1794e3bd32..8fa38196ed 100644 --- a/server/ai-service/package.json +++ b/server/ai-service/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "main": "server.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "jest", "serve": "node server.js", "start": "node server.js", "dev": "nodemon server.js" @@ -22,6 +22,7 @@ "socket.io": "^4.8.0" }, "devDependencies": { + "jest": "^29.7.0", "nodemon": "^3.1.4" } } diff --git a/server/ai-service/server.test.js b/server/ai-service/server.test.js new file mode 100644 index 0000000000..0d695bee19 --- /dev/null +++ b/server/ai-service/server.test.js @@ -0,0 +1,4 @@ + +test('placeholder test', () => { + expect(true).toBe(true) +}) diff --git a/server/collaboration-service/package.json b/server/collaboration-service/package.json index 1ead2b03ff..f46af7cfcd 100644 --- a/server/collaboration-service/package.json +++ b/server/collaboration-service/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "main": "server.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "jest", "serve": "node server.js", "start": "node server.js", "dev": "nodemon server.js" @@ -21,6 +21,7 @@ "socket.io": "^4.8.0" }, "devDependencies": { + "jest": "^29.7.0", "nodemon": "^3.1.4" } } diff --git a/server/collaboration-service/server.test.js b/server/collaboration-service/server.test.js new file mode 100644 index 0000000000..0d695bee19 --- /dev/null +++ b/server/collaboration-service/server.test.js @@ -0,0 +1,4 @@ + +test('placeholder test', () => { + expect(true).toBe(true) +})