name: Windows

# TODO: MinGW(gcc) build
# TODO: llvm-mingw(clang) build

on:
  push:
    branches: [ dev ]
  pull_request:
    branches: [ dev ]

jobs:

  # Windows(x64) + Visual Studio 2019 build
  build-windows-msvc:

    runs-on: windows-latest
    name: Build for Windows(x64, MSVC)

    # Use system installed cmake
    # https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Configure
        run: .\vcsetup.bat
      - name: Build
        run: cmake --build build --config Release
      - name: Test
        run: ctest --test-dir build -C Release --output-on-failure
      - name: Archive production artifacts
        uses: actions/upload-artifact@v4
        with:
          name: dist-win-x64-release
          path: |
            build/Release/tusdcat.exe

  # Windows(32bit) + Visual Studio 2019 build
  build-windows-msvc-win32:

    runs-on: windows-latest
    name: Build for Windows(Win32, MSVC)

    # Use system installed cmake
    # https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Configure
        run: .\vcsetup-32bit.bat
      - name: Build
        run: cmake --build build_win32 --config Release
      - name: Test
        run: ctest --test-dir build_win32 -C Release --output-on-failure

