init:
  - git config --global core.autocrlf true
install:
   - ps: Install-Product node 6.9.2 x64
   # .NET Core SDK binaries
   # Download .NET Core 2.0 Preview 3 SDK and add to PATH
   - ps: $urlCurrent = "https://dotnetcli.azureedge.net/dotnet/Sdk/2.0.0-preview3-006638/dotnet-sdk-2.0.0-preview3-006638-win-x64.zip"
   - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
   - ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
   - ps: $tempFileCurrent = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName())
   - ps: (New-Object System.Net.WebClient).DownloadFile($urlCurrent, $tempFileCurrent)
   - ps: Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory($tempFileCurrent, $env:DOTNET_INSTALL_DIR)
   - ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
build_script:
  - ps: Push-Location
  - cd templates/package-builder
  - npm install
  - npm run build
  - ps: Pop-Location
artifacts:
  - path: templates\package-builder\dist\artifacts\generator-aspnetcore-spa.tar.gz
    name: generator-aspnetcore-spa
  - path: templates\package-builder\dist\artifacts\*.nupkg
    name: Microsoft.AspNetCore.SpaTemplates
    type: NuGetPackage
#  - ps: .\build.ps1
clone_depth: 1
test_script:
  - dotnet restore
  - ps: Push-Location
  - cd test
  - npm install selenium-standalone
  - ps: Start-Process node './start-selenium.js'
  - npm install
  - npm test
on_finish :
  - ps: Pop-Location
  # After running tests, upload results to Appveyor
  - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\test\tmp\junit\*.xml))
deploy: off
