# http://www.appveyor.com/docs/appveyor-yml

# Fix line endings in Windows. (runs before repo cloning)
init:
  - git config --global core.autocrlf input

# Test against these versions of Node.js.
environment:
  matrix:
    - nodejs_version: "4.4.5"

skip_non_tags: true

# Install scripts. (runs after repo cloning)
install:
  # Get the latest stable version of Node 0.STABLE.latest
  - ps: Install-Product node $env:nodejs_version
  # Typical npm stuff.
  - npm install
  - npm install mocha -g
  # get mingw-w64 (C:\mingw64)
  # copy of http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.1/threads-posix/seh/x86_64-4.9.1-release-posix-seh-rt_v3-rev1.7z
  - ps: if($env:tbs_tools -eq 'mingw' -and $env:tbs_arch -eq 'x64')
        {
          curl -outfile mw64.7z "http://libgd.blob.core.windows.net/mingw/x86_64-4.9.1-release-posix-seh-rt_v3-rev1.7z";
          if((Get-FileHash mw64.7z -Algorithm SHA1).Hash -ne "91A35AE296C1A71802AB0C7228EE57F9AAC5D7C7")
          {
            echo "Invalid file hash";
            exit 1;
          };
          7z x -oC:\ mw64.7z | out-null;
        }

# Post-install test scripts.
test_script:
  - '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall" %vcvar_arg%'
  - if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x86] SET PATH=C:\MinGW\bin;%PATH%
  - if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x64] SET PATH=C:\mingw64\bin;%PATH%
  # Output useful info for debugging.
  - node --version
  - npm --version
  # We test multiple Windows shells because of prior stdout buffering issues
  # filed against Grunt. https://github.com/joyent/node/issues/3584
  - set NODE_ENV=test
  - set HTTP_MAX_SOCKETS=5000
  - cd C:\projects\mavensmate
  - mocha test --recursive

# Don't actually build.
build: off

# Set build version format here instead of in the admin panel.
version: "{build}"