branches:
  only:
    - master
    - develop
    - /win*/

# https://www.appveyor.com/docs/lang/nodejs-iojs/
environment:
  # use matching version of Node.js
  nodejs_version: "8.9.3"
  # encode secure variables which will NOT be used
  # in pull requests
  # https://www.appveyor.com/docs/build-configuration/#secure-variables
  # the variables can be encrypted at
  # https://ci.appveyor.com/tools/encrypt
  ci_json:
    secure: tf3fK5S5Gh5HGUcDo3eGw7nqdcFU/4A+2s3JJovmn/eA0p9dEspjPFp7G1I9BxdUc4OoCeJ3dSSrCQ1BPIzb/bzK6aQqAZQWNcJ1sanoIiF0QUPbiW40Js3xpWylIh8qutVoaWtZz5a1ygg9sJmAYR7qB5+aQqQNA55TBKkUCydXpnDBfWuagb6d/7cblULsXasvvji3RIoxWTKd8HmaD/xxqONjPAJ3IJsiDTaWc5S9bAgV8/IYa7YZaQm5vpTTsWU5IGwkA1l9yMu7j+7BSNK9esvAYyKsx7kUV9jiVFo=
  aws_credentials_json:
    secure: ttGzd2/rW+i8H+pozcFxzZKU07B5INL8+LjD4vCOKes+tI6EaKhrLvAQ9xT7r+e1oTWbC8olZQ96ZZ8P5Ve8pIpG8oe1ITMs5f50iXaKULfwIcJOm+G8a3pkMRZOWa0wGs7/sKtRSyIpMFRfCOIl8TePBKEgeRtVzixBqSuyYLn/u2dz0z8uHeJDq/H1kJlI
  CF_DOMAIN: "cypress.io"
  CF_EMAIL:
    secure: +kZOcImCZVZJv/e/hQc3gvJ6xXSH88qg46cMwKn8mRo=
  CF_TOKEN:
    secure: d8SQfJ2r6qrKDjYWoFg3AzgY7aL6hTuE5OIlRr0TXkcXkZzdmYCujfzIYcCQfpZg

platform:
  - x64
  - x86

# https://www.appveyor.com/docs/build-cache/
# hmm, seems there is NPM on windows problem
# with installing over cached folder
# https://github.com/npm/npm/issues/17747
# cache:
#   - node_modules
#   # todo: cache node_modules in each package

# Install scripts. (runs after repo cloning)
install:
  - ps: Install-Product node $env:nodejs_version $env:platform
  # upgrade npm
  - npm install -g npm@6
  - npm install -g @bahmutov/print-env
  # Output useful info for debugging.
  - node --version
  - node --print process.arch
  - npm --version
  - print-env Platform
  - npm run check-node-version
  - print-env APPVEYOR
  # clean cache to prevent install permission issues
  - npm cache clean --force
  # install root modules only
  - npm install --ignore-scripts
  - .\node_modules\.bin\print-arch
  # because we skipped scripts, we need to do
  # everything from "postinstall" script as commands
  - npm run link
  # install every package one by one
  - npm run all install -- --serial || npm run all install -- --serial
  # - npm prune
  # - npm run all prune -- --serial
  - npm run all build -- --serial

# Post-install test scripts.
test_script:
  # Output useful info for debugging.
  - node --version
  - npm --version
  - echo Commit message
  - echo %APPVEYOR_REPO_COMMIT_MESSAGE%
  - echo body of commit message, if any
  - 7z
  - cd packages/launcher && node index.js && cd ../..
  # make sure mocha runs
  - npm run test-mocha
  # make sure our snapshots are compared correctly
  # - npm run test-mocha-snapshot
  # the other larger tests
  - echo Building Windows NPM package %NEXT_DEV_VERSION%
  - npm --no-git-tag-version version %NEXT_DEV_VERSION%
  - cd cli
  - npm install
  - npm run build
  - cd build
  - npm pack
  - cd ../..

  - node ./scripts/win-appveyor-build.js

# Don't actually build.
build: off
