diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 00000000..3f861594 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,59 @@ +# Copyright 2026 UCP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Node.js Build and Test + +on: + push: + branches: [main] + paths: + - "rest/nodejs/**" + - ".github/workflows/nodejs.yml" + pull_request: + branches: [main] + paths: + - "rest/nodejs/**" + - ".github/workflows/nodejs.yml" + +permissions: + contents: read + +jobs: + build-and-test: + name: Build and test + runs-on: ubuntu-latest + timeout-minutes: 10 + defaults: + run: + working-directory: rest/nodejs + + steps: + - name: Check out repository + uses: actions/checkout@v5 + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: "20" + cache: npm + cache-dependency-path: rest/nodejs/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Test + run: npm test --if-present