Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,17 @@ install:
npm install -g markdown-spellcheck@0.11.0;
fi
- ulimit -n 4096
- pwsh -File tools/travis.ps1 -Bootstrap
- pwsh -File tools/travis.ps1 -Stage Bootstrap

script:
- pwsh -File tools/travis.ps1
# spellcheck
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
mdspell '**/*.md' '!powershell/**/*.md' --ignore-numbers --ignore-acronyms --report;
fi

after_failure:
- pwsh -File tools/travis.ps1 -Stage Failure

after_success:
- pwsh -File tools/travis.ps1 -Stage Success
65 changes: 40 additions & 25 deletions tools/travis.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
param(
[switch]$Bootstrap
[ValidateSet('Bootstrap','Build','Failure','Success')]
[String]$Stage = 'Build'
)

Import-Module $PSScriptRoot/../build.psm1 -Force
Import-Module $PSScriptRoot/packaging -Force

Expand Down Expand Up @@ -158,14 +160,14 @@ $isDailyBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron' -or $env:TRAVIS_EVENT_TYPE -eq
$cronBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron'
$isFullBuild = $isDailyBuild -or $hasFeatureTag

if($Bootstrap.IsPresent)
if($Stage -eq 'Bootstrap')
{
Write-Host -Foreground Green "Executing travis.ps1 -BootStrap `$isPR='$isPr' - $commitMessage"
# Make sure we have all the tags
Sync-PSTags -AddRemoteIfMissing
Start-PSBootstrap -Package:(-not $isPr)
}
else
elseif($Stage -eq 'Build')
{
$BaseVersion = (Get-PSVersion -OmitCommitId) + '-'
Write-Host -Foreground Green "Executing travis.ps1 `$isPR='$isPr' `$isFullBuild='$isFullBuild' - $commitMessage"
Expand Down Expand Up @@ -269,33 +271,46 @@ else
Start-NativeExecution -sb {dotnet nuget push $package --api-key $env:NUGET_KEY --source "$env:NUGET_URL/api/v2/package"} -IgnoreExitcode
}
}
}

# if the tests did not pass, throw the reason why
if ( $result -eq "FAIL" ) {
Throw $resultError
}
}
elseif($Stage -in 'Failure', 'Success')
{
$result = 'PASS'
if($Stage -eq 'Failure')
{
$result = 'FAIL'
}

if ($cronBuild) {
# update the badge if you've done a cron build, these are not fatal issues
if ( $cronBuild ) {
try {
$svgData = Get-DailyBadge -result $result
if ( ! $svgData ) {
write-warning "Could not retrieve $result badge"
}
else {
log "Setting status badge to '$result'"
Set-DailyBuildBadge -content $svgData
}
try {
$svgData = Get-DailyBadge -result $result
if ( ! $svgData ) {
write-warning "Could not retrieve $result badge"
}
catch {
Write-Warning "Could not update status badge: $_"
}
try {
Send-DailyWebHook -result $result
}
catch {
Write-Warning "Could not send webhook: $_"
else {
log "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
try {
Send-DailyWebHook -result $result
}
catch {
Write-Warning "Could not send webhook: $_"
}
}
else {
log 'We only send bagde or webhook update for Cron builds'
}

}