clone_depth: 10

os: Visual Studio 2017

environment:
  PREBUILD_TOKEN:
    secure: 7t92yForo995jn/5Afeo6A3wcmEyus0nlybU4a9MYQ1FSoMvkjLeihbEQYr99F9S

  matrix:
    - nodejs_version: "4"
    - nodejs_version: "6"
    - nodejs_version: "8"

platform:
  - x86
  - x64

matrix:
  fast_finish: true

artifacts:
  - path: 'prebuilds\*.tar.gz'

install:
  - cmd: git submodule update --init --recursive
  - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:platform;
  - ps: >
      if ($env:nodejs_version -eq "4") {
        npm i -g npm | Write-Host;
      }
      npm config set progress false
      npm config set spin false
  - ps: >
      $env:JOBS = "max";
      $env:PUBLISH_BINARY = "false";
      $env:GIT_TAG = "$(git describe --tags --always HEAD)";
      if ($env:APPVEYOR_REPO_BRANCH -match $env:GIT_TAG) {
        $env:PUBLISH_BINARY = "true";
      }
      if ($env:APPVEYOR_REPO_TAG -match "true") {
        $env:PUBLISH_BINARY = "true";
      }
      true;
  - ps: >
      @{
        "APPVEYOR_REPO_BRANCH" = $env:APPVEYOR_REPO_BRANCH
        "APPVEYOR_REPO_TAG" = $env:APPVEYOR_REPO_TAG
        "APPVEYOR_REPO_COMMIT_MESSAGE" = $env:APPVEYOR_REPO_COMMIT_MESSAGE
        "LATEST TAG" = $env:GIT_TAG
        "PUBLISHING" = $env:PUBLISH_BINARY
      } | Out-String | Write-Host;

build_script:
  - npm install --build-from-source

test_script:
  - npm test
  - ps: >
      if ($env:PUBLISH_BINARY -eq "true") {
        npm run prebuild-ci | Write-Host;
      }
      true;

deploy: OFF
