diff --git a/.pipelines/PowerShellEditorServices-Official.yml b/.pipelines/PowerShellEditorServices-Official.yml deleted file mode 100644 index 02711b556..000000000 --- a/.pipelines/PowerShellEditorServices-Official.yml +++ /dev/null @@ -1,170 +0,0 @@ -################################################################################# -# OneBranch Pipelines # -# This pipeline was created by EasyStart from a sample located at: # -# https://aka.ms/obpipelines/easystart/samples # -# Documentation: https://aka.ms/obpipelines # -# Yaml Schema: https://aka.ms/obpipelines/yaml/schema # -# Retail Tasks: https://aka.ms/obpipelines/tasks # -# Support: https://aka.ms/onebranchsup # -################################################################################# - -trigger: -- main - -schedules: -- cron: '35 13 * * 4' - displayName: Weekly CodeQL - branches: - include: - - main - always: true - -parameters: -- name: debug - displayName: Enable debug output - type: boolean - default: false - -variables: - system.debug: ${{ parameters.debug }} - BuildConfiguration: Release - WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest - DOTNET_NOLOGO: true - DOTNET_GENERATE_ASPNET_CERTIFICATE: false - -resources: - repositories: - - repository: templates - type: git - name: OneBranch.Pipelines/GovernedTemplates - ref: refs/heads/main - -extends: - # https://aka.ms/obpipelines/templates - template: v2/OneBranch.Official.CrossPlat.yml@templates - parameters: - globalSdl: # https://aka.ms/obpipelines/sdl - asyncSdl: - enabled: true - forStages: [build] - featureFlags: - EnableCDPxPAT: false - WindowsHostVersion: - Version: 2022 - Network: KS3 - release: - category: NonAzure - stages: - - stage: build - jobs: - - job: main - displayName: Build package - pool: - type: windows - variables: - ob_outputDirectory: $(Build.SourcesDirectory)/out - steps: - - pwsh: | - [xml]$xml = Get-Content PowerShellEditorServices.Common.props - $version = $xml.Project.PropertyGroup.VersionPrefix - $prerelease = $xml.Project.PropertyGroup.VersionSuffix - if ($prerelease) { $version += "-$prerelease" } - Write-Output "##vso[task.setvariable variable=version;isOutput=true]$version" - Write-Output "##vso[task.setvariable variable=prerelease;isOutput=true]$(-not [string]::IsNullOrEmpty($prerelease))" - name: package - displayName: Get version from project properties - - task: onebranch.pipeline.version@1 - displayName: Set OneBranch version - inputs: - system: Custom - customVersion: $(package.version) - - task: UseDotNet@2 - displayName: Use .NET 8.x SDK - inputs: - packageType: sdk - useGlobalJson: true - - task: UseDotNet@2 - displayName: Use .NET 6.x runtime (for tests) - inputs: - packageType: runtime - version: 6.x - - pwsh: ./tools/installPSResources.ps1 -PSRepository CFS - displayName: Install PSResources - - pwsh: Invoke-Build TestFull -Configuration $(BuildConfiguration) -PSRepository CFS - displayName: Build and test - - task: PublishTestResults@2 - displayName: Publish test results - inputs: - testRunner: VSTest - testResultsFiles: '**/*.trx' - failTaskOnFailedTests: true - - pwsh: | - $assembly = [Reflection.Assembly]::LoadFile("$(Build.SourcesDirectory)/module/PowerShellEditorServices/bin/Core/Microsoft.PowerShell.EditorServices.Hosting.dll") - if ($assembly.GetCustomAttributes([System.Diagnostics.DebuggableAttribute], $true).IsJITOptimizerDisabled) { - Write-Host "##vso[task.LogIssue type=error;]Was not built in release configuration!" - exit 1 - } - displayName: Assert release configuration - continueOnError: true - - task: onebranch.pipeline.signing@1 - displayName: Sign 1st-party files - inputs: - command: sign - signing_profile: external_distribution - search_root: $(Build.SourcesDirectory)/module - files_to_sign: | - **/*.ps1; - **/*.psd1; - **/*.psm1; - **/*.ps1xml; - **/Microsoft.PowerShell.EditorServices*.dll; - - task: onebranch.pipeline.signing@1 - displayName: Sign 3rd-party files - inputs: - command: sign - signing_profile: 135020002 - search_root: $(Build.SourcesDirectory)/module - files_to_sign: | - **/MediatR.dll; - **/Nerdbank.Streams.dll; - **/Newtonsoft.Json.dll; - **/OmniSharp.Extensions*.dll; - **/System.Reactive.dll; - - task: ArchiveFiles@2 - displayName: Zip signed artifacts - inputs: - rootFolderOrFile: $(Build.SourcesDirectory)/module - includeRootFolder: false - archiveType: zip - archiveFile: out/PowerShellEditorServices.zip - - stage: release - dependsOn: build - condition: eq(variables['Build.Reason'], 'Manual') - variables: - ob_release_environment: Production - version: $[ stageDependencies.build.main.outputs['package.version'] ] - prerelease: $[ stageDependencies.build.main.outputs['package.prerelease'] ] - jobs: - - job: github - displayName: Publish draft to GitHub - pool: - type: release - templateContext: - inputs: - - input: pipelineArtifact - artifactName: drop_build_main - steps: - - task: GitHubRelease@1 - displayName: Create GitHub release - inputs: - gitHubConnection: GitHub - repositoryName: PowerShell/PowerShellEditorServices - target: main - assets: $(Pipeline.Workspace)/PowerShellEditorServices.zip - tagSource: userSpecifiedTag - tag: v$(version) - isDraft: true - isPreRelease: $(prerelease) - addChangeLog: false - releaseNotesSource: inline - releaseNotesInline: "" diff --git a/.pipelines/PowerShellEditorServices-OneBranch.yml b/.pipelines/PowerShellEditorServices-OneBranch.yml new file mode 100644 index 000000000..a10cc28d5 --- /dev/null +++ b/.pipelines/PowerShellEditorServices-OneBranch.yml @@ -0,0 +1,162 @@ +################################################################################# +# OneBranch Pipelines # +# This pipeline was created by EasyStart from a sample located at: # +# https://aka.ms/obpipelines/easystart/samples # +# Documentation: https://aka.ms/obpipelines # +# Yaml Schema: https://aka.ms/obpipelines/yaml/schema # +# Retail Tasks: https://aka.ms/obpipelines/tasks # +# Support: https://aka.ms/onebranchsup # +################################################################################# + +trigger: + - main + +resources: + repositories: + - repository: templates + type: git + name: OneBranch.Pipelines/GovernedTemplates + ref: refs/heads/main + +parameters: + - name: debug + displayName: Enable debug output + type: boolean + default: false + - name: OfficialBuild + displayName: Use Official OneBranch template + type: boolean + default: false + +variables: + system.debug: ${{ parameters.debug }} + BuildConfiguration: Release + WindowsContainerImage: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest + DOTNET_NOLOGO: true + DOTNET_GENERATE_ASPNET_CERTIFICATE: false + OneBranchTemplate: ${{ iif(parameters.OfficialBuild, 'v2/OneBranch.Official.CrossPlat.yml@templates', 'v2/OneBranch.NonOfficial.CrossPlat.yml@templates') }} + +extends: + # https://aka.ms/obpipelines/templates + template: ${{ variables.OneBranchTemplate }} + parameters: + globalSdl: # https://aka.ms/obpipelines/sdl + asyncSdl: + enabled: true + forStages: [build] + featureFlags: + EnableCDPxPAT: false + WindowsHostVersion: + Version: 2022 + Network: KS3 + release: + category: NonAzure + stages: + - stage: build + jobs: + - job: main + displayName: Build package + pool: + type: windows + variables: + ob_outputDirectory: $(Build.SourcesDirectory)/out + steps: + - pwsh: | + [xml]$xml = Get-Content PowerShellEditorServices.Common.props + $version = $xml.Project.PropertyGroup.VersionPrefix + $prerelease = $xml.Project.PropertyGroup.VersionSuffix + if ($prerelease) { $version += "-$prerelease" } + Write-Output "##vso[task.setvariable variable=version;isOutput=true]$version" + Write-Output "##vso[task.setvariable variable=prerelease;isOutput=true]$(-not [string]::IsNullOrEmpty($prerelease))" + name: package + displayName: Get version from project properties + - task: onebranch.pipeline.version@1 + displayName: Set OneBranch version + inputs: + system: Custom + customVersion: $(package.version) + - task: UseDotNet@2 + displayName: Use .NET 8.x SDK + inputs: + packageType: sdk + useGlobalJson: true + - pwsh: ./tools/installPSResources.ps1 -PSRepository CFS + displayName: Install PSResources + - pwsh: Invoke-Build TestFull -Configuration $(BuildConfiguration) -PSRepository CFS + displayName: Build and test + - task: PublishTestResults@2 + displayName: Publish test results + inputs: + testRunner: VSTest + testResultsFiles: "**/*.trx" + failTaskOnFailedTests: true + - pwsh: | + $assembly = [Reflection.Assembly]::LoadFile("$(Build.SourcesDirectory)/module/PowerShellEditorServices/bin/Core/Microsoft.PowerShell.EditorServices.Hosting.dll") + if ($assembly.GetCustomAttributes([System.Diagnostics.DebuggableAttribute], $true).IsJITOptimizerDisabled) { + Write-Host "##vso[task.LogIssue type=error;]Was not built in release configuration!" + exit 1 + } + displayName: Assert release configuration + continueOnError: true + - task: onebranch.pipeline.signing@1 + displayName: Sign 1st-party files + inputs: + command: sign + signing_profile: external_distribution + search_root: $(Build.SourcesDirectory)/module + files_to_sign: | + **/*.ps1; + **/*.psd1; + **/*.psm1; + **/*.ps1xml; + **/Microsoft.PowerShell.EditorServices*.dll; + - task: onebranch.pipeline.signing@1 + displayName: Sign 3rd-party files + inputs: + command: sign + signing_profile: 135020002 + search_root: $(Build.SourcesDirectory)/module + files_to_sign: | + **/MediatR.dll; + **/Nerdbank.Streams.dll; + **/Newtonsoft.Json.dll; + **/OmniSharp.Extensions*.dll; + **/System.Reactive.dll; + - task: ArchiveFiles@2 + displayName: Zip signed artifacts + inputs: + rootFolderOrFile: $(Build.SourcesDirectory)/module + includeRootFolder: false + archiveType: zip + archiveFile: out/PowerShellEditorServices.zip + - stage: release + dependsOn: build + condition: and(succeeded(), ${{ eq(parameters.OfficialBuild, true) }}) + variables: + ob_release_environment: ${{ iif(parameters.OfficialBuild, 'Production', 'Test') }} + version: $[ stageDependencies.build.main.outputs['package.version'] ] + prerelease: $[ stageDependencies.build.main.outputs['package.prerelease'] ] + jobs: + - job: github + displayName: Publish draft to GitHub + pool: + type: release + templateContext: + inputs: + - input: pipelineArtifact + artifactName: drop_build_main + steps: + - task: GitHubRelease@1 + displayName: Create GitHub release + inputs: + gitHubConnection: github.com_andyleejordan + repositoryName: PowerShell/PowerShellEditorServices + target: main + assets: $(Pipeline.Workspace)/PowerShellEditorServices.zip + tagSource: userSpecifiedTag + tag: v$(version) + isDraft: true + isPreRelease: $(prerelease) + addChangeLog: false + releaseNotesSource: inline + releaseNotesInline: "" diff --git a/Directory.Packages.props b/Directory.Packages.props index b90360e52..712512a3f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,27 +1,27 @@ - - - - + + + + - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index 79aabb815..14b80acce 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -122,7 +122,7 @@ task RestorePsesModules -If (-not (Test-Path "module/PSReadLine") -or -not (Test Write-Build DarkMagenta "Restoring bundled modules" # NOTE: When updating module versions, ensure they are also saved to the CFS feed Save-PSResource -Path module -Name PSScriptAnalyzer -Version "1.24.0" -Repository $PSRepository -TrustRepository -Verbose - Save-PSResource -Path module -Name PSReadLine -Version "2.4.2-beta2" -Prerelease -Repository $PSRepository -TrustRepository -Verbose + Save-PSResource -Path module -Name PSReadLine -Version "2.4.4-beta4" -Prerelease -Repository $PSRepository -TrustRepository -Verbose } Task Build FindDotNet, CreateBuildInfo, RestorePsesModules, { diff --git a/tools/installPSResources.ps1 b/tools/installPSResources.ps1 index 3bb642ace..694798812 100644 --- a/tools/installPSResources.ps1 +++ b/tools/installPSResources.ps1 @@ -12,11 +12,11 @@ if ($PSRepository -eq "CFS" -and -not (Get-PSResourceRepository -Name CFS -Error # NOTE: Due to a bug in Install-PSResource with upstream feeds, we have to # request an exact version. Otherwise, if a newer version is available in the # upstream feed, it will fail to install any version at all. -Install-PSResource -Verbose -TrustRepository -RequiredResource @{ +Install-PSResource -Verbose -TrustRepository -RequiredResource @{ InvokeBuild = @{ - version = "5.12.1" + version = "5.14.18" repository = $PSRepository - } + } platyPS = @{ version = "0.14.2" repository = $PSRepository