name: Windows (MSYS2)

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  build:
    runs-on: windows-latest
    defaults:
      run:
        shell: msys2 {0}
    steps:
      - uses: actions/checkout@v4

      - name: "Setup MSYS2"
        uses: msys2/setup-msys2@v2
        with:
          msystem: UCRT64
          release: false
          install: >-
            git
            make
            mingw-w64-ucrt-x86_64-cmake
            mingw-w64-ucrt-x86_64-gcc
            mingw-w64-ucrt-x86_64-doxygen
            mingw-w64-ucrt-x86_64-graphviz
            msys2-w32api-runtime
            python-pip
            flex
            bison

      - name: "Setup cmake"
        run: cmake --version

      - name: "Setup gil"
        run: |
          pip3 install gil
          gil update

      - name: "Build"
        env:
          INCLUDE: C:\msys64\usr\include\w32api
          LIB: C:\msys64\usr\lib\w32api
        run: |
          cd build
          ./unix.sh
