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
36 changes: 24 additions & 12 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function Start-PSPackage {
[string]$Name = "powershell",

# Ubuntu, CentOS, Fedora, macOS, and Windows packages are supported
[ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg", "tar")]
[ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg", "tar", "tar-arm")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are comments about deb-arm right below the parameter block, please update or remove them if they are not applicable anymore.

Copy link
Member Author

@SteveL-MSFT SteveL-MSFT Nov 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove as you can only build a deb package on a R-Pi itself.

[string[]]$Type,

# Generate windows downlevel package
Expand All @@ -33,10 +33,6 @@ function Start-PSPackage {
[Switch] $SkipReleaseChecks
)

# The package type 'deb-arm' is current disabled for '-Type' parameter because 'New-UnixPackage' doesn't support
# creating package for 'deb-arm'. It should be added back to the ValidateSet of '-Type' once the implementation
# of creating 'deb-arm' package is done.

DynamicParam {
if ($Type -eq "zip") {
# Add a dynamic parameter '-IncludeSymbols' when the specified package type is 'zip'.
Expand All @@ -62,7 +58,7 @@ function Start-PSPackage {
# Runtime and Configuration settings required by the package
($Runtime, $Configuration) = if ($WindowsRuntime) {
$WindowsRuntime, "Release"
} elseif ($Type -eq "deb-arm") {
} elseif ($Type -eq "tar-arm") {
New-PSOptions -Configuration "Release" -Runtime "Linux-ARM" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
} else {
New-PSOptions -Configuration "Release" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
Expand All @@ -79,7 +75,7 @@ function Start-PSPackage {
$Script:Options = Get-PSOptions

$crossGenCorrect = $false
if ($Type -eq "deb-arm") {
if ($Type -eq "tar-arm") {
# crossgen doesn't support arm32 yet
$crossGenCorrect = $true
}
Expand Down Expand Up @@ -154,7 +150,7 @@ function Start-PSPackage {
$Source = New-TempFolder
$symbolsSource = New-TempFolder

try
try
{
# Copy files which go into the root package
Get-ChildItem -Path $publishSource | Copy-Item -Destination $Source -Recurse
Expand Down Expand Up @@ -287,12 +283,25 @@ function Start-PSPackage {
New-NugetPackage @Arguments
}
}
'tar' {
"tar" {
$Arguments = @{
PackageSourcePath = $Source
Name = $Name
Version = $Version
Force = $Force
}

if ($PSCmdlet.ShouldProcess("Create tar.gz Package")) {
New-TarballPackage @Arguments
}
}
"tar-arm" {
$Arguments = @{
PackageSourcePath = $Source
Name = $Name
Version = $Version
Force = $Force
Architecture = "arm32"
}

if ($PSCmdlet.ShouldProcess("Create tar.gz Package")) {
Expand Down Expand Up @@ -346,15 +355,18 @@ function New-TarballPackage {
# Must start with 'powershell' but may have any suffix
[Parameter(Mandatory)]
[ValidatePattern("^powershell")]
[string]$Name,
[string] $Name,

[Parameter(Mandatory)]
[string]$Version,
[string] $Version,

[Parameter()]
[string] $Architecture = "x64",

[switch] $Force
)

$packageName = "$Name-$Version-{0}-x64.tar.gz"
$packageName = "$Name-$Version-{0}-$Architecture.tar.gz"
if ($Environment.IsWindows) {
throw "Must be on Linux or macOS to build 'tar.gz' packages!"
} elseif ($Environment.IsLinux) {
Expand Down
27 changes: 15 additions & 12 deletions tools/travis.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ function Send-DailyWebHook
{
log "Sending DailyWebHook with result '$result'."
$webhook = $env:WebHookUrl

$Body = @{
'text'= @"
Build Result: $result </br>
Build Result: $result </br>
OS Type: $($PSVersionTable.OS) </br>
<a href="https://travis-ci.org/$env:TRAVIS_REPO_SLUG/builds/$env:TRAVIS_BUILD_ID">Build $env:TRAVIS_BUILD_NUMBER</a> </br>
<a href="https://travis-ci.org/$env:TRAVIS_REPO_SLUG/jobs/$env:TRAVIS_JOB_ID">Job $env:TRAVIS_JOB_NUMBER</a>
"@
}

$params = @{
Headers = @{'accept'='application/json'}
Body = $Body | convertto-json
Method = 'Post'
URI = $webhook
URI = $webhook
}

Invoke-RestMethod @params
}
else
Expand Down Expand Up @@ -126,7 +126,7 @@ function Set-DailyBuildBadge

$headers["Authorization"] = "SharedKey " + $storageAccountName + ":" + $signature

if ( $PSCmdlet.ShouldProcess("$signaturestring"))
if ( $PSCmdlet.ShouldProcess("$signaturestring"))
{
# if this fails, it will throw, you can't check the response for a success code
$response = Invoke-RestMethod -Uri $Url -Method $method -headers $headers -Body $body -ContentType "image/svg+xml"
Expand Down Expand Up @@ -174,17 +174,17 @@ elseif($Stage -eq 'Build')
$output = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions))

$originalProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
$ProgressPreference = 'SilentlyContinue'
try {
## We use CrossGen build to run tests only if it's the daily build.
Start-PSBuild -CrossGen -PSModuleRestore
}
finally{
$ProgressPreference = $originalProgressPreference
$ProgressPreference = $originalProgressPreference
}

$pesterParam = @{
'binDir' = $output
$pesterParam = @{
'binDir' = $output
'PassThru' = $true
'Terse' = $true
}
Expand Down Expand Up @@ -222,7 +222,7 @@ elseif($Stage -eq 'Build')
}

try {
Start-PSxUnit
Start-PSxUnit
}
catch {
$result = "FAIL"
Expand Down Expand Up @@ -253,8 +253,11 @@ elseif($Stage -eq 'Build')
{
log "pushing $package to $env:NUGET_URL"
Start-NativeExecution -sb {dotnet nuget push $package --api-key $env:NUGET_KEY --source "$env:NUGET_URL/api/v2/package"} -IgnoreExitcode
}
}
}
# Create and package Raspbian .tgz
Start-PSBuild -Clean -Runtime linux-arm
Start-PSPackage @packageParams -Type tar-arm -SkipReleaseChecks
}

# if the tests did not pass, throw the reason why
Expand Down