mirror of
https://github.com/PowerShell/PowerShell.git
synced 2024-11-23 17:53:58 +08:00
Skip JumpList
on NanoServer
and IoT
(#10164)
This commit is contained in:
parent
5ef258ef68
commit
a4e397697c
61
.vsts-ci/templates/nanoserver.yml
Normal file
61
.vsts-ci/templates/nanoserver.yml
Normal file
@ -0,0 +1,61 @@
|
||||
parameters:
|
||||
vmImage: 'win1803'
|
||||
jobName: 'Nanoserver_Tests'
|
||||
continueOnError: false
|
||||
|
||||
jobs:
|
||||
|
||||
- job: ${{ parameters.jobName }}
|
||||
variables:
|
||||
scriptName: ${{ parameters.scriptName }}
|
||||
|
||||
pool:
|
||||
vmImage: ${{ parameters.vmImage }}
|
||||
|
||||
displayName: ${{ parameters.jobName }}
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
set
|
||||
displayName: Capture environment
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download build artifacts'
|
||||
inputs:
|
||||
downloadType: specific
|
||||
itemPattern: |
|
||||
build/**/*
|
||||
downloadPath: '$(System.ArtifactsDirectory)'
|
||||
|
||||
- pwsh: |
|
||||
Get-ChildItem "$(System.ArtifactsDirectory)\*" -Recurse
|
||||
displayName: 'Capture artifacts directory'
|
||||
continueOnError: true
|
||||
|
||||
- pwsh: |
|
||||
Install-module pester -Scope CurrentUser -Force
|
||||
displayName: 'Install Pester'
|
||||
continueOnError: true
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
$options = (Get-PSOptions)
|
||||
$path = split-path -path $options.Output
|
||||
Write-Verbose "Path: '$path'" -Verbose
|
||||
$rootPath = split-Path -path $path
|
||||
Expand-Archive -Path '$(System.ArtifactsDirectory)\build\build.zip' -DestinationPath $rootPath -Force
|
||||
Invoke-Pester -Path ./test/nanoserver -OutputFormat NUnitXml -OutputFile ./test-nanoserver.xml
|
||||
displayName: Test
|
||||
condition: succeeded()
|
||||
|
||||
- task: PublishTestResults@2
|
||||
condition: succeededOrFailed()
|
||||
displayName: Publish Nanoserver Test Results **\test*.xml
|
||||
inputs:
|
||||
testRunner: NUnit
|
||||
testResultsFiles: '**\test*.xml'
|
||||
testRunTitle: nanoserver
|
||||
mergeTestResults: true
|
||||
failTaskOnFailedTests: true
|
@ -73,6 +73,8 @@ stages:
|
||||
parameters:
|
||||
pool: 'Hosted VS2017'
|
||||
|
||||
- template: templates/nanoserver.yml
|
||||
|
||||
- stage: PackagingWin
|
||||
displayName: Packaging for Windows
|
||||
dependsOn: [] # by specifying an empty array, this stage doesn't depend on the stage before it
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Management.Automation;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
@ -20,6 +21,13 @@ namespace Microsoft.PowerShell
|
||||
// not over-optimize this and always create the JumpList as a non-blocking background STA thread instead.
|
||||
internal static void CreateRunAsAdministratorJumpList()
|
||||
{
|
||||
// The STA apartment state is not supported on NanoServer and Windows IoT.
|
||||
// Plus, there is not need to create jump list in those environment anyways.
|
||||
if (Platform.IsNanoServer || Platform.IsIoT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Some COM APIs are implicitly STA only, therefore the executing thread must run in STA.
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
|
15
test/nanoserver/nanoserver.tests.ps1
Normal file
15
test/nanoserver/nanoserver.tests.ps1
Normal file
@ -0,0 +1,15 @@
|
||||
Describe "Verify PowerShell Runs" {
|
||||
BeforeAll{
|
||||
$options = (Get-PSOptions)
|
||||
$path = split-path -path $options.Output
|
||||
Write-Verbose "Path: '$path'" -Verbose
|
||||
$rootPath = split-Path -path $path
|
||||
$mount = 'C:\powershell'
|
||||
$container = 'mcr.microsoft.com/powershell:nanoserver-1803'
|
||||
}
|
||||
|
||||
it "Verify Version " {
|
||||
$version = docker run --rm -v "${rootPath}:${mount}" ${container} "${mount}\publish\pwsh" -NoLogo -NoProfile -Command '$PSVersionTable.PSVersion.ToString()'
|
||||
$version | Should -match '^7\.'
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user