Reorder travis functions together

This commit is contained in:
Daniel Donenfeld 2019-02-27 15:24:55 -08:00
parent 840f1be8c6
commit a4a700ea60

View File

@ -11,30 +11,6 @@ function Get-AppVeyorBuild {
} }
} }
function Get-TravisBuild {
param(
[int]$limit = 10,
[int]$maxLimit = 100
)
if (-not ($env:TRAVIS_API_TOKEN)) {
throw "missing api token for Travis-CI."
}
$builds = Invoke-RestMethod -Uri "https://api.travis-ci.org/builds?limit=$($limit)" -Method Get -Headers @{
"Authorization" = "token $env:TRAVIS_API_TOKEN"
"Travis-API-Version" = "3"
}
$currentBuild = $builds.builds | Where-Object {$_.commit.sha -eq $env:APPVEYOR_REPO_COMMIT}
if (!$currentBuild) {
if($limit+10 -le $maxLimit) {
return Get-TravisBuild -limit $limit+10 -maxLimit $maxLimit
} else {
throw "Could not get information about Travis build with sha $REPO_COMMIT"
}
}
return $currentBuild
}
function appveyorFinished { function appveyorFinished {
param() param()
$buildData = Get-AppVeyorBuild $buildData = Get-AppVeyorBuild
@ -65,6 +41,31 @@ function appveyorFinished {
throw "Test jobs were not finished in $env:TIMEOUT_MINS minutes" throw "Test jobs were not finished in $env:TIMEOUT_MINS minutes"
} }
function Get-TravisBuild {
param(
[int]$limit = 10,
[int]$maxLimit = 100
)
if (-not ($env:TRAVIS_API_TOKEN)) {
throw "missing api token for Travis-CI."
}
$builds = Invoke-RestMethod -Uri "https://api.travis-ci.org/builds?limit=$($limit)" -Method Get -Headers @{
"Authorization" = "token $env:TRAVIS_API_TOKEN"
"Travis-API-Version" = "3"
}
$currentBuild = $builds.builds | Where-Object {$_.commit.sha -eq $env:APPVEYOR_REPO_COMMIT}
if (!$currentBuild) {
if($limit+10 -le $maxLimit) {
return Get-TravisBuild -limit $limit+10 -maxLimit $maxLimit
} else {
throw "Could not get information about Travis build with sha $REPO_COMMIT"
}
}
return $currentBuild
}
function travisFinished { function travisFinished {
param() param()