diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..b0e25eb --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,41 @@ +name: Node.js CI + +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + +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 + + # Set the working directory for subsequent commands + - run: cd server + + - name: Use Node.js ${{ matrix.node-version }} + working-directory: server + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + + # Use npm ci with the working directory option + - run: npm ci + working-directory: server + + # Build the project with the working directory option + - run: npm run build --if-present + working-directory: server + + # Run tests with the working directory option + - run: npm test + working-directory: server