mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Add comments to indicate which are travis or appveyor specific functions. Rearange file a little
This commit is contained in:
parent
7a3bfa26dc
commit
236efc5751
@ -1,47 +1,4 @@
|
|||||||
function Get-AppVeyorBuild {
|
#Travis related functions (Currently unused and untested)
|
||||||
param()
|
|
||||||
|
|
||||||
if (-not ($env:APPVEYOR_API_TOKEN)) {
|
|
||||||
throw "missing api token for AppVeyor."
|
|
||||||
}
|
|
||||||
|
|
||||||
Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/build/$($env:APPVEYOR_BUILD_VERSION)" -Method GET -Headers @{
|
|
||||||
"Authorization" = "Bearer $env:APPVEYOR_API_TOKEN"
|
|
||||||
"Content-type" = "application/json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function appveyorFinished {
|
|
||||||
param()
|
|
||||||
$buildData = Get-AppVeyorBuild
|
|
||||||
$lastJob = ($buildData.build.jobs | Select-Object -Last 1).jobId
|
|
||||||
|
|
||||||
if ($lastJob -ne $env:APPVEYOR_JOB_ID) {
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
|
|
||||||
[datetime]$stop = ([datetime]::Now).AddMinutes($env:TIMEOUT_MINS)
|
|
||||||
|
|
||||||
do {
|
|
||||||
|
|
||||||
$allSuccess = $true
|
|
||||||
(Get-AppVeyorBuild).build.jobs | Where-Object {$_.jobId -ne $env:APPVEYOR_JOB_ID} | Foreach-Object `
|
|
||||||
{
|
|
||||||
$job = $_
|
|
||||||
switch ($job.status) {
|
|
||||||
"failed" { throw "AppVeyor's Job ($($job.jobId)) failed." }
|
|
||||||
"success" { continue }
|
|
||||||
Default { $allSuccess = $false }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($allSuccess) { return $true }
|
|
||||||
Start-sleep 5
|
|
||||||
} while (([datetime]::Now) -lt $stop)
|
|
||||||
|
|
||||||
throw "Test jobs were not finished in $env:TIMEOUT_MINS minutes"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function Get-TravisBuild {
|
function Get-TravisBuild {
|
||||||
param(
|
param(
|
||||||
[int]$limit = 10,
|
[int]$limit = 10,
|
||||||
@ -92,6 +49,52 @@ function travisFinished {
|
|||||||
throw "Travis build did not finished in $env:TIMEOUT_MINS minutes"
|
throw "Travis build did not finished in $env:TIMEOUT_MINS minutes"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Appveyor related functions
|
||||||
|
function Get-AppVeyorBuild {
|
||||||
|
param()
|
||||||
|
|
||||||
|
if (-not ($env:APPVEYOR_API_TOKEN)) {
|
||||||
|
throw "missing api token for AppVeyor."
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/build/$($env:APPVEYOR_BUILD_VERSION)" -Method GET -Headers @{
|
||||||
|
"Authorization" = "Bearer $env:APPVEYOR_API_TOKEN"
|
||||||
|
"Content-type" = "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function appveyorFinished {
|
||||||
|
param()
|
||||||
|
$buildData = Get-AppVeyorBuild
|
||||||
|
$lastJob = ($buildData.build.jobs | Select-Object -Last 1).jobId
|
||||||
|
|
||||||
|
if ($lastJob -ne $env:APPVEYOR_JOB_ID) {
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
|
[datetime]$stop = ([datetime]::Now).AddMinutes($env:TIMEOUT_MINS)
|
||||||
|
|
||||||
|
do {
|
||||||
|
|
||||||
|
$allSuccess = $true
|
||||||
|
(Get-AppVeyorBuild).build.jobs | Where-Object {$_.jobId -ne $env:APPVEYOR_JOB_ID} | Foreach-Object `
|
||||||
|
{
|
||||||
|
$job = $_
|
||||||
|
switch ($job.status) {
|
||||||
|
"failed" { throw "AppVeyor's Job ($($job.jobId)) failed." }
|
||||||
|
"success" { continue }
|
||||||
|
Default { $allSuccess = $false }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($allSuccess) { return $true }
|
||||||
|
Start-sleep 5
|
||||||
|
} while (([datetime]::Now) -lt $stop)
|
||||||
|
|
||||||
|
throw "Test jobs were not finished in $env:TIMEOUT_MINS minutes"
|
||||||
|
}
|
||||||
|
|
||||||
|
#Build System independent functions
|
||||||
|
|
||||||
# Returns true if any Appveyor build is "failed" or "cancelled"
|
# Returns true if any Appveyor build is "failed" or "cancelled"
|
||||||
function Get-Any-Appveyor-Failures {
|
function Get-Any-Appveyor-Failures {
|
||||||
(Get-AppVeyorBuild).build.jobs | Foreach-Object `
|
(Get-AppVeyorBuild).build.jobs | Foreach-Object `
|
||||||
|
Loading…
Reference in New Issue
Block a user