-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: get Linux build to upload build artifacts #1293
base: main
Are you sure you want to change the base?
Changes from all commits
f60bf88
c1db4c2
f7dc29a
7bd18a3
4b5eb3a
2962958
7f29893
02d419f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,10 +97,10 @@ Describe "Test importing correct customized rules" { | |
It "will show the custom rules when given a glob" { | ||
# needs fixing for Linux | ||
$expectedNumRules = 4 | ||
if ($IsLinux) | ||
{ | ||
$expectedNumRules = 3 | ||
} | ||
#if ($IsLinux) | ||
#{ | ||
# $expectedNumRules = 3 | ||
#} | ||
$customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $directory\samplerule\samplerule* | Where-Object {$_.RuleName -match $measure} | ||
$customizedRulePath.Count | Should -Be $expectedNumRules | ||
} | ||
|
@@ -113,10 +113,10 @@ Describe "Test importing correct customized rules" { | |
It "will show the custom rules when given glob with recurse switch" { | ||
# needs fixing for Linux | ||
$expectedNumRules = 5 | ||
if ($IsLinux) | ||
{ | ||
$expectedNumRules = 4 | ||
} | ||
#if ($IsLinux) | ||
#{ | ||
# $expectedNumRules = 4 | ||
#} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should just delete those commented out code lines now that it works without a special case (not sure why, I guess some upstream dependency received a fix) |
||
$customizedRulePath = Get-ScriptAnalyzerRule -RecurseCustomRulePath -CustomizedRulePath $directory\samplerule\samplerule* | Where-Object {$_.RuleName -eq $measure} | ||
$customizedRulePath.Count | Should -Be $expectedNumRules | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,15 @@ environment: | |
BuildConfiguration: Release | ||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # For faster CI builds | ||
matrix: | ||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 | ||
PowerShellEdition: PowerShellCore | ||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 | ||
PowerShellEdition: WindowsPowerShell | ||
- APPVEYOR_BUILD_WORKER_IMAGE: WMF 4 | ||
PowerShellEdition: WindowsPowerShell | ||
PSVersion: 4 | ||
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu | ||
PowerShellEdition: PowerShellCore | ||
# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 | ||
# PowerShellEdition: PowerShellCore | ||
# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 | ||
# PowerShellEdition: WindowsPowerShell | ||
# - APPVEYOR_BUILD_WORKER_IMAGE: WMF 4 | ||
# PowerShellEdition: WindowsPowerShell | ||
# PSVersion: 4 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please uncomment again before the merge |
||
|
||
# cache Nuget packages and dotnet CLI cache | ||
cache: | ||
|
@@ -34,7 +34,9 @@ build_script: | |
- pwsh: | | ||
if ($env:PowerShellEdition -eq 'PowerShellCore') { | ||
Set-Location $env:APPVEYOR_BUILD_FOLDER | ||
Write-Verbose -Verbose "calling build.ps1" | ||
./build.ps1 -Configuration "$env:BuildConfiguration" -PSVersion 6 | ||
Write-Verbose -Verbose "calling PSCompatibility/build.ps1" | ||
./PSCompatibilityCollector/build.ps1 -Configuration "$env:BuildConfiguration" -Framework 'netstandard2.0' | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,10 +156,11 @@ function Start-ScriptAnalyzerBuild | |
) | ||
|
||
BEGIN { | ||
Write-Verbose -Verbose "Start-ScriptAnalyzerBuild BEGIN" | ||
# don't allow the build to be started unless we have the proper Cli version | ||
# this will not actually install dotnet if it's already present, but it will | ||
# install the proper version | ||
Install-Dotnet | ||
Install-Dotnet -Verbose | ||
if ( -not (Test-SuitableDotnet) ) { | ||
$requiredVersion = Get-GlobalJsonSdkVersion | ||
$foundVersion = Get-InstalledCLIVersion | ||
|
@@ -168,6 +169,7 @@ function Start-ScriptAnalyzerBuild | |
} | ||
END { | ||
|
||
Write-Verbose -Verbose "Start-ScriptAnalyzerBuild END" | ||
# Build docs either when -Documentation switch is being specified or the first time in a clean repo | ||
$documentationFileExists = Test-Path (Join-Path $PSScriptRoot 'out\PSScriptAnalyzer\en-us\Microsoft.Windows.PowerShell.ScriptAnalyzer.dll-Help.xml') | ||
if ( $Documentation -or -not $documentationFileExists ) | ||
|
@@ -246,11 +248,15 @@ function Start-ScriptAnalyzerBuild | |
try { | ||
Push-Location $projectRoot/Rules | ||
Write-Progress "Building ScriptAnalyzer for PSVersion '$PSVersion' using framework '$framework' and configuration '$Configuration'" | ||
Write-Verbose -verbose "Building ScriptAnalyzer for PSVersion '$PSVersion' using framework '$framework' and configuration '$Configuration'" | ||
if ( -not $script:DotnetExe ) { | ||
$script:DotnetExe = Get-DotnetExe | ||
} | ||
$buildOutput = & $script:DotnetExe build --framework $framework --configuration "$config" 2>&1 | ||
if ( $LASTEXITCODE -ne 0 ) { throw "$buildOutput" } | ||
if ( $LASTEXITCODE -ne 0 ) { | ||
$buildOutput | Write-Verbose -Verbose | ||
throw "$buildOutput" | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation of closing brace is 1 level too much |
||
} | ||
catch { | ||
Write-Warning $_ | ||
|
@@ -261,6 +267,7 @@ function Start-ScriptAnalyzerBuild | |
Pop-Location | ||
} | ||
|
||
Write-Verbose -Verbose "Publish-File to ${script:destinationDir}" | ||
Publish-File $itemsToCopyCommon $script:destinationDir | ||
|
||
$itemsToCopyBinaries = @( | ||
|
@@ -390,16 +397,19 @@ function Install-Dotnet | |
Push-Location $PSScriptRoot | ||
$installScriptPath = Receive-DotnetInstallScript | ||
$installScriptName = [System.IO.Path]::GetFileName($installScriptPath) | ||
Write-Verbose -Verbose "installscript is $installScriptPath" | ||
If ( $PSCmdlet.ShouldProcess("$installScriptName for $version")) { | ||
& "${installScriptPath}" -c release -version $version | ||
} | ||
# this may be the first time that dotnet has been installed, | ||
# set up the executable variable | ||
if ( -not $script:DotnetExe ) { | ||
$script:DotnetExe = Get-DotnetExe | ||
Write-Verbose -Verbose "Setting DotnetExe variable to ${script:DotnetExe}" | ||
} | ||
} | ||
catch { | ||
Write-Warning "Failure build.psm1 line 407" | ||
throw $_ | ||
} | ||
finally { | ||
|
@@ -543,6 +553,7 @@ function Get-InstalledCLIVersion { | |
} | ||
} | ||
catch { | ||
Write-Warning "${script:DotnetExe} --list-sdks" | ||
Write-Verbose -Verbose "$_" | ||
$installedVersions = & $script:DotnetExe --version 2>$null | ||
} | ||
|
@@ -607,7 +618,9 @@ function Receive-DotnetInstallScript | |
} | ||
$uri = "https://dot.net/v1/${installScriptName}" | ||
|
||
Write-Verbose -Verbose "downloading $urt" | ||
$installScript = Receive-File -Uri $uri | ||
Write-Verbose -Verbose "InstallScript is $installScript" | ||
return $installScript.FullName | ||
} | ||
|
||
|
@@ -640,9 +653,13 @@ function Get-DotnetExe | |
$dotnetHuntPath = "$HOME/.dotnet/dotnet" | ||
Write-Verbose -Verbose "checking non-Windows $dotnetHuntPath" | ||
if ( test-path $dotnetHuntPath ) { | ||
Write-Verbose -Verbose "$dotnetHuntPath found" | ||
$script:DotnetExe = $dotnetHuntPath | ||
return $dotnetHuntPath | ||
} | ||
else { | ||
Write-Verbose -Verbose "$dotnetHuntPath not found" | ||
} | ||
} | ||
|
||
Write-Warning "Could not find dotnet executable" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,9 +33,17 @@ function Invoke-AppVeyorInstall { | |
|
||
# the build script sorts out the problems of WMF4 and earlier versions of dotnet CLI | ||
Write-Verbose -Verbose "Installing required .Net CORE SDK" | ||
Write-Verbose "& $buildScriptDir/build.ps1 -bootstrap" | ||
$buildScriptDir = (Resolve-Path "$PSScriptRoot/..").Path | ||
& "$buildScriptDir/build.ps1" -bootstrap | ||
Write-Verbose -Verbose "& $buildScriptDir/build.ps1 -bootstrap" | ||
try { | ||
& "$buildScriptDir/build.ps1" -bootstrap | ||
Write-Verbose -Verbose "exiting Invoke-AppVeyorInstall ($LASTEXITCODE)" | ||
$GLOBAL:LASTEXITCODE = $LASTEXITCODE = 0 | ||
Write-Verbose -Verbose "bootstrap complete: $(get-date)" | ||
} | ||
catch { | ||
Write-Warning "error in invocation of build.ps1 from Invoke-AppVeyorInstall" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why catch the error and not let it error out? |
||
} | ||
} | ||
|
||
# Implements AppVeyor 'test_script' step | ||
|
@@ -95,12 +103,19 @@ function Invoke-AppveyorTest { | |
function Invoke-AppveyorFinish { | ||
$stagingDirectory = (Resolve-Path ..).Path | ||
$zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" | ||
Add-Type -AssemblyName 'System.IO.Compression.FileSystem' | ||
[System.IO.Compression.ZipFile]::CreateFromDirectory((Join-Path $pwd 'out'), $zipFile) | ||
@( | ||
# add test results as an artifact | ||
(Get-ChildItem TestResults.xml) | ||
# You can add other artifacts here | ||
(Get-ChildItem $zipFile) | ||
) | ForEach-Object { Push-AppveyorArtifact $_.FullName } | ||
$targetDir = Join-Path $pwd out | ||
if ( ! ( test-path $targetDir ) ) { | ||
# provide some additional data to help with debugging | ||
Get-ChildItem $PWD | Write-Verbose -Verbose | ||
} | ||
else { | ||
Add-Type -AssemblyName 'System.IO.Compression.FileSystem' | ||
[System.IO.Compression.ZipFile]::CreateFromDirectory($targetDir, $zipFile) | ||
@( | ||
# add test results as an artifact | ||
(Get-ChildItem TestResults.xml) | ||
# You can add other artifacts here | ||
(Get-ChildItem $zipFile) | ||
) | ForEach-Object { Push-AppveyorArtifact $_.FullName } | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this the fix for the premature build abortion