mirror of
https://github.com/PowerShell/PowerShell
synced 2025-10-06 00:22:59 +02:00
Add UseDotnet task for installing dotnet (#24905)
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
174df290e5
commit
0cf23a841a
@@ -27,7 +27,7 @@ runs:
|
||||
- name: Bootstrap
|
||||
run: |-
|
||||
Import-Module ./build.psm1
|
||||
Start-PSBootstrap -Package
|
||||
Start-PSBootstrap -Scenario Package
|
||||
shell: pwsh
|
||||
- name: Capture Artifacts Directory
|
||||
continue-on-error: true
|
||||
|
5
.github/actions/test/windows/action.yml
vendored
5
.github/actions/test/windows/action.yml
vendored
@@ -31,6 +31,10 @@ runs:
|
||||
run: Get-ChildItem "${{ github.workspace }}\build\*" -Recurse
|
||||
shell: pwsh
|
||||
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
global-json-file: .\global.json
|
||||
|
||||
- name: Bootstrap
|
||||
shell: powershell
|
||||
run: |-
|
||||
@@ -50,7 +54,6 @@ runs:
|
||||
if: success()
|
||||
run: |-
|
||||
Import-Module .\build.psm1 -force
|
||||
Start-PSBootstrap
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '${{ github.workspace }}\build\psoptions.json'
|
||||
$options = (Get-PSOptions)
|
||||
|
5
.github/workflows/linux-ci.yml
vendored
5
.github/workflows/linux-ci.yml
vendored
@@ -74,6 +74,7 @@ jobs:
|
||||
uses: actions/checkout@v4.1.0
|
||||
with:
|
||||
fetch-depth: 1000
|
||||
|
||||
- name: Build
|
||||
uses: "./.github/actions/build/ci"
|
||||
linux_test_unelevated_ci:
|
||||
@@ -184,6 +185,10 @@ jobs:
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
global-json-file: ./global.json
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
|
||||
|
2
.github/workflows/macos-ci.yml
vendored
2
.github/workflows/macos-ci.yml
vendored
@@ -171,7 +171,7 @@ jobs:
|
||||
if: success() || failure()
|
||||
run: |-
|
||||
import-module ./build.psm1
|
||||
start-psbootstrap -package
|
||||
start-psbootstrap -Scenario package
|
||||
shell: pwsh
|
||||
ready_to_merge:
|
||||
name: macos ready to merge
|
||||
|
@@ -61,14 +61,12 @@ jobs:
|
||||
parameters:
|
||||
repoRoot: '$(repoRoot)'
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1 -force
|
||||
Start-PSBootstrap
|
||||
workingDirectory: '$(repoRoot)'
|
||||
retryCountOnTaskFailure: 2
|
||||
displayName: 'Bootstrap'
|
||||
env:
|
||||
__DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY)
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
workingDirectory: $(Build.SourcesDirectory)"
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1 -force
|
||||
|
@@ -103,7 +103,7 @@ jobs:
|
||||
Import-Module "$repoRoot/build.psm1"
|
||||
Import-Module "$repoRoot/tools/packaging"
|
||||
|
||||
Start-PSBootstrap -Package
|
||||
Start-PSBootstrap -Scenario Package
|
||||
|
||||
$psOptionsPath = "$(Pipeline.Workspace)/CoOrdinatedBuildPipeline/${unsignedDrop}/psoptions/psoptions.json"
|
||||
|
||||
|
@@ -64,6 +64,13 @@ jobs:
|
||||
AnalyzeInPipeline: false
|
||||
Language: csharp
|
||||
|
||||
- task: UseDotNet@2
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
workingDirectory: $(PowerShellRoot)
|
||||
env:
|
||||
ob_restore_phase: true
|
||||
|
||||
- pwsh: |
|
||||
$runtime = $env:RUNTIME
|
||||
|
||||
@@ -77,7 +84,6 @@ jobs:
|
||||
Import-Module -Name $(PowerShellRoot)/build.psm1 -Force
|
||||
$buildWithSymbolsPath = New-Item -ItemType Directory -Path $(Pipeline.Workspace)/Symbols_$(Runtime) -Force
|
||||
|
||||
Start-PSBootstrap
|
||||
$null = New-Item -ItemType Directory -Path $buildWithSymbolsPath -Force -Verbose
|
||||
|
||||
$ReleaseTagParam = @{}
|
||||
|
@@ -110,7 +110,7 @@ jobs:
|
||||
Write-Verbose -Message "LTS Release: $LTS"
|
||||
}
|
||||
|
||||
Start-PSBootstrap -Package
|
||||
Start-PSBootstrap -Scenario Package
|
||||
|
||||
$macosRuntime = "osx-$buildArch"
|
||||
|
||||
|
@@ -39,9 +39,16 @@ jobs:
|
||||
sudo chown $env:USER "$(Agent.TempDirectory)/PowerShell"
|
||||
displayName: 'Create $(Agent.TempDirectory)/PowerShell'
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
workingDirectory: $(PowerShellRoot)
|
||||
|
||||
- pwsh: |
|
||||
Import-Module $(PowerShellRoot)/build.psm1 -Force
|
||||
Start-PSBootstrap -Package
|
||||
Start-PSBootstrap -Scenario Package
|
||||
displayName: 'Bootstrap VM'
|
||||
env:
|
||||
__DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY)
|
||||
|
@@ -97,12 +97,17 @@ jobs:
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: 'Install NuGet.exe'
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
workingDirectory: '$(PowerShellRoot)'
|
||||
|
||||
- pwsh: |
|
||||
Set-Location -Path '$(PowerShellRoot)'
|
||||
Import-Module "$(PowerShellRoot)/build.psm1" -Force
|
||||
|
||||
Start-PSBootstrap -Verbose
|
||||
|
||||
$sharedModules = @('Microsoft.PowerShell.Commands.Management',
|
||||
'Microsoft.PowerShell.Commands.Utility',
|
||||
'Microsoft.PowerShell.ConsoleHost',
|
||||
|
@@ -61,38 +61,12 @@ jobs:
|
||||
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/$artifactName" -Recurse
|
||||
displayName: 'Capture Downloaded Artifacts'
|
||||
|
||||
- pwsh: |
|
||||
$repoRoot = "$(Build.SourcesDirectory)/PowerShell"
|
||||
$dotnetMetadataPath = "$repoRoot/DotnetRuntimeMetadata.json"
|
||||
$dotnetMetadataJson = Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json
|
||||
|
||||
# Channel is like: $Channel = "5.0.1xx-preview2"
|
||||
$Channel = $dotnetMetadataJson.sdk.channel
|
||||
|
||||
$sdkVersion = (Get-Content "$repoRoot/global.json" -Raw | ConvertFrom-Json).sdk.version
|
||||
Import-Module "$repoRoot/build.psm1" -Force
|
||||
|
||||
Find-Dotnet
|
||||
|
||||
if(-not (Get-PackageSource -Name 'dotnet' -ErrorAction SilentlyContinue))
|
||||
{
|
||||
$nugetFeed = ([xml](Get-Content $repoRoot/nuget.config -Raw)).Configuration.packagesources.add | Where-Object { $_.Key -eq 'dotnet' } | Select-Object -ExpandProperty Value
|
||||
if ($nugetFeed) {
|
||||
Register-PackageSource -Name 'dotnet' -Location $nugetFeed -ProviderName NuGet
|
||||
Write-Verbose -Message "Register new package source 'dotnet'" -verbose
|
||||
}
|
||||
}
|
||||
|
||||
## Install latest version from the channel
|
||||
|
||||
#Install-Dotnet -Channel "$Channel" -Version $sdkVersion
|
||||
Start-PSBootstrap
|
||||
|
||||
Write-Verbose -Message "Installing .NET SDK completed." -Verbose
|
||||
|
||||
displayName: Install .NET
|
||||
env:
|
||||
__DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY)
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
|
||||
|
||||
- pwsh: |
|
||||
$artifactName = '$(artifactName)'
|
||||
|
@@ -38,44 +38,15 @@ jobs:
|
||||
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/drop_nupkg_build_nupkg" -Recurse
|
||||
displayName: 'Capture Downloaded Artifacts'
|
||||
|
||||
- pwsh: |
|
||||
$repoRoot = "$(Build.SourcesDirectory)/PowerShell"
|
||||
$dotnetMetadataPath = "$repoRoot/DotnetRuntimeMetadata.json"
|
||||
$dotnetMetadataJson = Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json
|
||||
|
||||
# Channel is like: $Channel = "5.0.1xx-preview2"
|
||||
$Channel = $dotnetMetadataJson.sdk.channel
|
||||
|
||||
$sdkVersion = (Get-Content "$repoRoot/global.json" -Raw | ConvertFrom-Json).sdk.version
|
||||
Import-Module "$repoRoot/build.psm1" -Force
|
||||
|
||||
Find-Dotnet
|
||||
|
||||
if(-not (Get-PackageSource -Name 'dotnet' -ErrorAction SilentlyContinue))
|
||||
{
|
||||
$nugetFeed = ([xml](Get-Content $repoRoot/nuget.config -Raw)).Configuration.packagesources.add | Where-Object { $_.Key -eq 'dotnet' } | Select-Object -ExpandProperty Value
|
||||
if ($nugetFeed) {
|
||||
Register-PackageSource -Name 'dotnet' -Location $nugetFeed -ProviderName NuGet
|
||||
Write-Verbose -Message "Register new package source 'dotnet'" -verbose
|
||||
}
|
||||
}
|
||||
|
||||
## Install latest version from the channel
|
||||
|
||||
#Install-Dotnet -Channel "$Channel" -Version $sdkVersion
|
||||
Start-PSBootstrap
|
||||
|
||||
Write-Verbose -Message "Installing .NET SDK completed." -Verbose
|
||||
|
||||
displayName: Install .NET
|
||||
env:
|
||||
__DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY)
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
workingDirectory: $(REPOROOT)
|
||||
|
||||
- pwsh: |
|
||||
$repoRoot = "$(Build.SourcesDirectory)/PowerShell"
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
Import-Module "$repoRoot/build.psm1" -Force
|
||||
Start-PSBootstrap
|
||||
|
||||
$toolPath = New-Item -ItemType Directory "$(System.DefaultWorkingDirectory)/toolPath" | Select-Object -ExpandProperty FullName
|
||||
|
||||
@@ -108,8 +79,6 @@ jobs:
|
||||
|
||||
- pwsh: |
|
||||
$repoRoot = "$(Build.SourcesDirectory)/PowerShell"
|
||||
Import-Module "$repoRoot/build.psm1" -Force
|
||||
Start-PSBootstrap
|
||||
|
||||
$exeName = if ($IsWindows) { "pwsh.exe" } else { "pwsh" }
|
||||
|
||||
|
@@ -46,47 +46,17 @@ jobs:
|
||||
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/drop_nupkg_build_nupkg" -Recurse
|
||||
displayName: 'Capture Downloaded Artifacts'
|
||||
|
||||
- pwsh: |
|
||||
$repoRoot = "$(Build.SourcesDirectory)"
|
||||
|
||||
$dotnetMetadataPath = "$repoRoot/DotnetRuntimeMetadata.json"
|
||||
$dotnetMetadataJson = Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json
|
||||
|
||||
# Channel is like: $Channel = "5.0.1xx-preview2"
|
||||
$Channel = $dotnetMetadataJson.sdk.channel
|
||||
|
||||
$sdkVersion = (Get-Content "$repoRoot/global.json" -Raw | ConvertFrom-Json).sdk.version
|
||||
Import-Module "$repoRoot/build.psm1" -Force
|
||||
|
||||
Find-Dotnet
|
||||
|
||||
if(-not (Get-PackageSource -Name 'dotnet' -ErrorAction SilentlyContinue))
|
||||
{
|
||||
$nugetFeed = ([xml](Get-Content $repoRoot/nuget.config -Raw)).Configuration.packagesources.add | Where-Object { $_.Key -eq 'dotnet' } | Select-Object -ExpandProperty Value
|
||||
|
||||
if ($nugetFeed) {
|
||||
Register-PackageSource -Name 'dotnet' -Location $nugetFeed -ProviderName NuGet
|
||||
Write-Verbose -Message "Register new package source 'dotnet'" -verbose
|
||||
}
|
||||
}
|
||||
|
||||
## Install latest version from the channel
|
||||
#Install-Dotnet -Channel "$Channel" -Version $sdkVersion
|
||||
|
||||
Start-PSBootstrap
|
||||
|
||||
Write-Verbose -Message "Installing .NET SDK completed." -Verbose
|
||||
|
||||
displayName: Install .NET
|
||||
env:
|
||||
__DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY)
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
workingDirectory: $(REPOROOT)
|
||||
|
||||
- pwsh: |
|
||||
$repoRoot = "$(Build.SourcesDirectory)"
|
||||
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
Import-Module "$repoRoot/build.psm1" -Force
|
||||
Start-PSBootstrap
|
||||
|
||||
$localLocation = "$(Pipeline.Workspace)/PSPackagesOfficial/drop_nupkg_build_nupkg"
|
||||
$xmlElement = @"
|
||||
|
@@ -30,12 +30,13 @@ jobs:
|
||||
repoRoot: $(Build.SourcesDirectory)/PowerShell
|
||||
ob_restore_phase: true
|
||||
|
||||
- pwsh: |
|
||||
Import-Module $(Build.SourcesDirectory)/PowerShell/build.psm1
|
||||
Start-PSBootstrap
|
||||
displayName: Bootstrap
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
|
||||
env:
|
||||
__DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY)
|
||||
ob_restore_phase: true
|
||||
|
||||
- pwsh: |
|
||||
@@ -97,12 +98,13 @@ jobs:
|
||||
repoRoot: $(Build.SourcesDirectory)/PowerShell
|
||||
ob_restore_phase: true
|
||||
|
||||
- pwsh: |
|
||||
Import-Module $(Build.SourcesDirectory)/PowerShell/build.psm1
|
||||
Start-PSBootstrap
|
||||
displayName: Bootstrap
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
|
||||
env:
|
||||
__DOTNET_RUNTIME_FEED_KEY: $(RUNTIME_SOURCEFEED_KEY)
|
||||
ob_restore_phase: true
|
||||
|
||||
- pwsh: |
|
||||
|
@@ -65,6 +65,13 @@ jobs:
|
||||
AnalyzeInPipeline: false
|
||||
Language: csharp
|
||||
|
||||
- task: UseDotNet@2
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
workingDirectory: $(PowerShellRoot)
|
||||
env:
|
||||
ob_restore_phase: true
|
||||
|
||||
- pwsh: |
|
||||
$runtime = switch ($env:Architecture)
|
||||
{
|
||||
@@ -88,7 +95,7 @@ jobs:
|
||||
Import-Module -Name $(PowerShellRoot)/build.psm1 -Force
|
||||
$buildWithSymbolsPath = New-Item -ItemType Directory -Path $(Pipeline.Workspace)/Symbols_$(Architecture) -Force
|
||||
|
||||
Start-PSBootstrap -Package
|
||||
Start-PSBootstrap -Scenario Package
|
||||
$null = New-Item -ItemType Directory -Path $buildWithSymbolsPath -Force -Verbose
|
||||
|
||||
$ReleaseTagParam = @{}
|
||||
@@ -137,7 +144,6 @@ jobs:
|
||||
}
|
||||
|
||||
Import-Module -Name $(PowerShellRoot)/build.psm1 -Force
|
||||
Start-PSBootstrap
|
||||
|
||||
## Build global tool
|
||||
Write-Verbose -Message "Building PowerShell global tool for Windows.x64" -Verbose
|
||||
@@ -231,8 +237,6 @@ jobs:
|
||||
After that, we repack using Compress-Archive and rename it back to a nupkg.
|
||||
#>
|
||||
|
||||
Import-Module -Name $(PowerShellRoot)/build.psm1 -Force
|
||||
Start-PSBootstrap
|
||||
$packagingStrings = Import-PowerShellDataFile "$(PowerShellRoot)\tools\packaging\packaging.strings.psd1"
|
||||
|
||||
$outputPath = Join-Path '$(ob_outputDirectory)' 'globaltool'
|
||||
|
@@ -78,6 +78,13 @@ jobs:
|
||||
env:
|
||||
ob_restore_phase: true # This ensures this done in restore phase to workaround signing issue
|
||||
|
||||
- task: UseDotNet@2
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
workingDirectory: $(REPOROOT)
|
||||
env:
|
||||
ob_restore_phase: true
|
||||
|
||||
- pwsh: |
|
||||
$msixUrl = '$(makeappUrl)'
|
||||
Invoke-RestMethod -Uri $msixUrl -OutFile '$(Pipeline.Workspace)\makeappx.zip'
|
||||
@@ -105,7 +112,7 @@ jobs:
|
||||
Import-Module "$repoRoot\build.psm1"
|
||||
Import-Module "$repoRoot\tools\packaging"
|
||||
|
||||
Start-PSBootstrap -Package
|
||||
Start-PSBootstrap -Scenario Package
|
||||
|
||||
$signedFilesPath, $psoptionsFilePath = if ($env:RUNTIME -eq 'minsize') {
|
||||
"$(Pipeline.Workspace)\CoOrdinatedBuildPipeline\drop_windows_build_windows_x64_${runtime}\$signedFolder"
|
||||
@@ -136,7 +143,7 @@ jobs:
|
||||
Write-Verbose -Message "LTS Release: $LTS"
|
||||
}
|
||||
|
||||
Start-PSBootstrap -Package
|
||||
Start-PSBootstrap -Scenario Package
|
||||
|
||||
$WindowsRuntime = switch ($runtime) {
|
||||
'x64' { 'win7-x64' }
|
||||
|
@@ -13,6 +13,12 @@ jobs:
|
||||
displayName: ${{ parameters.name }} packaging
|
||||
|
||||
steps:
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
|
||||
- pwsh: |
|
||||
Get-ChildItem -Path env: | Out-String -width 9999 -Stream | write-Verbose -Verbose
|
||||
displayName: Capture Environment
|
||||
@@ -33,7 +39,7 @@ jobs:
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1
|
||||
Start-PSBootstrap -Package
|
||||
Start-PSBootstrap -Scenario Package
|
||||
displayName: Bootstrap
|
||||
|
||||
- pwsh: |
|
||||
|
@@ -110,6 +110,6 @@ stages:
|
||||
clean: true
|
||||
- pwsh: |
|
||||
import-module ./build.psm1
|
||||
start-psbootstrap -package
|
||||
start-psbootstrap -Scenario package
|
||||
displayName: Bootstrap packaging
|
||||
condition: succeededOrFailed()
|
||||
|
@@ -137,7 +137,6 @@ stages:
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1 -force
|
||||
Start-PSBootstrap
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
$options = (Get-PSOptions)
|
||||
|
@@ -57,6 +57,12 @@ jobs:
|
||||
- ${{ if ne(variables['UseAzDevOpsFeed'], '') }}:
|
||||
- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\tools\ci.psm1
|
||||
Invoke-CIInstall -SkipUser
|
||||
|
@@ -13,6 +13,12 @@ jobs:
|
||||
displayName: ${{ parameters.name }} Test - ${{ parameters.purpose }} - ${{ parameters.tagSet }}
|
||||
|
||||
steps:
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
|
||||
- template: ./test/nix-test-steps.yml
|
||||
parameters:
|
||||
purpose: ${{ parameters.purpose }}
|
||||
|
@@ -23,6 +23,12 @@ jobs:
|
||||
displayName: ${{ parameters.name }} Test - ${{ parameters.purpose }} - ${{ parameters.tagSet }}
|
||||
|
||||
steps:
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
|
||||
- template: ./nix-test-steps.yml
|
||||
parameters:
|
||||
purpose: ${{ parameters.purpose }}
|
||||
|
@@ -54,6 +54,13 @@ jobs:
|
||||
displayName: 'Capture Artifacts Directory'
|
||||
continueOnError: true
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
workingDirectory: $(Build.SourcesDirectory)"
|
||||
|
||||
# must be run frow Windows PowerShell
|
||||
- powershell: |
|
||||
# Remove "Program Files\dotnet" from the env variable PATH, so old SDKs won't affect us.
|
||||
@@ -74,7 +81,6 @@ jobs:
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1 -force
|
||||
Start-PSBootstrap
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
$options = (Get-PSOptions)
|
||||
|
@@ -93,6 +93,13 @@ stages:
|
||||
displayName: Bootstrap
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
workingDirectory: $(Build.SourcesDirectory)"
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
@@ -104,7 +111,6 @@ stages:
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1
|
||||
Start-PSBootstrap
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
Invoke-CITest -Purpose UnelevatedPesterTests -TagSet CI
|
||||
@@ -113,7 +119,6 @@ stages:
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1
|
||||
Start-PSBootstrap
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
Invoke-CITest -Purpose ElevatedPesterTests -TagSet CI
|
||||
@@ -122,7 +127,6 @@ stages:
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1
|
||||
Start-PSBootstrap
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
Invoke-CITest -Purpose UnelevatedPesterTests -TagSet Others
|
||||
@@ -131,7 +135,6 @@ stages:
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\build.psm1
|
||||
Start-PSBootstrap
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json'
|
||||
Invoke-CITest -Purpose ElevatedPesterTests -TagSet Others
|
||||
|
@@ -57,6 +57,13 @@ jobs:
|
||||
condition: succeeded()
|
||||
workingDirectory: $(repoPath)
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET Core sdk'
|
||||
inputs:
|
||||
useGlobalJson: true
|
||||
packageType: 'sdk'
|
||||
workingDirectory: $(repoPath)
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\tools\ci.psm1
|
||||
Invoke-CIInstall -SkipUser
|
||||
|
75
build.psm1
75
build.psm1
@@ -2226,10 +2226,12 @@ function Start-PSBootstrap {
|
||||
# we currently pin dotnet-cli version, and will
|
||||
# update it when more stable version comes out.
|
||||
[string]$Version = $dotnetCLIRequiredVersion,
|
||||
[switch]$Package,
|
||||
[switch]$NoSudo,
|
||||
[switch]$BuildLinuxArm,
|
||||
[switch]$Force
|
||||
[switch]$Force,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateSet("Package", "DotNet", "Both")]
|
||||
[string]$Scenario = "Package"
|
||||
)
|
||||
|
||||
Write-Log -message "Installing PowerShell build dependencies"
|
||||
@@ -2262,7 +2264,7 @@ function Start-PSBootstrap {
|
||||
elseif ($environment.IsUbuntu18) { $Deps += "libicu60"}
|
||||
|
||||
# Packaging tools
|
||||
if ($Package) { $Deps += "ruby-dev", "groff", "libffi-dev", "rpm", "g++", "make" }
|
||||
if ($Scenario -eq 'Both' -or $Scenario -eq 'Package') { $Deps += "ruby-dev", "groff", "libffi-dev", "rpm", "g++", "make" }
|
||||
|
||||
# Install dependencies
|
||||
# change the fontend from apt-get to noninteractive
|
||||
@@ -2286,7 +2288,7 @@ function Start-PSBootstrap {
|
||||
$Deps += "libicu", "openssl-libs"
|
||||
|
||||
# Packaging tools
|
||||
if ($Package) { $Deps += "ruby-devel", "rpm-build", "groff", 'libffi-devel', "gcc-c++" }
|
||||
if ($Scenario -eq 'Both' -or $Scenario -eq 'Package') { $Deps += "ruby-devel", "rpm-build", "groff", 'libffi-devel', "gcc-c++" }
|
||||
|
||||
$PackageManager = Get-RedHatPackageManager
|
||||
|
||||
@@ -2307,7 +2309,7 @@ function Start-PSBootstrap {
|
||||
$Deps += "wget"
|
||||
|
||||
# Packaging tools
|
||||
if ($Package) { $Deps += "ruby-devel", "rpmbuild", "groff", 'libffi-devel', "gcc" }
|
||||
if ($Scenario -eq 'Both' -or $Scenario -eq 'Package') { $Deps += "ruby-devel", "rpmbuild", "groff", 'libffi-devel', "gcc" }
|
||||
|
||||
$PackageManager = "zypper --non-interactive install"
|
||||
$baseCommand = "$sudo $PackageManager"
|
||||
@@ -2347,7 +2349,7 @@ function Start-PSBootstrap {
|
||||
}
|
||||
|
||||
# Install [fpm](https://github.com/jordansissel/fpm)
|
||||
if ($Package) {
|
||||
if ($Scenario -eq 'Both' -or $Scenario -eq 'Package') {
|
||||
Install-GlobalGem -Sudo $sudo -GemName "dotenv" -GemVersion "2.8.1"
|
||||
Install-GlobalGem -Sudo $sudo -GemName "ffi" -GemVersion "1.16.3"
|
||||
Install-GlobalGem -Sudo $sudo -GemName "fpm" -GemVersion "1.15.1"
|
||||
@@ -2355,42 +2357,45 @@ function Start-PSBootstrap {
|
||||
}
|
||||
}
|
||||
|
||||
Write-Verbose -Verbose "Calling Find-Dotnet from Start-PSBootstrap"
|
||||
if ($Scenario -eq 'DotNet' -or $Scenario -eq 'Both') {
|
||||
|
||||
# Try to locate dotnet-SDK before installing it
|
||||
Find-Dotnet
|
||||
Write-Verbose -Verbose "Calling Find-Dotnet from Start-PSBootstrap"
|
||||
|
||||
Write-Verbose -Verbose "Back from calling Find-Dotnet from Start-PSBootstrap"
|
||||
# Try to locate dotnet-SDK before installing it
|
||||
Find-Dotnet
|
||||
|
||||
# Install dotnet-SDK
|
||||
$dotNetExists = precheck 'dotnet' $null
|
||||
$dotNetVersion = [string]::Empty
|
||||
if($dotNetExists) {
|
||||
$dotNetVersion = Find-RequiredSDK $dotnetCLIRequiredVersion
|
||||
}
|
||||
Write-Verbose -Verbose "Back from calling Find-Dotnet from Start-PSBootstrap"
|
||||
|
||||
if(!$dotNetExists -or $dotNetVersion -ne $dotnetCLIRequiredVersion -or $Force.IsPresent) {
|
||||
if($Force.IsPresent) {
|
||||
Write-Log -message "Installing dotnet due to -Force."
|
||||
# Install dotnet-SDK
|
||||
$dotNetExists = precheck 'dotnet' $null
|
||||
$dotNetVersion = [string]::Empty
|
||||
if($dotNetExists) {
|
||||
$dotNetVersion = Find-RequiredSDK $dotnetCLIRequiredVersion
|
||||
}
|
||||
elseif(!$dotNetExists) {
|
||||
Write-Log -message "dotnet not present. Installing dotnet."
|
||||
|
||||
if(!$dotNetExists -or $dotNetVersion -ne $dotnetCLIRequiredVersion -or $Force.IsPresent) {
|
||||
if($Force.IsPresent) {
|
||||
Write-Log -message "Installing dotnet due to -Force."
|
||||
}
|
||||
elseif(!$dotNetExists) {
|
||||
Write-Log -message "dotnet not present. Installing dotnet."
|
||||
}
|
||||
else {
|
||||
Write-Log -message "dotnet out of date ($dotNetVersion). Updating dotnet."
|
||||
}
|
||||
|
||||
$DotnetArguments = @{ Channel=$Channel; Version=$Version; NoSudo=$NoSudo }
|
||||
|
||||
if ($dotnetAzureFeed) {
|
||||
$null = $DotnetArguments.Add("AzureFeed", $dotnetAzureFeed)
|
||||
$null = $DotnetArguments.Add("FeedCredential", $dotnetAzureFeedSecret)
|
||||
}
|
||||
|
||||
Install-Dotnet @DotnetArguments
|
||||
}
|
||||
else {
|
||||
Write-Log -message "dotnet out of date ($dotNetVersion). Updating dotnet."
|
||||
Write-Log -message "dotnet is already installed. Skipping installation."
|
||||
}
|
||||
|
||||
$DotnetArguments = @{ Channel=$Channel; Version=$Version; NoSudo=$NoSudo }
|
||||
|
||||
if ($dotnetAzureFeed) {
|
||||
$null = $DotnetArguments.Add("AzureFeed", $dotnetAzureFeed)
|
||||
$null = $DotnetArguments.Add("FeedCredential", $dotnetAzureFeedSecret)
|
||||
}
|
||||
|
||||
Install-Dotnet @DotnetArguments
|
||||
}
|
||||
else {
|
||||
Write-Log -message "dotnet is already installed. Skipping installation."
|
||||
}
|
||||
|
||||
# Install Windows dependencies if `-Package` or `-BuildWindowsNative` is specified
|
||||
@@ -2402,7 +2407,7 @@ function Start-PSBootstrap {
|
||||
$psInstallFile = [System.IO.Path]::Combine($PSScriptRoot, "tools", "install-powershell.ps1")
|
||||
& $psInstallFile -AddToPath
|
||||
}
|
||||
if ($Package) {
|
||||
if ($Scenario -eq 'Both' -or $Scenario -eq 'Package') {
|
||||
Import-Module "$PSScriptRoot\tools\wix\wix.psm1"
|
||||
$isArm64 = "$env:RUNTIME" -eq 'arm64'
|
||||
Install-Wix -arm64:$isArm64
|
||||
|
@@ -188,8 +188,6 @@ function Invoke-CIInstall
|
||||
}
|
||||
|
||||
Set-BuildVariable -Name TestPassed -Value False
|
||||
Write-Verbose -Verbose -Message "Calling Start-PSBootstrap from Invoke-CIInstall"
|
||||
Start-PSBootstrap
|
||||
}
|
||||
|
||||
function Invoke-CIxUnit
|
||||
@@ -402,8 +400,6 @@ function New-CodeCoverageAndTestPackage
|
||||
|
||||
if (Test-DailyBuild)
|
||||
{
|
||||
Start-PSBootstrap -Verbose
|
||||
|
||||
Start-PSBuild -Configuration 'CodeCoverage' -Clean
|
||||
|
||||
$codeCoverageOutput = Split-Path -Parent (Get-PSOutput)
|
||||
@@ -691,7 +687,7 @@ function Invoke-BootstrapStage
|
||||
Write-Log -Message "Executing ci.psm1 Bootstrap Stage"
|
||||
# Make sure we have all the tags
|
||||
Sync-PSTags -AddRemoteIfMissing
|
||||
Start-PSBootstrap -Package:$createPackages
|
||||
Start-PSBootstrap -Scenario Package:$createPackages
|
||||
}
|
||||
|
||||
# Run pester tests for Linux and macOS
|
||||
|
@@ -1637,7 +1637,7 @@ function Get-PackageDependencies
|
||||
function Test-Dependencies
|
||||
{
|
||||
foreach ($Dependency in "fpm") {
|
||||
if (!(precheck $Dependency "Package dependency '$Dependency' not found. Run Start-PSBootstrap -Package")) {
|
||||
if (!(precheck $Dependency "Package dependency '$Dependency' not found. Run Start-PSBootstrap -Scenario Package")) {
|
||||
# These tools are not added to the path automatically on OpenSUSE 13.2
|
||||
# try adding them to the path and re-tesing first
|
||||
[string] $gemsPath = $null
|
||||
@@ -1647,7 +1647,7 @@ function Test-Dependencies
|
||||
$depenencyPath = Get-ChildItem -Path (Join-Path -Path $gemsPath -ChildPath "gems" -AdditionalChildPath $Dependency) -Recurse | Sort-Object -Property LastWriteTime -Descending | Select-Object -First 1 -ExpandProperty DirectoryName
|
||||
$originalPath = $env:PATH
|
||||
$env:PATH = $ENV:PATH +":" + $depenencyPath
|
||||
if ((precheck $Dependency "Package dependency '$Dependency' not found. Run Start-PSBootstrap -Package")) {
|
||||
if ((precheck $Dependency "Package dependency '$Dependency' not found. Run Start-PSBootstrap -Scenario Package")) {
|
||||
continue
|
||||
}
|
||||
else {
|
||||
|
@@ -248,7 +248,7 @@ jobs:
|
||||
- powershell: |
|
||||
Import-Module "$env:POWERSHELLROOT/build.psm1"
|
||||
|
||||
Start-PSBootstrap -Package
|
||||
Start-PSBootstrap -Scenario Package
|
||||
displayName: 'Bootstrap'
|
||||
condition: and(succeeded(), ne(variables['SkipBuild'], 'true'))
|
||||
workingDirectory: $(PowerShellRoot)
|
||||
|
@@ -57,7 +57,7 @@ jobs:
|
||||
- powershell: |
|
||||
Import-Module "$env:POWERSHELLROOT/build.psm1"
|
||||
|
||||
Start-PSBootstrap -Package
|
||||
Start-PSBootstrap -Scenario Package
|
||||
displayName: 'Bootstrap'
|
||||
condition: and(succeeded(), ne(variables['SkipBuild'], 'true'))
|
||||
workingDirectory: $(PowerShellRoot)
|
||||
|
Reference in New Issue
Block a user