name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  build-and-test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v6

      - name: Clone NoJS Core for tests
        run: git clone --depth 1 https://github.com/no-js-dev/nojs.git "$GITHUB_WORKSPACE/../NoJS"

      - uses: actions/setup-node@v6
        with:
          node-version: 20
          cache: npm

      - run: npm install
      - run: npm run build
      - run: npm test
