name: VS17-CI

on: [push, pull_request]

jobs:
  ci:
    if: >-
      ! contains(toJSON(github.event.commits.*.message), '[skip ci]') &&
      ! contains(toJSON(github.event.commits.*.message), '[skip github]')
    name: windows-vs17
    runs-on: windows-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - {gen: Visual Studio 17 2022, arch: Win32, shared: ON, build_type: Release}
          - {gen: Visual Studio 17 2022, arch: Win32, shared: OFF, build_type: Release}
          - {gen: Visual Studio 17 2022, arch: x64, shared: ON, build_type: Release}
          - {gen: Visual Studio 17 2022, arch: x64, shared: OFF, build_type: Debug}
          - {gen: Visual Studio 17 2022, arch: x64, shared: OFF, build_type: Release}
          - {gen: Visual Studio 17 2022, arch: x64, shared: OFF, build_type: RelWithDebInfo}
    steps:
    - name: checkout
      uses: actions/checkout@v4
    - name: Configure
      run: |
        cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DSIMDJSON_DEVELOPER_MODE=ON -DSIMDJSON_COMPETITION=OFF -DBUILD_SHARED_LIBS=${{matrix.shared}} -B build
    - name: Build Debug
      run: cmake --build build --config ${{matrix.build_type}} --verbose
    - name: Run tests
      run: |
        cd build
        ctest -C ${{matrix.build_type}}  -LE explicitonly  --output-on-failure
    - name: Install
      run: |
        cmake --install build --config ${{matrix.build_type}}
    - name: Test Installation
      run: |
        cmake -G "${{matrix.gen}}" -A ${{matrix.arch}}  -B build_install_test tests/installation_tests/find
        cmake --build build_install_test --config ${{matrix.build_type}}