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

# https://www.appveyor.com/docs/lang/nodejs-iojs/
environment:
  # use matching version of Node.js
  nodejs_version: "12.14.1"
  # 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: uOM7Bj+6MfQA/wiUzA4MolZDlcdhIqrOWLN0LdR+Lg4olc1onF3IpWfRf+3B6Q5uT98OTnIU71OOqSRY7inGQg==
  # for uploading built binary to S3 bucket
  aws_credentials_json:
    secure: ttGzd2/rW+i8H+pozcFxzZKU07B5INL8+LjD4vCOKes+tI6EaKhrLvAQ9xT7r+e1p8My8f4LrqvT+i37kbRCUPY4DHmUgagj3aj0OghsT0eX/Vr/6T4v1yndB7SX7FnG07eVcGb63r9f5kT7xu7ElJ9WXh1Ok5K69W0zDPsa1RGCCYqsTi4tH2h5EAZwjY1b
  # CDN control
  CF_TOKEN:
    secure: nVGxcWxXGvrT621HmgMf9Mwm84dqo+cKHZj94OvyyWEGIZOJJkbWHsD/l2/r4a6Y
  CF_ZONEID:
    secure: SrZnd4BYW9PILEEi7y9VyXuC16C+qMEDT3QuV1PZZJa47TRkjcaYpAXhAHz0j0jT
  # authenticate as Cypress bot when posting commit status checks
  GH_APP_ID:
    secure: oR0RVDbv6GKej4wwjkz7Zw==
  GH_INSTALLATION_ID:
    secure: tAoqu4zIgZUxOfW0u9YQgw==
  GH_PRIVATE_KEY:
    secure: msLmlIBnkNovqrqTeCqa7ZPjETyS8Xn4JLuiRMWYK7gZBTO66pNnFaoeqwPFwH+ooO0cDFhAOPTToLisgTLXCo4hnw38zuBuKq+ywCh5mtk5uZn4x4F8G2XyRLD/ViZm+VuD2yZzaTWF11upDqC4xbXDe32yD6OSLKhA5ms5F5ke83zEuWSLTqVVCIpVH12rVTJHl3QHaWPwZbBBE3SFN8D6uiclvI06y3pEg2bVShU8YqlwearYTRuErsYXNCUmT0SrDd2kHznlY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M6K3xf2bSJnEXQFZOOXTRkKXnRDP7Y47ZgG3563fJQjSfoU4Hsw5xnegTOKlJsoEm95Rnq0esdMTA450Ki2wBOeIsOycljoApACBYLAlSe+ewxEaOjrLtnIR0LfzcKXlCRYbM31YWOCtMhMRehJbX9qWGNPTQHmjabYz7/IhLKtJuaMIpj3pfYgS/oQQ36g6ItCo7vLQAq+rgU99IUyQROOGXMUgK/8umL71oijA9dht0LmH9E7EGwih0WuLO2SndovTJODDfK9YrRTEocbo3B9S05O4fpGoQ32TK99mXjoQdlyxd/dn9Q9uDD27u/fGgUoYdt9VzAIigbRIQuRx430n33V0ZyXv90QuD4ESOLxVI1vnLj6JKAS4PGRz66rouYG6U+1syDWpf5Y6DzC/2KOfdLPwmuwjMQxuhf+6+tGeJbeotNX/eJF0LkRfyieRwEGKxIo0PaxdmVwsF7vKR6ZnOpr5BuLm/+44Rg3bQdJ4bcRW6i6dIhOyHWniLvsAPLu1NZDVN6jA13KTChhcrNnSGddjRFLekawl80E3KhG1p+KvItIZX3kzG4QjJ

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 -> yarn.lock
#   - '%LOCALAPPDATA%/Yarn -> yarn.lock'
#   # 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
  - yarn global add @bahmutov/print-env@1
  # Output useful info for debugging.
  - node --version
  - node --print process.arch
  - yarn --version
  - yarn check-next-dev-version
  # prints all public variables relevant to the build
  - print-env Platform
  - yarn check-node-version
  - print-env APPVEYOR
  # prints if we have sensitive variables that start with a prefix GH
  # which are used to trigger other projects
  # ignore errors - forked pull requests will NOT have these variables set
  - has-env GH || true
  # clean cache to prevent install permission issues
  - yarn cache clean
  - yarn --frozen-lockfile || yarn --frozen-lockfile || yarn --frozen-lockfile
  - yarn build-prod
  - .\node_modules\.bin\print-arch

# Post-install test scripts.
test_script:
  # Output useful info for debugging.
  # beware of echo-ing environment variables that may have batch syntax (e.g. commit messages)
  - node --version
  - yarn --version
  - 7z
  - echo *** System info ***
  - node cli/bin/cypress info --dev

  - echo *** Kitchensink tests run on Chrome browser ***
  - npm run dev -- --run-project %CD%/packages/example --browser chrome
  - echo *** Kitchensink tests run on Edge browser ***
  - npm run dev -- --run-project %CD%/packages/example --browser edge

  # make sure mocha runs
  - yarn 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
  - yarn
  - yarn build
  - cd build
  - yarn pack
  - cd ../..

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

# Don't actually build.
build: off
