---

name: Build on various Operating Systems

on:
  push:
    branches: [devel, master]
  pull_request:
    branches: [devel, master]

env:
  ARTIFACT: lsp-r3d-wgl-lib
  VALGRIND_ARGS: --error-exitcode=255 --leak-check=full --track-origins=yes --keep-debuginfo=yes --suppressions=.github/workflows/valgrind.supp

jobs:
  windows_mingw64:
    runs-on: windows-2022
    defaults:
      run:
        shell: msys2 {0}
    steps:
      - name: Setup MSYS2 and install dependencies
        uses: msys2/setup-msys2@v2
        with:
          msystem: MINGW64
          release: false
          update: false
          install: >-
            base-devel
            git
            mingw-w64-x86_64-gcc
      - uses: actions/checkout@v3
      - name: Configure project
        shell: msys2 {0}
        run: make config FEATURES="test strict"
      - name: Fetch project dependencies
        shell: msys2 {0}
        run: make fetch
      - name: Build project
        shell: msys2 {0}
        run: make VERBOSE=1
      - name: Run unit tests
        shell: msys2 {0}
        run: .build/target/${{env.ARTIFACT}}/${{env.ARTIFACT}}-test.exe utest --verbose --jobs 1
