#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

# build Apache Thrift on AppVeyor - https://ci.appveyor.com

version: '0.23.0.{build}'

shallow_clone: true

branches:
  only:
    - master
    - /^(release/)?\d+\.\d+\.\d+$/

# Note: We could abort all jobs on the first error, but then it
# becomes hard to learn from the other jobs results. Therefore disabled:
#matrix:
#  fast_finish: true

# See https://www.appveyor.com/docs/windows-images-software/ for available versions.

environment:
  matrix:
   # Python version test matrix (3.10-3.14) using MSVC2022
   - PROFILE: MSVC2022
     PROFILE_CLASS: MSVC
     APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
     PLATFORM: x64
     CONFIGURATION: Release
     BUILD_SHARED_LIBS: ON
     BOOST_VERSION: 1.89.0
     LIBEVENT_VERSION: 2.1.12
     PYTHON_VERSION: "3.10"
     QT_VERSION: 6.9.3
     ZLIB_VERSION: 1.3.1

   - PROFILE: MSVC2022
     PROFILE_CLASS: MSVC
     APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
     PLATFORM: x64
     CONFIGURATION: Release
     BUILD_SHARED_LIBS: ON
     BOOST_VERSION: 1.89.0
     LIBEVENT_VERSION: 2.1.12
     PYTHON_VERSION: "3.11"
     QT_VERSION: 6.9.3
     ZLIB_VERSION: 1.3.1

   - PROFILE: MSVC2022
     PROFILE_CLASS: MSVC
     APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
     PLATFORM: x64
     CONFIGURATION: Release
     BUILD_SHARED_LIBS: ON
     BOOST_VERSION: 1.89.0
     LIBEVENT_VERSION: 2.1.12
     PYTHON_VERSION: "3.12"
     QT_VERSION: 6.9.3
     ZLIB_VERSION: 1.3.1

   - PROFILE: MSVC2022
     PROFILE_CLASS: MSVC
     APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
     PLATFORM: x64
     CONFIGURATION: Release
     BUILD_SHARED_LIBS: ON
     BOOST_VERSION: 1.89.0
     LIBEVENT_VERSION: 2.1.12
     PYTHON_VERSION: "3.13"
     QT_VERSION: 6.9.3
     ZLIB_VERSION: 1.3.1

   - PROFILE: MSVC2022
     PROFILE_CLASS: MSVC
     APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
     PLATFORM: x64
     CONFIGURATION: Release
     BUILD_SHARED_LIBS: ON
     BOOST_VERSION: 1.89.0
     LIBEVENT_VERSION: 2.1.12
     PYTHON_VERSION: "3.14"
     QT_VERSION: 6.9.3
     ZLIB_VERSION: 1.3.1

   - PROFILE: MINGW
     PROFILE_CLASS: MINGW
     # Currently the the latest MSYS2 is in the following image:
     APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
     PLATFORM: x64
     CONFIGURATION: RelWithDebInfo
     DISABLED_TESTS: (StalenessCheckTest)

  # As of 2021.08.06, the Cygwin build is broken with a missing dll exception.
  # See for an example https://ci.appveyor.com/project/ApacheSoftwareFoundation/thrift/builds/40263513/job/a69xt6m4o0y9x1bw?fullLog=true
  # - PROFILE: CYGWIN
  #   PROFILE_CLASS: CYGWIN
  #   PLATFORM: x64
  #   CONFIGURATION: RelWithDebInfo
  #   DISABLED_TESTS: (ZlibTest|OpenSSLManualInitTest|TNonblockingServerTest)


build_script:
  - cd %APPVEYOR_BUILD_FOLDER%
  - call build\appveyor\%PROFILE_CLASS%-appveyor-full.bat


# artifact capture disabled as it might increase service cost for little gain:
#
# artifacts:
#  - path: local-thrift-inst
#    name: cmake installed content
#    type: zip
#
#  - path: local-thrift-build\Testing
#    name: ctest output
#    type: zip

# RDP support: use one or the other...
#
# enables RDP for each build job so you can inspect the environment at the beginning of the job:
# init:
#  - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#
# enables RDP at the end of the build job so you can login and re-run
# commands to see why something failed...
# on_finish:
#   - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#
# also need:
# environment:
#   APPVEYOR_RDP_PASSWORD: thr1FT2345$xyzZ
