# We whitelist branches, as we don't really need to build dev-branches.
# Remember to add release branches, both here and to .travis.yml.
branches:
  only:
    - master
    - "2.4"    
    - "2.2"
    - "2.0"
    - "1.24"
    - "1.22"
    - "1.20"
    - "1.18"

install:
  # Using '-y' and 'refreshenv' as a workaround to:
  # https://github.com/haskell/cabal/issues/3687
  - choco source add -n mistuke -s https://www.myget.org/F/mistuke/api/v2
  - choco install -y ghc --version 8.0.2 --ignore-dependencies
  - choco install -y cabal-head -pre
  - refreshenv
  # See http://help.appveyor.com/discussions/problems/6312-curl-command-not-found#comment_42195491
  # NB: Do this after refreshenv, otherwise it will be clobbered!
  - set PATH=%APPDATA%\cabal\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\msys64\usr\bin;%PATH%
  - cabal --version
  - cabal %CABOPTS% update
  - cabal %CABOPTS% install happy alex

environment:
  global:
    CABOPTS:  "--store-dir=C:\\SR"

cache:
  - dist-newstyle
  - "C:\\sr"

build_script:
  - runghc cabal-dev-scripts/src/Preprocessor.hs -o cabal-install/cabal-install.cabal -f CABAL_FLAG_LIB cabal-install/cabal-install.cabal.pp
  - cabal %CABOPTS% new-configure --enable-tests
  - appveyor-retry cabal %CABOPTS% new-build lib:Cabal --only-dependencies
  - cabal %CABOPTS% new-build lib:Cabal
  - appveyor-retry cabal %CABOPTS% new-build Cabal:tests --only-dependencies
  - cabal %CABOPTS% new-test Cabal
  - appveyor-retry cabal %CABOPTS% new-build exe:cabal exe:cabal-tests --only-dependencies
  - cabal %CABOPTS% new-build exe:cabal
  - cabal %CABOPTS% new-run cabal-tests -- -j3 --with-cabal=dist-newstyle\build\x86_64-windows\ghc-8.0.2\cabal-install-2.5.0.0\x\cabal\build\cabal\cabal.exe
  - appveyor-retry cabal %CABOPTS% new-build cabal-install:tests --only-dependencies
  - cd cabal-install
  - cabal %CABOPTS% new-run cabal-install:memory-usage-tests
  - cabal %CABOPTS% new-run cabal-install:solver-quickcheck
  - cabal %CABOPTS% new-run cabal-install:integration-tests2
  - cabal %CABOPTS% new-run cabal-install:unit-tests -- --pattern "! (/FileMonitor/ || /VCS/ || /Get/)"