From b126d698e20b4c65a367c7b2a86b76b1100975c3 Mon Sep 17 00:00:00 2001 From: Sergei Vorobev Date: Fri, 11 Mar 2016 18:24:43 -0800 Subject: [PATCH] Hide output of dotnet restore by default Address Andy's comments about build script. Add more information about the version into build Use windows inbox version of pester for FullCLR Revert dotnet cli to a known good version to avoid #638 --- .travis.yml | 2 +- PowerShellGitHubDev.psm1 | 48 ++++++++++++++++++++++++---------------- README.md | 2 +- appveyor.yml | 34 +++++++++++++++++----------- 4 files changed, 52 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index 99ae89a887..a95fb403a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ before_install: - sudo sh -c 'echo "deb [arch=amd64] http://apt-mo.trafficmanager.net/repos/dotnet/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' - sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 - sudo apt-get -qq update - - sudo apt-get install -y dotnet=1.0.0.001638-1 + - sudo apt-get install -y dotnet=1.0.0.001425-1 script: - dotnet restore - ./build.sh diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 7e9f072500..60e2e166fa 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -62,6 +62,11 @@ function Start-PSBuild } } + function log([string]$message) + { + Write-Host -Foreground Green $message + } + # simplify ParameterSetNames, set output if ($PSCmdlet.ParameterSetName -eq 'FullCLR') { @@ -70,7 +75,7 @@ function Start-PSBuild if (-not $Output) { - if ($FullCLR) { $Output = "$PSScriptRoot\binFull" } else { $Output = "$PSScriptRoot\bin" } + if ($FullCLR) { $Output = "$PSScriptRoot/binFull" } else { $Output = "$PSScriptRoot/bin" } } # verify we have all tools in place to do the build @@ -87,12 +92,12 @@ function Start-PSBuild # handle clean if ($Clean) { - Remove-Item -Force -Recurse $Output -ErrorAction SilentlyContinues + Remove-Item -Force -Recurse $Output -ErrorAction SilentlyContinue } New-Item -Force -Type Directory $Output | Out-Null - # handle Restore + # define key build variables if ($FullCLR) { $Top = "$PSScriptRoot\src\Microsoft.PowerShell.ConsoleHost" @@ -104,16 +109,26 @@ function Start-PSBuild $framework = 'netstandardapp1.5' } + # handle Restore if ($Restore -Or -Not (Test-Path "$Top/project.lock.json")) { - dotnet restore $PSScriptRoot + log "Run dotnet restore" + # restore is genuinely verbose. + # we don't show it by default to keep CI build log size small + if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) + { + dotnet restore $PSScriptRoot + } + else + { + dotnet restore $PSScriptRoot > $null + } } # Build native components if (-not $FullCLR) { - Write-Verbose "Start CoreCLR build" - if ($IsLinux -Or $IsOSX) { + log "Start building native components" $InstallCommand = if ($IsLinux) { "apt-get" } elseif ($IsOSX) { "brew" } foreach ($Dependency in "cmake", "g++") { if (-Not (Get-Command $Dependency -ErrorAction SilentlyContinue)) { @@ -141,36 +156,32 @@ function Start-PSBuild } else { - Write-Verbose "Start building native powershell.exe" + log "Start building native powershell.exe" $build = "$PSScriptRoot/build" if ($Clean) { Remove-Item -Force -Recurse $build -ErrorAction SilentlyContinue } mkdir $build -ErrorAction SilentlyContinue - $origPWD = $pwd try { - cd $build + Push-Location $build if ($cmakeGenerator) { - cmake -G "$cmakeGenerator" ..\src\powershell-native + cmake -G $cmakeGenerator ..\src\powershell-native } else { cmake ..\src\powershell-native } msbuild powershell.vcxproj /p:Configuration=$msbuildConfiguration - cp -rec $msbuildConfiguration\* $BINFULL - } - finally - { - cd $origPWD + cp -rec $msbuildConfiguration\* $Output } + finally { Pop-Location } } - Write-Verbose "Building PowerShell" + log "Building PowerShell" $Arguments = "--framework", $framework, "--output", $Output if ($IsLinux -Or $IsOSX) { $Arguments += "--configuration", "Linux" } if ($Runtime) { $Arguments += "--runtime", $Runtime } @@ -180,8 +191,7 @@ function Start-PSBuild # there is a problem with code signing: # AssemblyKeyFileAttribute file path cannot be correctly located, if `dotnet publish $TOP` syntax is used # we workaround it with calling `dotnet publish` from $TOP directory instead. - $origPWD = $pwd - cd $Top + Push-Location $Top } else { @@ -197,7 +207,7 @@ function Start-PSBuild } finally { - if ($FullCLR) { cd $origPWD } + if ($FullCLR) { Pop-Location } } } diff --git a/README.md b/README.md index b39c0fa413..424859be5c 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ to obtain all the necessary .NET packages.** Build with `./build.sh` on Linux and OS X. -`Start-PSBuild` from module `.\PowerShellGitHubDev.psm1` on Windows. +`Start-PSBuild` from module `.\PowerShellGitHubDev.psm1` on Windows and Linux / OS X, if you self-hosting PowerShell. Specifically: diff --git a/appveyor.yml b/appveyor.yml index 733bf4bd0b..055b191be3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,5 @@ +version: 0.2.0.{build} + environment: priv_key: secure: @@ -18,7 +20,7 @@ install: - git config --global url.git@github.com:.insteadOf https://github.com/ - git submodule update --init --recursive -- src/monad src/windows-build src/Microsoft.PowerShell.Linux.Host/Modules/Pester - ps: Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 - - ps: ./install.ps1 -version 1.0.0.001638 -channel beta + - ps: ./install.ps1 -version 1.0.0.001425 -channel beta build_script: - ps: | @@ -34,32 +36,38 @@ test_script: $ErrorActionPreference = 'Stop' # # CoreCLR - $testResultsFile = ".\TestsResults.xml" + Write-Host -Foreground Green 'Run CoreCLR tests' + $testResultsFile = "$pwd\TestsResults.xml" .\bin\powershell.exe --noprofile -c "Import-Module .\bin\Modules\Microsoft.PowerShell.Platform; Invoke-Pester test/powershell -OutputFormat NUnitXml -OutputFile $testResultsFile" (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile)) # # FullCLR - $testResultsFile = ".\TestsResults.FullCLR.xml" - Start-DevPSGitHub -binDir $pwd\binFull -NoNewWindow -ArgumentList '-command', "Import-Module .\bin\Modules\Pester; Import-Module .\bin\Modules\Microsoft.PowerShell.Platform; Invoke-Pester test/fullCLR -OutputFormat NUnitXml -OutputFile $testResultsFile" - (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile)) + Write-Host -Foreground Green 'Run FullCLR tests' + $testResultsFileFullCLR = "$pwd\TestsResults.FullCLR.xml" + Start-DevPSGitHub -binDir $pwd\binFull -NoNewWindow -ArgumentList '-command', "Import-Module .\src\monad\monad\src\OSS\Pester; Import-Module .\bin\Modules\Microsoft.PowerShell.Platform; Invoke-Pester test/fullCLR -OutputFormat NUnitXml -OutputFile $testResultsFileFullCLR" + (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFileFullCLR)) # # Fail the build, if tests failed - $x = [xml](cat -raw .\TestsResults.FullCLR.xml) - if ([int]$x.'test-results'.failures -gt 0) - { - throw "$($x.'test-results'.failures) tests in test/fullCLR failed" - } - $x = [xml](cat -raw .\TestsResults.xml) + Write-Host -Foreground Green 'Upload CoreCLR test results' + $x = [xml](cat -raw $testResultsFile) if ([int]$x.'test-results'.failures -gt 0) { throw "$($x.'test-results'.failures) tests in test/powershell failed" } + Write-Host -Foreground Green 'Upload FullCLR test results' + $x = [xml](cat -raw $testResultsFileFullCLR) + if ([int]$x.'test-results'.failures -gt 0) + { + throw "$($x.'test-results'.failures) tests in test/fullCLR failed" + } + on_finish: - ps: | # Creating project artifact - $zipFilePath = Join-Path $pwd "$(Split-Path $pwd -Leaf).zip" - $zipFileFullPath = Join-Path $pwd "$(Split-Path $pwd -Leaf).FullCLR.zip" + $name = git describe + $zipFilePath = Join-Path $pwd "$name.zip" + $zipFileFullPath = Join-Path $pwd "$name.FullCLR.zip" Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory("$pwd\bin", $zipFilePath) [System.IO.Compression.ZipFile]::CreateFromDirectory("$pwd\binFull", $zipFileFullPath)