name: PKBIND Build and Test

on:
  push:
    paths-ignore:
      - "docs/**"
      - "web/**"
      - "**.md"
  pull_request:
    paths-ignore:
      - "docs/**"
      - "web/**"
      - "**.md"

jobs:
  build_linux:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up GCC
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc g++

      - name: Test
        run: |
          cd include/pybind11/tests
          cmake -B build
          cmake --build build --config Release --parallel
          ./build/PKBIND_TEST

  build_win:
    runs-on: windows-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up MSVC
        uses: ilammy/msvc-dev-cmd@v1

      - name: Test
        run: |
          cd include\pybind11\tests
          cmake -B build
          cmake --build build --config Release --parallel
          build\Release\PKBIND_TEST.exe

  build_mac:
    runs-on: macos-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Clang
        run: |
          brew install llvm
          echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc
          source ~/.zshrc

      - name: Test
        run: |
          cd include/pybind11/tests
          cmake -B build -DENABLE_TEST=ON
          cmake --build build --config Release --parallel
          ./build/PKBIND_TEST
