version: 1.0.{build}
image: Visual Studio 2017
services:
- mssql2017
- msmq
hosts:
  SpringQA: 127.0.0.1
build_script:
- rem set the alias for SpringQA so that integration test conn strings resolve properly...
- 'powershell "%APPVEYOR_BUILD_FOLDER%\build-support\appveyor-set-sql-alias-for-springqa.ps1" '
- rem create the database and schemas to support the integration tests...
- call "%APPVEYOR_BUILD_FOLDER%\build-support\appveyor-database-integration-tests-setup-scripts.cmd"
- rem we need the MSDTC running for the Tx integration tests to pass so start it if necessary...
- powershell "%APPVEYOR_BUILD_FOLDER%\build-support\wait-to-restart-service.ps1" "'MSDTC'"
- rem after applying the alias, we need to restart the SQL Server instance to ensure the alias is picked up properly...
- powershell "%APPVEYOR_BUILD_FOLDER%\build-support\wait-to-restart-service.ps1" "'MSSQL$SQL2017'"
- rem attempt to access the database via its alias to validate alias is functional...
- sqlcmd -S "SpringQA" -U springqa -P springqa -Q "select * from Vacations"
- rem actually invoke the build + test run
- call build-ci.cmd
test: off
on_finish:
- ps: >-
    $wc = New-Object 'System.Net.WebClient'


    Get-ChildItem -Path (Join-Path $($env:APPVEYOR_BUILD_FOLDER) \build\net) -Recurse -File -Filter "*-TestResults.xml" | % { $wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $_.FullName) }