name: Windows

on:
  pull_request:
    branches:
      - main
  push:
    branches:
      - main

permissions:
  contents: read

jobs:
  build:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v4
    - uses: ilammy/msvc-dev-cmd@v1

    - name: Install Packages
      run: |
        pip install meson ninja

    - name: Build
      run: |
        meson setup build -Dlog=true -Dloaders=all -Dsavers=all -Dbindings=capi -Dtools=all
        where link
        ninja -C build install

    - uses: actions/upload-artifact@v4
      with:
        name: result_windows
        path: build/src/thorvg*

  compact_test:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v4
    - uses: ilammy/msvc-dev-cmd@v1

    - name: Install Packages
      run: |
        pip install meson ninja

    - name: Build
      run: |
        meson setup build -Dlog=true -Dloaders=all -Dsavers=all -Dstatic=true -Dthreads=false
        where link
        ninja -C build install

    - uses: actions/upload-artifact@v4
      with:
        name: result_windows_static
        path: build/src/thorvg*

  unit_test:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v4
    - uses: ilammy/msvc-dev-cmd@v1

    - name: Install Packages
      run: |
        pip install meson ninja

    - name: Build
      run: |
        meson setup build -Dloaders=all -Dsavers=all -Dbindings=capi -Dtests=true --errorlogs
        where link
        ninja -C build install test

    - uses: actions/upload-artifact@v4
      with:
        name: UnitTestReport
        path: build/meson-logs/testlog.txt

