environment:
  MESON_EXE_WRAPPER: "['C:\\Program Files\\OpenCppCoverage\\OpenCppCoverage.exe', '--export_type=cobertura', '--']"
  matrix:
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
      VCVARSALL: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat
      PYTHON_DIR: C:\Python38-x64
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
      VCVARSALL: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat
      PYTHON_DIR: C:\Python38-x64
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
      VCVARSALL: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
      PYTHON_DIR: C:\Python38-x64

branches:
  except:
    - /^ci/(?!appveyor)(/.+)?/

platform:
  - x64

install:
  - cmd: set PATH=%PYTHON_DIR%;%PYTHON_DIR%\scripts;%PATH%
  - cmd: pip install --upgrade ninja meson
  - cmd: choco install opencppcoverage codecov
  - cmd: call "%VCVARSALL%" amd64

before_build:
  - ps: |
      git submodule -q update --init --recursive

build_script:
  - cmd: meson --backend=ninja build
  - cmd: ninja -C build -v test

## This seems to work; data shows up on CodeCov, but it emits an error
## which makes AppVeyor thing the whole build failed.  Example:
## https://ci.appveyor.com/project/quixdb/ci-noise/build/job/e7d1wpt9icu77fn2
# after_test:
#   - ps: |
#       Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
#       $env:APPVEYOR="true"
#       $env:CI="true"
#       bash codecov.sh -f "run-testsCoverage.xml"
