Modify travis build to upload a daily build based on platform (#4689)

change README.md to view a platform specific badge
This commit is contained in:
James Truher [MSFT]
2017-09-05 11:11:47 -07:00
committed by Travis Plunk
parent 5f60058c22
commit cfb2913a29
2 changed files with 14 additions and 7 deletions
+5 -4
View File
@@ -108,9 +108,9 @@ If you have any problems building, please consult the developer [FAQ][].
### Build status of nightly builds
| AppVeyor (Windows) | Travis CI (Linux / macOS) | Code Coverage Status |
|--------------------------|---------------------------|----------------------|
| [![av-nightly-image][]][av-nightly-site] | [![tv-nightly-image][]][tv-site] | [![cc-image][]][cc-site] |
| AppVeyor (Windows) | Travis CI (Linux) | Travis CI (macOS) | Code Coverage Status |
|--------------------------|-------------------|-------------------|----------------------|
| [![av-nightly-image][]][av-nightly-site] | [![linux-nightly-image][]][tv-site] | [![osx-nightly-image][]][tv-site] | [![cc-image][]][cc-site] |
[bd-linux]: docs/building/linux.md
[bd-windows]: docs/building/windows-core.md
@@ -122,7 +122,8 @@ If you have any problems building, please consult the developer [FAQ][].
[tv-site]: https://travis-ci.org/PowerShell/PowerShell/branches
[av-image]: https://ci.appveyor.com/api/projects/status/nsng9iobwa895f98/branch/master?svg=true
[av-site]: https://ci.appveyor.com/project/PowerShell/powershell
[tv-nightly-image]: https://jimtru1979.blob.core.windows.net/badges/DailyBuildStatus.svg
[linux-nightly-image]: https://jimtru1979.blob.core.windows.net/badges/DailyBuildStatus.Linux.svg
[osx-nightly-image]: https://jimtru1979.blob.core.windows.net/badges/DailyBuildStatus.OSX.svg
[av-nightly-image]: https://ci.appveyor.com/api/projects/status/46yd4jogtm2jodcq?svg=true
[av-nightly-site]: https://ci.appveyor.com/project/PowerShell/powershell-f975h
[cc-site]: https://codecov.io/gh/PowerShell/PowerShell
+9 -3
View File
@@ -29,6 +29,8 @@ function Get-DailyBadge
#
# the best way to do this would be if travis-ci supported a webcall to get
# the status of cron_job builds, but it doesn't, so we have this
# also, since we can have a build on Linux which succeeds and one on OSX which
# doesn't we'll set the appropriate badge so the the README can pick it up
function Set-DailyBuildBadge
{
[CmdletBinding(SupportsShouldProcess=$true)]
@@ -40,7 +42,8 @@ function Set-DailyBuildBadge
$storageAccountKey = $Env:TestResultAccountKey
# this is the url referenced in README.MD which displays the badge
$Url = "https://jimtru1979.blob.core.windows.net/badges/DailyBuildStatus.svg"
$platform = if ( $IsOSX ) { "OSX" } else { "Linux" }
$Url = "https://jimtru1979.blob.core.windows.net/badges/DailyBuildStatus.${platform}.svg"
$body = $content
$bytes = ([System.Text.Encoding]::UTF8.GetBytes($body))
@@ -112,6 +115,8 @@ else
# Run a full build if the build was trigger via cron, api or the commit message contains `[Feature]`
$hasFeatureTag = $commitMessage -match '\[feature\]'
$isDailyBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron' -or $env:TRAVIS_EVENT_TYPE -eq 'api'
# only update the build badge for the cron job
$cronBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron'
$isFullBuild = $isDailyBuild -or $hasFeatureTag
if($Bootstrap.IsPresent)
@@ -198,6 +203,7 @@ else
}
}
# Determine whether the build passed
try {
# this throws if there was an error
Test-PSPesterResults -ResultObject $pesterPassThruObject
@@ -207,8 +213,8 @@ else
$resultError = $_
$result = "FAIL"
}
if ( $isDailyBuild ) {
# now update the badge if you've done a full build, these are not fatal issues
# 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 ) {