# appveyor file
# https://www.appveyor.com/docs/appveyor-yml/

image: Visual Studio 2015

platform:
  - x64
  - x86

# build version format
version: "{build}"

# Set a known clone folder
clone_folder: c:\projects\nodegit

# fix line endings in Windows
init:
  - git config --global core.autocrlf input
  - git config --global user.name "John Doe"
  - git config --global user.email johndoe@example.com

# what combinations to test
environment:
  JOBS: 4
  GIT_SSH: c:\projects\nodegit\vendor\plink.exe
  GYP_MSVS_VERSION: 2015
  matrix:
    # Node.js
    - nodejs_version: "10"
    - nodejs_version: "8"
    - nodejs_version: "6"

matrix:
  fast_finish: true

# Get the latest stable version of Node 0.STABLE.latest
install:
  - git submodule update --init --recursive
  - ps: Install-Product node $env:nodejs_version $env:platform
  - ps: Start-Process c:\projects\nodegit\vendor\pageant.exe c:\projects\nodegit\vendor\private.ppk
  - npm install -g npm
  - npm install -g node-gyp
  - appveyor-retry call npm install

test_script:
  - node --version
  - npm --version
  - appveyor-retry call npm test

on_success:
  - IF %APPVEYOR_REPO_TAG%==true npm install -g node-pre-gyp
  - IF %APPVEYOR_REPO_TAG%==true npm install -g aws-sdk
  - IF %APPVEYOR_REPO_TAG%==true node lifecycleScripts\clean
  - IF %APPVEYOR_REPO_TAG%==true node-pre-gyp package
  - IF %APPVEYOR_REPO_TAG%==true node-pre-gyp publish

build: off

branches:
  only:
    - master
    - v0.3
