From a4a700ea60a1fae205995d7057e2d4f759a101c0 Mon Sep 17 00:00:00 2001 From: Daniel Donenfeld Date: Wed, 27 Feb 2019 15:24:55 -0800 Subject: [PATCH] Reorder travis functions together --- asm/scripts/API-Functions.ps1 | 49 ++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/asm/scripts/API-Functions.ps1 b/asm/scripts/API-Functions.ps1 index a948beb..9fef98b 100644 --- a/asm/scripts/API-Functions.ps1 +++ b/asm/scripts/API-Functions.ps1 @@ -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 { param() $buildData = Get-AppVeyorBuild @@ -65,6 +41,31 @@ function appveyorFinished { 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 { param()