From eb319662b77e99fa5a5ee357b4087f91966cab9a Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Mon, 12 Nov 2018 14:02:10 -0500 Subject: [PATCH] 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. --- appveyor.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 734c52c0f8..002e62a0f5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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