# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Development CI

on:
  push:
    branches: ["*", "*/*", "**", "!main"]
  pull_request:
    branches: ["*", "*/*", "**", "!main"]

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4.1.1
        with:
          submodules: recursive
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.13"
          cache: "pip"
      - name: Install Python lint tooling
        run: |
          python -m pip install --upgrade pip
          pip install ruff
      - name: Use Node.js from .node-version
        uses: actions/setup-node@v4.0.0
        with:
          node-version-file: ".node-version"
          cache: "npm"
      - run: npm ci
      - run: npm run gen
      - run: npm run lint
      - run: npm run test:unit
      - name: Test MCPB package build
        run: |
          # Install MCPB CLI tool
          npm install -g @anthropic-ai/mcpb

          # Build MCPB package to ensure it works
          npm run build:dist
          npm run build:mcpb

          echo "MCPB package build test completed!"
          ls -la *.mcpb
