name: Build Check

on:
  push:
    branches-ignore:
      - 'build'
    paths:
      - 'src/**'
      - 'demos/**/*.ts'
      - 'samples/**/*.ts'
      - 'package.json'
      - 'package-lock.json'
      - 'tsconfig*.json'
      - 'rollup.config.js'
      - '.github/workflows/build-check.yml'
  pull_request:

permissions:
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
        with:
          persist-credentials: false

      - name: Setup Node.js
        uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
        with:
          node-version: '24'
          cache: 'npm'

      - name: Cache Node Modules
        id: cache-node-modules
        uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
        with:
          path: node_modules
          key: ${{ runner.os }}-node-root-${{ hashFiles('package-lock.json') }}

      - name: Install dependencies
        if: steps.cache-node-modules.outputs.cache-hit != 'true'
        run: npm ci

      - name: Build project
        run: npm run build
