name: Embedded SDK PR Checks

on:
  pull_request:
    paths:
      - "superset-embedded-sdk/**"
    types: [synchronize, opened, reopened, ready_for_review]

# cancel previous workflow jobs for PRs
concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
  cancel-in-progress: true

jobs:
  embedded-sdk-test:
    runs-on: ubuntu-22.04
    defaults:
      run:
        working-directory: superset-embedded-sdk
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: "18"
          registry-url: 'https://registry.npmjs.org'
      - run: npm ci
      - run: npm test
      - run: npm run build
