File tree 8 files changed +53
-40
lines changed
8 files changed +53
-40
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,15 @@ jobs:
32
32
dotnet-version : |
33
33
6.0.x
34
34
7.0.x
35
- - name : Run setup and build script
35
+ - name : Install PSResources
36
36
shell : pwsh
37
- run : tools/azurePipelinesBuild.ps1
37
+ run : tools/installPSResources.ps1
38
+ - name : Build
39
+ shell : pwsh
40
+ run : Invoke-Build Build
38
41
- name : Run tests
39
42
shell : pwsh
40
- run : Invoke-Build Test -Configuration Release
43
+ run : Invoke-Build Test
41
44
- name : Upload test results
42
45
uses : actions/upload-artifact@v3
43
46
if : ${{ always() }}
Original file line number Diff line number Diff line change 40
40
with :
41
41
languages : ${{ matrix.language }}
42
42
43
+ - name : Install PSResources
44
+ shell : pwsh
45
+ run : tools/installPSResources.ps1
46
+
43
47
- name : Build
44
48
shell : pwsh
45
- run : tools/azurePipelinesBuild.ps1
49
+ run : Invoke-Build Build
46
50
47
51
- name : Perform CodeQL Analysis
48
52
uses : github/codeql-action/analyze@v2
Original file line number Diff line number Diff line change 22
22
- name : Install dotnet
23
23
uses : actions/setup-dotnet@v4
24
24
25
- - name : Build PSES
25
+ - name : Install PSResources
26
26
shell : pwsh
27
- run : tools/azurePipelinesBuild.ps1
27
+ run : tools/installPSResources.ps1
28
+
29
+ - name : Build
30
+ shell : pwsh
31
+ run : Invoke-Build Build
28
32
29
33
- name : Install Emacs
30
34
uses : purcell/setup-emacs@master
Original file line number Diff line number Diff line change 22
22
- name : Install dotnet
23
23
uses : actions/setup-dotnet@v4
24
24
25
- - name : Build PSES
25
+ - name : Install PSResources
26
26
shell : pwsh
27
- run : tools/azurePipelinesBuild.ps1
27
+ run : tools/installPSResources.ps1
28
+
29
+ - name : Build
30
+ shell : pwsh
31
+ run : Invoke-Build Build
28
32
29
33
- name : Install Vim
30
34
uses : rhysd/action-setup-vim@v1
Original file line number Diff line number Diff line change @@ -20,10 +20,18 @@ steps:
20
20
version : 6.0.x
21
21
performMultiLevelLookup : true
22
22
23
+ - task : PowerShell@2
24
+ displayName : Install PSResources
25
+ inputs :
26
+ pwsh : true
27
+ filePath : tools/installPSResources.ps1
28
+
23
29
- task : PowerShell@2
24
30
displayName : Build
25
31
inputs :
26
- filePath : tools/azurePipelinesBuild.ps1
32
+ targetType : inline
33
+ pwsh : true
34
+ script : Invoke-Build Build -Configuration Release
27
35
28
36
- task : PowerShell@2
29
37
displayName : Test
Original file line number Diff line number Diff line change @@ -311,13 +311,6 @@ task RestorePsesModules -After Build {
311
311
$moduleInfos.Add ($name , $body )
312
312
}
313
313
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
-
321
314
# Save each module in the modules.json file
322
315
foreach ($moduleName in $moduleInfos.Keys ) {
323
316
if (Test-Path - Path (Join-Path - Path $submodulePath - ChildPath $moduleName )) {
@@ -330,11 +323,15 @@ task RestorePsesModules -After Build {
330
323
$splatParameters = @ {
331
324
Name = $moduleName
332
325
RequiredVersion = $moduleInstallDetails.Version
333
- AllowPrerelease = $moduleInstallDetails.AllowPrerelease
334
326
Repository = if ($moduleInstallDetails.Repository ) { $moduleInstallDetails.Repository } else { $DefaultModuleRepository }
335
327
Path = $submodulePath
336
328
}
337
329
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
+
338
335
Write-Host " `t Installing module: ${moduleName} with arguments $ ( ConvertTo-Json $splatParameters ) "
339
336
340
337
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