diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..f1bf1ea91 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,46 @@ +# This code is part of Qiskit. +# +# (C) Copyright IBM 2017, 2019. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +version: 1.0.{build} + +environment: + matrix: + - PYTHON_VERSION: 3.5 + PYTHON: C:\Python35 + +build: false +deploy: false +skip_branch_with_pr: true + +install: + # If there is a newer build queued for the same PR, cancel this one. + # The AppVeyor 'rollout builds' option is supposed to serve the same + # purpose but it is problematic because it tends to cancel builds pushed + # directly to master instead of just PR builds (or the converse). + # credits: JuliaLang developers. + - ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` + https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` + Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` + throw "There are newer queued builds for this pull request, failing early." } + - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" + - pip.exe install -U -r requirements.txt + - pip.exe install -U -r requirements-dev.txt + - pip.exe install pytest + +# Use py.test for output of xunit test results. +test_script: + - py.test -s -v --junit-xml=test_results.xml + +# Upload the test results to appveyor so they are shown on the "Tests" tab. +after_test: + - ps: $wc = New-Object 'System.Net.WebClient' + - ps: $wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\test_results.xml))