Move Bootstrap to 'install' phase for Travis-CI (#4250)

This commit is contained in:
Travis Plunk authored and Dongbo Wang committed 2017-07-13 21:21:32 -07:00
1 parent a10d1c2281
commit 67266f6aa0
2 files changed
+84 -73

No files matched your search

+2 -1
View File
@@ -31,9 +31,10 @@ install:
nvm install 6.4.0 &&
npm install -g markdown-spellcheck@0.11.0;
fi
- ulimit -n 4096
- powershell -File tools/travis.ps1 -Bootstrap
script:
- ulimit -n 4096
- powershell -File tools/travis.ps1
# spellcheck
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
+82 -72
View File
@@ -1,3 +1,7 @@
param(
[switch]$Bootstrap
)
Import-Module $PSScriptRoot/../build.psm1 -Force
# This function retrieves the appropriate svg to be used when presenting
@@ -94,86 +98,92 @@ function Set-DailyBuildBadge
$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'"
Start-PSBootstrap -Package:(-not $isPr)
$output = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions))
# CrossGen'ed assemblies cause a hang to happen intermittently when running powershell class
# basic parsing tests in Linux/OSX. The hang seems to happen when generating dynamic assemblies.
# This issue has been reported to CoreCLR team. We need to work around it for now because
# the Travis CI build failures caused by this is draining our builder resource and severely
# affect our daily work. The workaround is:
# 1. For pull request and push commit, build without '-CrossGen' and run the parsing tests
# 2. For nightly build, build with '-CrossGen' but don't run the parsing tests
# With this workaround, CI builds triggered by pull request and push commit will exercise
# the parsing tests with IL assemblies, while nightly builds will exercise CrossGen'ed assemblies
# without running those class parsing tests so as to avoid the hang.
# NOTE: this change should be reverted once the 'CrossGen' issue is fixed by CoreCLR. The issue
# is tracked by https://github.com/dotnet/coreclr/issues/9745
$originalProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
try {
Start-PSBuild -CrossGen:$isFullBuild -PSModuleRestore
}
finally{
$ProgressPreference = $originalProgressPreference
if($Bootstrap.IsPresent)
{
Write-Host -Foreground Green "Executing travis.ps1 -BootStrap `$isPR='$isPr'"
Start-PSBootstrap -Package:(-not $isPr)
}
else
{
Write-Host -Foreground Green "Executing travis.ps1 `$isPR='$isPr' `$isFullBuild='$isFullBuild'"
$output = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions))
$pesterParam = @{ 'binDir' = $output }
if ($isFullBuild) {
$pesterParam['Tag'] = @('CI','Feature','Scenario')
$pesterParam['ExcludeTag'] = @()
} else {
$pesterParam['Tag'] = @('CI')
$pesterParam['ThrowOnFailure'] = $true
}
# Remove telemetry semaphore file in CI
$telemetrySemaphoreFilepath = Join-Path $output DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY
if ( Test-Path "${telemetrySemaphoreFilepath}" ) {
Remove-Item -force ${telemetrySemaphoreFilepath}
}
Start-PSPester @pesterParam
if (-not $isPr) {
# Run 'CrossGen' for push commit, so that we can generate package.
# It won't rebuild powershell, but only CrossGen the already built assemblies.
if (-not $isFullBuild) { Start-PSBuild -CrossGen }
# Only build packages for branches, not pull requests
Start-PSPackage
Start-PSPackage -Type AppImage
# CrossGen'ed assemblies cause a hang to happen intermittently when running powershell class
# basic parsing tests in Linux/OSX. The hang seems to happen when generating dynamic assemblies.
# This issue has been reported to CoreCLR team. We need to work around it for now because
# the Travis CI build failures caused by this is draining our builder resource and severely
# affect our daily work. The workaround is:
# 1. For pull request and push commit, build without '-CrossGen' and run the parsing tests
# 2. For nightly build, build with '-CrossGen' but don't run the parsing tests
# With this workaround, CI builds triggered by pull request and push commit will exercise
# the parsing tests with IL assemblies, while nightly builds will exercise CrossGen'ed assemblies
# without running those class parsing tests so as to avoid the hang.
# NOTE: this change should be reverted once the 'CrossGen' issue is fixed by CoreCLR. The issue
# is tracked by https://github.com/dotnet/coreclr/issues/9745
$originalProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
try {
# this throws if there was an error
Test-PSPesterResults
$result = "PASS"
Start-PSBuild -CrossGen:$isFullBuild -PSModuleRestore
}
catch {
$resultError = $_
$result = "FAIL"
finally{
$ProgressPreference = $originalProgressPreference
}
if ( $isFullBuild ) {
# now update the badge if you've done a full build, these are not fatal issues
$pesterParam = @{ 'binDir' = $output }
if ($isFullBuild) {
$pesterParam['Tag'] = @('CI','Feature','Scenario')
$pesterParam['ExcludeTag'] = @()
} else {
$pesterParam['Tag'] = @('CI')
$pesterParam['ThrowOnFailure'] = $true
}
# Remove telemetry semaphore file in CI
$telemetrySemaphoreFilepath = Join-Path $output DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY
if ( Test-Path "${telemetrySemaphoreFilepath}" ) {
Remove-Item -force ${telemetrySemaphoreFilepath}
}
Start-PSPester @pesterParam
if (-not $isPr) {
# Run 'CrossGen' for push commit, so that we can generate package.
# It won't rebuild powershell, but only CrossGen the already built assemblies.
if (-not $isFullBuild) { Start-PSBuild -CrossGen }
# Only build packages for branches, not pull requests
Start-PSPackage
Start-PSPackage -Type AppImage
try {
$svgData = Get-DailyBadge -result $result
if ( ! $svgData ) {
write-warning "Could not retrieve $result badge"
}
else {
Write-Verbose -verbose "Setting status badge to '$result'"
Set-DailyBuildBadge -content $svgData
}
# this throws if there was an error
Test-PSPesterResults
$result = "PASS"
}
catch {
Write-Warning "Could not update status badge: $_"
$resultError = $_
$result = "FAIL"
}
if ( $isFullBuild ) {
# now update the badge if you've done a full build, these are not fatal issues
try {
$svgData = Get-DailyBadge -result $result
if ( ! $svgData ) {
write-warning "Could not retrieve $result badge"
}
else {
Write-Verbose -verbose "Setting status badge to '$result'"
Set-DailyBuildBadge -content $svgData
}
}
catch {
Write-Warning "Could not update status badge: $_"
}
}
# if the tests did not pass, throw the reason why
if ( $result -eq "FAIL" ) {
Throw $resultError
}
}
# if the tests did not pass, throw the reason why
if ( $result -eq "FAIL" ) {
Throw $resultError
}
}
Start-PSxUnit
Start-PSxUnit
}