Add step to appveyor process to cancel builds on PR update (#1239)

Right now when we're queuing jobs for appveyor ci if we push updates to
the same PR we still run the jobs for both the outdated revision of the
PR (which we throw away) and then the new revision. During periods of
active or fast paced development this can lead to very long queues. This
commit partially addresses the problem by canceling jobs if a PR update
has been pushed. While it won't solve the complete problem it does
improve the situation.
This commit is contained in:
Matthew Treinish 2018-11-12 14:02:10 -05:00 committed by GitHub
parent 404868c38f
commit eb319662b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,15 @@ 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." }
- "%PYTHON%\\python.exe -m venv venv"
- venv\Scripts\activate.bat
- pip.exe install -r requirements.txt