Don't bother building out of date PR versions on AppVeyor

Exit early if there is version of the PR newer than the one that we are
about to start building, to avoid wasting 3.5 hours of AppVeyor build
time on the outdated PR versions.

The snippet doing this was copied from

https://github.com/appveyor/ci/issues/38#issuecomment-70628826

(thanks to Tony Kelman). An alternative to doing this could be enabling
the "Rolling builds" option in the AppVeyor UI, see

https://www.appveyor.com/docs/build-configuration/#rolling-builds

but this method seems to work well in practice and is more explicit.
This commit is contained in:
Vadim Zeitlin 2021-10-03 16:17:33 +02:00
commit 1f33118077

View file

@ -51,6 +51,13 @@ matrix:
- SWIGLANG: python
OSVARIANT: cygwin
init:
- 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." }
install:
- date /T & time /T
- ps: >-