Skip to content

Commit dd2b589

Browse files
committed
Split build and test CI so PowerShell Core can be used for the former
Since it's required in order to use our version tools.
1 parent eb1540b commit dd2b589

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

.vsts-ci/templates/ci-general.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,29 @@ steps:
6262
version: 6.0.x
6363
performMultiLevelLookup: true
6464

65+
# The build script is always run with PowerShell Core
6566
- task: PowerShell@2
66-
displayName: Build and test
67+
displayName: Build Package
6768
inputs:
6869
targetType: inline
6970
script: |
7071
Get-ChildItem env:
7172
Get-Module -ListAvailable Pester
7273
Install-Module InvokeBuild -Scope CurrentUser -Force
7374
Install-Module platyPS -Scope CurrentUser -Force
74-
Invoke-Build -Configuration Release
75+
Invoke-Build -Configuration Release Package
7576
$PackageJson = Get-Content -Raw package.json | ConvertFrom-Json
7677
Write-Host "##vso[task.setvariable variable=vsixPath]$(Resolve-Path powershell-$($PackageJson.version).vsix)"
7778
workingDirectory: $(Build.SourcesDirectory)/vscode-powershell
79+
80+
# Tests in particular are run with either PowerShell Core or Windows PowerShell
81+
- task: PowerShell@2
82+
displayName: Test
83+
inputs:
84+
targetType: inline
85+
script: |
86+
Invoke-Build -Configuration Release Test
87+
workingDirectory: $(Build.SourcesDirectory)/vscode-powershell
7888
pwsh: ${{ parameters.pwsh }}
7989

8090
- task: PowerShell@2
@@ -87,7 +97,6 @@ steps:
8797
Write-Host '##vso[task.LogIssue type=error;]PowerShell Editor Services bits were not built in release configuration!'
8898
exit 1
8999
}
90-
pwsh: ${{ parameters.pwsh }}
91100
92101
- publish: $(vsixPath)
93102
artifact: vscode-powershell-vsix-$(System.JobId)

vscode-powershell.build.ps1

+8-9
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ param(
99

1010
#Requires -Modules @{ ModuleName = "InvokeBuild"; ModuleVersion = "3.0.0" }
1111

12-
# Sanity check our changelog version versus package.json (which lacks pre-release label)
13-
Import-Module $PSScriptRoot/tools/VersionTools.psm1
14-
$script:Version = Get-Version -RepositoryName vscode-powershell
15-
$script:PackageVersion = Get-MajorMinorPatch -Version $Version
16-
$script:PackageJson = Get-Content -Raw $PSScriptRoot/package.json | ConvertFrom-Json
17-
Assert-Build ($script:PackageJson.version -eq $script:PackageVersion)
18-
Write-Host "`n### Building Extension Version: $script:Version`n" -ForegroundColor Green
19-
2012
function Get-EditorServicesPath {
2113
$psesRepoPath = if ($EditorServicesRepoPath) {
2214
$EditorServicesRepoPath
@@ -133,7 +125,14 @@ task TestEditorServices -If (Get-EditorServicesPath) {
133125
#region Package tasks
134126

135127
task Package Build, {
136-
Write-Host "`n### Packaging powershell-$script:PackageVersion.vsix`n" -ForegroundColor Green
128+
# Sanity check our changelog version versus package.json (which lacks pre-release label)
129+
Import-Module $PSScriptRoot/tools/VersionTools.psm1
130+
$version = Get-Version -RepositoryName vscode-powershell
131+
$packageVersion = Get-MajorMinorPatch -Version $version
132+
$packageJson = Get-Content -Raw $PSScriptRoot/package.json | ConvertFrom-Json
133+
Assert-Build ($packageJson.version -eq $packageVersion)
134+
135+
Write-Host "`n### Packaging powershell-$packageVersion.vsix`n" -ForegroundColor Green
137136
Assert-Build ((Get-Item ./modules).LinkType -ne "SymbolicLink") "Packaging requires a copy of PSES, not a symlink!"
138137
if (Test-IsPreRelease) {
139138
Write-Host "`n### This is a pre-release!`n" -ForegroundColor Green

0 commit comments

Comments
 (0)