Add daily build non-windows platforms (#7683)

Add daily build non-windows platforms
  - Also, make the [Feature] tag work in VSTS for non-windows
  - Also, add a way to force feature tests to run
  - Also, fix an issue where `-workingdirectory` didn't work when running async
This commit is contained in:
Travis Plunk
2018-09-06 18:00:46 -07:00
parent b17c5113f4
commit 433a263a17
7 changed files with 86 additions and 29 deletions
+9 -13
View File
@@ -14,9 +14,14 @@ phases:
- phase: Linux_CI
queue:
name: Hosted Linux Preview
name: Hosted Ubuntu 1604
steps:
- powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhss"))"
- powershell: |
Get-ChildItem -Path env:
displayName: Capture environment
condition: succeededOrFailed()
- powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
displayName: Set Build Name for Non-PR
condition: ne(variables['Build.Reason'], 'PullRequest')
@@ -33,8 +38,8 @@ phases:
condition: succeededOrFailed()
- powershell: |
apt-get update
apt-get install -y --no-install-recommends less
sudo apt-get update
sudo apt-get install -y --no-install-recommends less
displayName: Install less
condition: succeededOrFailed()
@@ -65,14 +70,5 @@ phases:
Write-Host "##vso[artifact.upload containerfolder=artifacts;artifactname=artifacts]$_"
}
displayName: Publish Artifacts
condition: succeededOrFailed()
continueOnError: true
# Uploads any Test results as an artifact
- powershell: |
Get-ChildItem -Path Test*.xml, *XUnitTestResults.xml -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object {
Write-Host "##vso[artifact.upload containerfolder=testResults;artifactname=testResults]$_"
}
displayName: Publish Test Results
condition: ne(variables['Build.Reason'], 'PullRequest')
continueOnError: true
+7 -2
View File
@@ -14,9 +14,14 @@ phases:
- phase: macOS_CI
queue:
name: Hosted macOS Preview
name: Hosted macOS
steps:
- powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhss"))"
- powershell: |
Get-ChildItem -Path env:
displayName: Capture environment
condition: succeededOrFailed()
- powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
displayName: Set Build Name for Non-PR
condition: ne(variables['Build.Reason'], 'PullRequest')
+6 -1
View File
@@ -20,7 +20,12 @@ resources:
clean: true
steps:
- powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhss"))"
- powershell: |
Get-ChildItem -Path env:
displayName: Capture environment
condition: succeededOrFailed()
- powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
displayName: Set Build Name for Non-PR
condition: ne(variables['Build.Reason'], 'PullRequest')
+1 -1
View File
@@ -1825,7 +1825,7 @@ function Start-PSBootstrap {
# We cannot guess if the user wants to run gem install as root on linux and windows,
# but macOs usually requires sudo
$gemsudo = ''
if($Environment.IsMacOS) {
if($Environment.IsMacOS -or $env:TF_BUILD) {
$gemsudo = $sudo
}
Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install fpm -v 1.10.0"))
@@ -160,6 +160,18 @@ namespace Microsoft.PowerShell
ExecuteCommandAsyncHelper(tempPipeline, out exceptionThrown, options);
}
/// <summary>
/// Executes a pipeline in the console when we are running asnyc.
/// </summary>
/// <param name="tempPipeline">
/// The pipeline to execute.
/// </param>
/// <param name="exceptionThrown">
/// Any exception thrown trying to run the pipeline.
/// </param>
/// <param name="options">
/// The options to use to execute the pipeline.
/// </param>
internal void ExecuteCommandAsyncHelper(Pipeline tempPipeline, out Exception exceptionThrown, ExecutionOptions options)
{
Dbg.Assert(!_isPromptFunctionExecutor, "should not async invoke the prompt");
@@ -192,7 +204,14 @@ namespace Microsoft.PowerShell
tempPipeline.Output.DataReady += new EventHandler(OutputObjectStreamHandler);
tempPipeline.Error.DataReady += new EventHandler(ErrorObjectStreamHandler);
PipelineFinishedWaitHandle waiterThereIsAFlyInMySoup = new PipelineFinishedWaitHandle(tempPipeline);
PipelineFinishedWaitHandle pipelineWaiter = new PipelineFinishedWaitHandle(tempPipeline);
// close the input pipeline so the command will do something
// if we are not reading input
if ((options & Executor.ExecutionOptions.ReadInputObjects) == 0)
{
tempPipeline.Input.Close();
}
tempPipeline.InvokeAsync();
if ((options & ExecutionOptions.ReadInputObjects) > 0 && Console.IsInputRedirected)
@@ -224,7 +243,7 @@ namespace Microsoft.PowerShell
}
tempPipeline.Input.Close();
waiterThereIsAFlyInMySoup.Wait();
pipelineWaiter.Wait();
//report error if pipeline failed
if (tempPipeline.PipelineStateInfo.State == PipelineState.Failed && tempPipeline.PipelineStateInfo.Reason != null)
+2 -2
View File
@@ -548,7 +548,7 @@ foo
@{ value = "~\$folderName"; expectedPath = $((Get-Item ~\$folderName).FullName) }
) {
param($value, $expectedPath)
$output = & $powershell -WorkingDirectory "$value" -Command "`$pwd.Path"
$output = & $powershell -NoProfile -WorkingDirectory "$value" -Command '(Get-Location).Path'
$output | Should -BeExactly $expectedPath
}
@@ -558,7 +558,7 @@ foo
@{ parameter = '-wo' }
) {
param($parameter)
$output = & $powershell $parameter ~ -Command "`$pwd.Path"
$output = & $powershell -NoProfile $parameter ~ -Command "`$pwd.Path"
$output | Should -BeExactly $((Get-Item ~).FullName)
}
+40 -8
View File
@@ -154,12 +154,35 @@ function Set-DailyBuildBadge
# One of push, pull_request, api, cron.
$isPR = $env:TRAVIS_EVENT_TYPE -eq 'pull_request'
$commitMessage = [string]::Empty
# For PRs, Travis-ci strips out [ and ] so read the message directly from git
if($env:TRAVIS_EVENT_TYPE -eq 'pull_request')
if($env:TRAVIS_EVENT_TYPE -eq 'pull_request' -or $env:BUILD_REASON)
{
# If the current job is a pull request, the env variable 'TRAVIS_PULL_REQUEST_SHA' contains
# the commit SHA of the HEAD commit of the PR.
$commitMessage = git log --format=%B -n 1 $env:TRAVIS_PULL_REQUEST_SHA
$commitId = $null
if ($env:TRAVIS_EVENT_TYPE)
{
# We are in Travis-CI
$commitId = $env:TRAVIS_PULL_REQUEST_SHA
# If the current job is a pull request, the env variable 'TRAVIS_PULL_REQUEST_SHA' contains
# the commit SHA of the HEAD commit of the PR.
$commitMessage = git log --format=%B -n 1 $commitId
Write-Log -message "commitMessage: $commitMessage"
}
elseif($env:TF_BUILD)
{
if($env:BUILD_SOURCEVERSIONMESSAGE -match 'Merge\s*([0-9A-F]*)')
{
# We are in VSTS and have a commit ID in the Source Version Message
$commitId = $Matches[1]
$commitMessage = git log --format=%B -n 1 $commitId
}
else
{
Write-Log "Unknown BUILD_SOURCEVERSIONMESSAGE format '$env:BUILD_SOURCEVERSIONMESSAGE'" -Verbose
}
}
}
else
{
@@ -167,17 +190,26 @@ else
}
# Run a full build if the build was trigger via cron, api or the commit message contains `[Feature]`
$hasFeatureTag = $commitMessage -match '\[feature\]'
$hasPackageTag = $commitMessage -match '\[package\]'
# or the environment variable `FORCE_FEATURE` equals `True`
$hasFeatureTag = $commitMessage -match '\[feature\]' -or $env:FORCE_FEATURE -eq 'True'
# Run a packaging if the commit message contains `[Package]`
# or the environment variable `FORCE_PACKAGE` equals `True`
$hasPackageTag = $commitMessage -match '\[package\]' -or $env:FORCE_PACKAGE -eq 'True'
$createPackages = -not $isPr -or $hasPackageTag
$hasRunFailingTestTag = $commitMessage -match '\[includeFailingTest\]'
$isDailyBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron' -or $env:TRAVIS_EVENT_TYPE -eq 'api'
$isDailyBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron' -or $env:TRAVIS_EVENT_TYPE -eq 'api' -or $env:BUILD_REASON -eq 'Schedule'
# only update the build badge for the cron job
$cronBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron'
$cronBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron' -or $env:BUILD_REASON -eq 'Schedule'
$isFullBuild = $isDailyBuild -or $hasFeatureTag
if($Stage -eq 'Bootstrap')
{
if($cronBuild -and $env:TF_BUILD)
{
Write-Host "##vso[build.updatebuildnumber]Daily-$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
}
Write-Host -Foreground Green "Executing travis.ps1 -BootStrap `$isPR='$isPr' - $commitMessage"
# Make sure we have all the tags
Sync-PSTags -AddRemoteIfMissing