# Copyright 2026 Zyvor · https://zyvor.dev
# SPDX-License-Identifier: Apache-2.0
name: Ecosystem SDK and contracts
on:
  push:
    paths: ['sdk/**', 'ecosystem/**', '.github/actions/kairon-machine/**', '.github/workflows/ecosystem.yml', 'deploy/crd.yaml', 'internal/model/**', 'internal/uiapi/**']
  pull_request:
    paths: ['sdk/**', 'ecosystem/**', '.github/actions/kairon-machine/**', '.github/workflows/ecosystem.yml', 'deploy/crd.yaml', 'internal/model/**', 'internal/uiapi/**']
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
  contents: read
jobs:
  sdk:
    runs-on: ${{ fromJSON(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository && '"ubuntu-latest"' || '["self-hosted","Linux","X64","zyvor-build","docker"]') }}
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1  # v7
      - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0  # v7
        with:
          python-version: '3.12'
      - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1  # v7
        with:
          node-version: '24'
          cache: npm
          cache-dependency-path: sdk/typescript/package-lock.json
      - run: python -m pip install --require-hashes -r ecosystem/requirements-test.txt
      - run: python -m unittest discover -s sdk/python/tests -v
      - run: python -m unittest discover -s ecosystem/tests -v
      - run: npm --prefix sdk/typescript ci --ignore-scripts
      - run: npm --prefix sdk/typescript run typecheck
      - run: npm --prefix sdk/typescript test
      - run: python scripts/check_license_headers.py
