File tree Expand file tree Collapse file tree 8 files changed +53
-40
lines changed
Expand file tree Collapse file tree 8 files changed +53
-40
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,15 @@ jobs:
3232 dotnet-version : |
3333 6.0.x
3434 7.0.x
35- - name : Run setup and build script
35+ - name : Install PSResources
3636 shell : pwsh
37- run : tools/azurePipelinesBuild.ps1
37+ run : tools/installPSResources.ps1
38+ - name : Build
39+ shell : pwsh
40+ run : Invoke-Build Build
3841 - name : Run tests
3942 shell : pwsh
40- run : Invoke-Build Test -Configuration Release
43+ run : Invoke-Build Test
4144 - name : Upload test results
4245 uses : actions/upload-artifact@v3
4346 if : ${{ always() }}
Original file line number Diff line number Diff line change 4040 with :
4141 languages : ${{ matrix.language }}
4242
43+ - name : Install PSResources
44+ shell : pwsh
45+ run : tools/installPSResources.ps1
46+
4347 - name : Build
4448 shell : pwsh
45- run : tools/azurePipelinesBuild.ps1
49+ run : Invoke-Build Build
4650
4751 - name : Perform CodeQL Analysis
4852 uses : github/codeql-action/analyze@v2
Original file line number Diff line number Diff line change 2222 - name : Install dotnet
2323 uses : actions/setup-dotnet@v4
2424
25- - name : Build PSES
25+ - name : Install PSResources
2626 shell : pwsh
27- run : tools/azurePipelinesBuild.ps1
27+ run : tools/installPSResources.ps1
28+
29+ - name : Build
30+ shell : pwsh
31+ run : Invoke-Build Build
2832
2933 - name : Install Emacs
3034 uses : purcell/setup-emacs@master
Original file line number Diff line number Diff line change 2222 - name : Install dotnet
2323 uses : actions/setup-dotnet@v4
2424
25- - name : Build PSES
25+ - name : Install PSResources
2626 shell : pwsh
27- run : tools/azurePipelinesBuild.ps1
27+ run : tools/installPSResources.ps1
28+
29+ - name : Build
30+ shell : pwsh
31+ run : Invoke-Build Build
2832
2933 - name : Install Vim
3034 uses : rhysd/action-setup-vim@v1
Original file line number Diff line number Diff line change @@ -20,10 +20,18 @@ steps:
2020 version : 6.0.x
2121 performMultiLevelLookup : true
2222
23+ - task : PowerShell@2
24+ displayName : Install PSResources
25+ inputs :
26+ pwsh : true
27+ filePath : tools/installPSResources.ps1
28+
2329- task : PowerShell@2
2430 displayName : Build
2531 inputs :
26- filePath : tools/azurePipelinesBuild.ps1
32+ targetType : inline
33+ pwsh : true
34+ script : Invoke-Build Build -Configuration Release
2735
2836- task : PowerShell@2
2937 displayName : Test
Original file line number Diff line number Diff line change @@ -311,13 +311,6 @@ task RestorePsesModules -After Build {
311311 $moduleInfos.Add ($name , $body )
312312 }
313313
314- if ($moduleInfos.Keys.Count -gt 0 ) {
315- # `#Requires` doesn't display the version needed in the error message and `using module` doesn't work with InvokeBuild in Windows PowerShell
316- # so we'll just use Import-Module to check that PowerShellGet 1.6.0 or higher is installed.
317- # This is needed in order to use the `-AllowPrerelease` parameter
318- Import-Module - Name PowerShellGet - MinimumVersion 1.6 .0 - ErrorAction Stop
319- }
320-
321314 # Save each module in the modules.json file
322315 foreach ($moduleName in $moduleInfos.Keys ) {
323316 if (Test-Path - Path (Join-Path - Path $submodulePath - ChildPath $moduleName )) {
@@ -330,11 +323,15 @@ task RestorePsesModules -After Build {
330323 $splatParameters = @ {
331324 Name = $moduleName
332325 RequiredVersion = $moduleInstallDetails.Version
333- AllowPrerelease = $moduleInstallDetails.AllowPrerelease
334326 Repository = if ($moduleInstallDetails.Repository ) { $moduleInstallDetails.Repository } else { $DefaultModuleRepository }
335327 Path = $submodulePath
336328 }
337329
330+ # There's a bug in PowerShell get where this argument isn't correctly translated when it's false.
331+ if ($moduleInstallDetails.AllowPrerelease ) {
332+ $splatParameters [" AllowPrerelease" ] = $moduleInstallDetails.AllowPrerelease
333+ }
334+
338335 Write-Host " `t Installing module: ${moduleName} with arguments $ ( ConvertTo-Json $splatParameters ) "
339336
340337 Save-Module @splatParameters
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ # Copyright (c) Microsoft Corporation.
2+ # Licensed under the MIT License.
3+
4+ $ErrorActionPreference = ' Stop'
5+
6+ Set-PSRepository - Name PSGallery - InstallationPolicy Trusted | Out-Null
7+ if ($PSVersionTable.PSVersion.Major -lt 6 ) {
8+ throw " The build script requires PowerShell 7!"
9+ }
10+
11+ # TODO: Switch to Install-PSResource when CI uses PowerShell 7.4
12+ Install-Module - Name InvokeBuild - Scope CurrentUser
13+ Install-Module - Name platyPS - Scope CurrentUser
14+
15+ # Update help needed for tests.
16+ Update-Help - Module Microsoft.PowerShell*
You can’t perform that action at this time.
0 commit comments