name: "Windows CI Unit Tests"

on:
  push:
    branches:
      - main
  pull_request:
    paths:
      - 'naxsi_src/**'
      - 'unit-tests/**'
      - 'distros/**'

# Automatically cancel any previous workflow on new push.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
  cancel-in-progress: true

jobs:
  build-test:
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest]
        nginx:
          - 1.24.0
          - 1.23.2
          - 1.22.1
    runs-on: ${{ matrix.os }}
    defaults:
      run:
        shell: cmd
    steps:
    - name: Checkout repository
      uses: actions/checkout@v4
      with:
        submodules: recursive
        persist-credentials: false
    - name: Windows build
      run: .scripts\ci-windows-build.bat ${{ matrix.nginx }}
    - name: Unit Tests
      run: .scripts\ci-windows-test.bat