clone_depth: 10

os: Visual Studio 2017

environment:
  PREBUILD_TOKEN:
    secure: 7t92yForo995jn/5Afeo6A3wcmEyus0nlybU4a9MYQ1FSoMvkjLeihbEQYr99F9S

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

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 node-gyp | Write-Host;
        npm config set -g cafile=package.json
        npm config set -g strict-ssl=false
      }
      npm config set progress false
      npm config set spin false
  - ps: >
      $env:JOBS = "max";
      $env:PUBLISH = "false";
      $env:GIT_TAG = "$(git describe --tags --always HEAD)";
      if ($env:APPVEYOR_REPO_BRANCH -match $env:GIT_TAG) {
        $env:PUBLISH = "true";
      }
      if ($env:APPVEYOR_REPO_TAG -match "true") {
        $env:PUBLISH = "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
      } | Out-String | Write-Host;

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

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

deploy: OFF
