| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you 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. |
| |
| # ------------------------------------------------------------- |
| # |
| # CI Check Node Workflow |
| # |
| # This workflow runs checks for nodejs sdk code. |
| # Checks include: |
| # - npm install dependencies |
| # - commit-lint |
| # - typescript build |
| # - eslint |
| # - unit test |
| # - TODO: e2e test |
| # |
| # This workflow can be triggered manually or by other workflows. |
| # |
| name: ci-check-node-sdk |
| |
| on: |
| workflow_dispatch: |
| workflow_call: |
| |
| jobs: |
| install: |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v4 |
| - uses: actions/setup-node@v4 |
| with: |
| cache-dependency-path: foreign/node/package-lock.json |
| node-version: 22 |
| cache: "npm" |
| |
| - uses: actions/cache@v4 |
| env: |
| cache-name: cache-node-modules |
| with: |
| # npm cache files are stored in `~/.npm` on Linux/macOS |
| path: ~/.npm |
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| restore-keys: | |
| ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| |
| - name: install dependencies |
| run: cd foreign/node/ && npm ci --ignore-scripts # no husky hooks when in ci |
| |
| # - name: Validate current commit (last commit) message with commitlint |
| # if: github.event_name == 'push' |
| # run: npx commitlint --last --verbose |
| |
| # - name: Validate PR commits messages with commitlint |
| # if: github.event_name == 'pull_request' |
| # run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose |
| |
| - name: lint typescript code |
| run: cd foreign/node/ && npm run lint |
| |
| - name: build typescript |
| run: cd foreign/node/ && npm run build |
| |
| - name: run unit test |
| run: cd foreign/node/ && npm run test:unit |
| |
| ### Integration tests (e2e) |
| |
| # - name: Setup iggy |
| # uses: iggy-rs/setup-iggy@v1 |
| |
| # - name: Perform integration tests |
| # run: npm run test:e2e |