name: windows-build

on:
  push:
    branches: [ "Playerbot", "test-staging" ]
  pull_request:
    branches: [ "Playerbot", "test-staging" ]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  windows-build:
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest]
    runs-on: ${{ matrix.os }}
    name: ${{ matrix.os }}
    env:
      BOOST_ROOT: C:\local\boost_1_82_0

    steps:
      - name: Checkout AzerothCore
        uses: actions/checkout@v4

      - name: Checkout Playerbot Module
        uses: actions/checkout@v4
        with:
          repository: mod-playerbots/mod-playerbots
          ref: ${{ github.ref_name == 'Playerbot' && 'master' || 'test-staging' }}
          path: modules/mod-playerbots

      - name: Move repo to short path
        shell: bash
        run: |
          mkdir C:/ac
          cp -r . C:/ac/

      - name: ccache
        uses: hendrikmuhs/ccache-action@v1.2.13

      - name: Configure OS
        shell: bash
        env:
          CONTINUOUS_INTEGRATION: true
        run: |
          cd C:/ac
          ./acore.sh install-deps

      - name: Build
        shell: bash
        run: |
          cd C:/ac
          export CTOOLS_BUILD=all
          ./acore.sh compiler build