From 5b144c4092265481ced699b3120d634653e8d78e Mon Sep 17 00:00:00 2001 From: Kunal Patil <98849253+kunalpatil01@users.noreply.github.com> Date: Thu, 5 Dec 2024 21:19:44 -0800 Subject: [PATCH 1/5] node.js CI workflow --- .github/workflows/node.js.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..4dbd422 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present From 995a8bf3e3e40ff2e7c8eed1987b574639b9c54a Mon Sep 17 00:00:00 2001 From: Kunal Patil Date: Thu, 5 Dec 2024 21:24:53 -0800 Subject: [PATCH 2/5] add tests --- .github/workflows/node.js.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 4dbd422..e1af731 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [18.x, 20.x, 22.x] + node-version: [20.10] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -28,3 +28,7 @@ jobs: cache: 'npm' - run: npm ci - run: npm run build --if-present + - run: npx jest ./backend/__test__/dumbProxy.test.js + - run: npx jest ./backend/__test__/questionSet.test.js + - run: npx jest ./backend/__test__/room.test.js + From 6c15c6b4d05966a56ded1cd8deebc28066d4fb8b Mon Sep 17 00:00:00 2001 From: Kunal Patil Date: Thu, 5 Dec 2024 21:26:54 -0800 Subject: [PATCH 3/5] add install --- .github/workflows/node.js.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index e1af731..7cc1f87 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -27,6 +27,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm ci + - run: npm install - run: npm run build --if-present - run: npx jest ./backend/__test__/dumbProxy.test.js - run: npx jest ./backend/__test__/questionSet.test.js From 011e32e5131cb7db613ed3a02ccd2ceb1cd85db8 Mon Sep 17 00:00:00 2001 From: Kunal Patil Date: Thu, 5 Dec 2024 21:30:11 -0800 Subject: [PATCH 4/5] install express --- .github/workflows/node.js.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 7cc1f87..9d4465d 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -27,6 +27,7 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm ci + - run: npm install --save express - run: npm install - run: npm run build --if-present - run: npx jest ./backend/__test__/dumbProxy.test.js From 9b35d3df4956ce8ff28ec2c7ed5681a75fe7eb98 Mon Sep 17 00:00:00 2001 From: Kunal Patil Date: Thu, 5 Dec 2024 21:35:08 -0800 Subject: [PATCH 5/5] npm install in subdirectories --- .github/workflows/node.js.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 9d4465d..b20d1b7 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -27,8 +27,9 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm ci - - run: npm install --save express + - run: npm --prefix ./frontend install ./frontend - run: npm install + - run: npm --prefix ./backend install ./backend - run: npm run build --if-present - run: npx jest ./backend/__test__/dumbProxy.test.js - run: npx jest ./backend/__test__/questionSet.test.js