name: CI Build & Test

on:
  push:
  pull_request:

jobs:
  build:
    name: Build and test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install build dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y build-essential autoconf automake libtool m4 pkg-config

      - name: Make scripts executable
        run: |
          chmod +x ./bootstrap.sh ./build.sh ./testing.sh ./rebuild_all.sh || true

      - name: Build (out-of-tree)
        run: |
          ./build.sh

      - name: Run tests (enable testing)
        run: |
          ./testing.sh
