2016-11-19 01:17:59 +01:00
|
|
|
Import-Module $PSScriptRoot/../build.psm1 -Force
|
|
|
|
|
2016-11-21 18:48:41 +01:00
|
|
|
# https://docs.travis-ci.com/user/environment-variables/
|
|
|
|
# TRAVIS_EVENT_TYPE: Indicates how the build was triggered.
|
|
|
|
# One of push, pull_request, api, cron.
|
|
|
|
$isPR = $env:TRAVIS_EVENT_TYPE -eq 'pull_request'
|
|
|
|
$isFullBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron' -or $env:TRAVIS_EVENT_TYPE -eq 'api'
|
|
|
|
|
|
|
|
Write-Host -Foreground Green "Executing travis.ps1 `$isPR='$isPr' `$isFullBuild='$isFullBuild'"
|
2016-11-19 01:17:59 +01:00
|
|
|
|
|
|
|
Start-PSBootstrap -Package:(-not $isPr)
|
|
|
|
$output = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -Publish))
|
2016-11-19 02:51:29 +01:00
|
|
|
Start-PSBuild -CrossGen -PSModuleRestore
|
2016-11-19 01:17:59 +01:00
|
|
|
|
|
|
|
$pesterParam = @{ 'binDir' = $output }
|
|
|
|
|
2016-11-21 18:48:41 +01:00
|
|
|
if ($isFullBuild) {
|
2016-11-19 01:17:59 +01:00
|
|
|
$pesterParam['Tag'] = @('CI','Feature','Scenario')
|
|
|
|
$pesterParam['ExcludeTag'] = @()
|
2016-12-01 20:23:14 +01:00
|
|
|
# cron jobs create log files which include the stdout of Pester
|
|
|
|
# which creates too much data for travis to put in the log file
|
|
|
|
# and the job is then cancelled. Add Quiet to reduce the log size
|
|
|
|
# the xunit log created by pester is what is important
|
|
|
|
if ( $env:TRAVIS_EVENT_TYPE -eq 'cron' ) {
|
|
|
|
$pesterParam['Quiet'] = $true
|
|
|
|
}
|
2016-11-19 01:17:59 +01:00
|
|
|
} else {
|
|
|
|
$pesterParam['Tag'] = @('CI')
|
|
|
|
$pesterParam['ThrowOnFailure'] = $true
|
|
|
|
}
|
|
|
|
|
|
|
|
Start-PSPester @pesterParam
|
|
|
|
if (-not $isPr) {
|
|
|
|
# Only build packages for branches, not pull requests
|
|
|
|
Start-PSPackage
|
|
|
|
Test-PSPesterResults
|
|
|
|
}
|
|
|
|
|
|
|
|
Start-PSxUnit
|