name: "TestEngine"
# Test that a build with ImGui Test Engine works

on:
  workflow_dispatch:
  pull_request:
  push:


jobs:
  build:
    name: Test
    runs-on: ${{ matrix.platform }}
    strategy:
      fail-fast: false
      matrix:
        platform: [windows-latest, macos-latest, ubuntu-latest]

    steps:
      - uses: actions/checkout@v4
        with:
          submodules: true

      - name: apt install xorg-dev  libglfw3-dev libfreetype-dev (ubuntu only)
        if: ${{ matrix.platform == 'ubuntu-latest' }}
        run: sudo apt-get update && sudo apt-get install -y xorg-dev  libglfw3-dev libfreetype-dev

      - name: Build and install
        shell: bash
        run: |
          mkdir build
          cd build
          cmake .. -DHELLOIMGUI_WITH_TEST_ENGINE=ON -DCMAKE_BUILD_TYPE=Release -DHELLOIMGUI_DOWNLOAD_FREETYPE_IF_NEEDED=ON
          cmake --build . -j 3
