diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d5f8df8f9..abd56f49da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ - **test-bin:** Only write output file in CI and fix trailing whitespaces ([#4613](https://github.com/ScoopInstaller/Scoop/issues/4613)) - **manifest:** Fix manifests validation ([#4620](https://github.com/ScoopInstaller/Scoop/issues/4620)) +- **zstd:** Fix 'zstd' extraction error in test ([#4651](https://github.com/ScoopInstaller/Scoop/issues/4651)) ### Documentation diff --git a/appveyor.yml b/appveyor.yml index 2ce7cfb803..5632ebbbb1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,17 +2,13 @@ version: "{build}-{branch}" branches: except: - gh-pages -build: off -deploy: off +build: false +deploy: false clone_depth: 49 image: Visual Studio 2019 environment: scoop: C:\projects\scoop scoop_home: C:\projects\scoop - scoop_helpers: C:\projects\helpers - lessmsi: '%scoop_helpers%\lessmsi\lessmsi.exe' - innounp: '%scoop_helpers%\innounp\innounp.exe' - zstd: '%scoop_helpers%\zstd\zstd.exe' matrix: - PowerShell: 5 - PowerShell: 6 diff --git a/test/Scoop-Decompress.Tests.ps1 b/test/Scoop-Decompress.Tests.ps1 index cad7d2a8f8..5a2a6e3e0d 100644 --- a/test/Scoop-Decompress.Tests.ps1 +++ b/test/Scoop-Decompress.Tests.ps1 @@ -80,7 +80,8 @@ Describe 'Decompression function' -Tag 'Scoop', 'Decompress' { BeforeAll { if ($env:CI) { - Mock Get-AppFilePath { $env:zstd } + Mock Get-AppFilePath { $env:SCOOP_ZSTD_PATH } -ParameterFilter { $Helper -eq 'zstd' } + Mock Get-AppFilePath { '7z.exe' } -ParameterFilter { $Helper -eq '7zip' } } elseif (!(installed zstd)) { scoop install zstd } @@ -114,7 +115,7 @@ Describe 'Decompression function' -Tag 'Scoop', 'Decompress' { BeforeAll { if ($env:CI) { - Mock Get-AppFilePath { $env:lessmsi } + Mock Get-AppFilePath { $env:SCOOP_LESSMSI_PATH } } elseif (!(installed lessmsi)) { scoop install lessmsi } @@ -148,7 +149,7 @@ Describe 'Decompression function' -Tag 'Scoop', 'Decompress' { BeforeAll { if ($env:CI) { - Mock Get-AppFilePath { $env:innounp } + Mock Get-AppFilePath { $env:SCOOP_INNOUNP_PATH } } elseif (!(installed innounp)) { scoop install innounp } diff --git a/test/bin/init.ps1 b/test/bin/init.ps1 index 5e709bc85d..c3125f9a71 100644 --- a/test/bin/init.ps1 +++ b/test/bin/init.ps1 @@ -1,33 +1,9 @@ Write-Host "PowerShell: $($PSVersionTable.PSVersion)" -(7z.exe | Select-String -Pattern '7-Zip').ToString() +Write-Host (7z.exe | Select-String -Pattern '7-Zip').ToString() Write-Host 'Install dependencies ...' Install-Module -Repository PSGallery -Scope CurrentUser -Force -Name Pester -RequiredVersion 4.10.1 -SkipPublisherCheck Install-Module -Repository PSGallery -Scope CurrentUser -Force -Name PSScriptAnalyzer, BuildHelpers -if ($env:CI_WINDOWS -eq $true) { - # Do not force maintainers to have this inside environment appveyor config - if (-not $env:SCOOP_HELPERS) { - $env:SCOOP_HELPERS = 'C:\projects\helpers' - [System.Environment]::SetEnvironmentVariable('SCOOP_HELPERS', $env:SCOOP_HELPERS, 'Machine') - } - - if (!(Test-Path $env:SCOOP_HELPERS)) { - New-Item -ItemType Directory -Path $env:SCOOP_HELPERS - } - if (!(Test-Path "$env:SCOOP_HELPERS\lessmsi\lessmsi.exe")) { - Start-FileDownload 'https://github.com/activescott/lessmsi/releases/download/v1.10.0/lessmsi-v1.10.0.zip' -FileName "$env:SCOOP_HELPERS\lessmsi.zip" - & 7z.exe x "$env:SCOOP_HELPERS\lessmsi.zip" -o"$env:SCOOP_HELPERS\lessmsi" -y - } - if (!(Test-Path "$env:SCOOP_HELPERS\innounp\innounp.exe")) { - Start-FileDownload 'https://raw.githubusercontent.com/ScoopInstaller/Binary/master/innounp/innounp050.rar' -FileName "$env:SCOOP_HELPERS\innounp.rar" - & 7z.exe x "$env:SCOOP_HELPERS\innounp.rar" -o"$env:SCOOP_HELPERS\innounp" -y - } - if (!(Test-Path "$env:SCOOP_HELPERS\zstd\zstd.exe")) { - Start-FileDownload 'https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-v1.5.0-win32.zip' -FileName "$env:SCOOP_HELPERS\zstd.zip" - & 7z.exe x "$env:SCOOP_HELPERS\zstd.zip" 'zstd-v1.5.0-win32' -o"$env:SCOOP_HELPERS\zstd" -y - } -} - if ($env:CI -eq $true) { Write-Host "Load 'BuildHelpers' environment variables ..." Set-BuildEnvironment -Force diff --git a/test/bin/test.ps1 b/test/bin/test.ps1 index 51b7cc9ad0..71121f806f 100644 --- a/test/bin/test.ps1 +++ b/test/bin/test.ps1 @@ -11,9 +11,9 @@ $splat = @{ PassThru = $true } +$excludes = @() if ($env:CI -eq $true) { $resultsXml = "$PSScriptRoot/TestResults.xml" - $excludes = @() $splat += @{ OutputFile = $resultsXml @@ -35,8 +35,7 @@ if ($env:CI -eq $true) { $excludes += 'Scoop' } - $changed_scripts = (Get-GitChangedFile -Include '*decompress.ps1' -Commit $commit) - if (!$changed_scripts) { + if (!($changed_scripts -like '*decompress.ps1')) { Write-Warning "Skipping tests and code linting for decompress.ps1 files because it didn't change" $excludes += 'Decompress' } @@ -56,6 +55,30 @@ if ($env:CI -eq $true) { Write-Warning "Skipping tests and validation for manifest files because they didn't change" $excludes += 'Manifests' } + + if ('Decompress' -notin $excludes) { + Write-Host 'Install decompress dependencies ...' + + $env:SCOOP_HELPERS_PATH = 'C:\projects\helpers' + if (!(Test-Path $env:SCOOP_HELPERS_PATH)) { + New-Item -ItemType Directory -Path $env:SCOOP_HELPERS_PATH + } + if (!(Test-Path "$env:SCOOP_HELPERS_PATH\lessmsi\lessmsi.exe")) { + Start-FileDownload 'https://github.com/activescott/lessmsi/releases/download/v1.10.0/lessmsi-v1.10.0.zip' -FileName "$env:SCOOP_HELPERS_PATH\lessmsi.zip" + & 7z.exe x "$env:SCOOP_HELPERS_PATH\lessmsi.zip" -o"$env:SCOOP_HELPERS_PATH\lessmsi" -y + $env:SCOOP_LESSMSI_PATH = "$env:SCOOP_HELPERS_PATH\lessmsi\lessmsi.exe" + } + if (!(Test-Path "$env:SCOOP_HELPERS_PATH\innounp\innounp.exe")) { + Start-FileDownload 'https://raw.githubusercontent.com/ScoopInstaller/Binary/master/innounp/innounp050.rar' -FileName "$env:SCOOP_HELPERS_PATH\innounp.rar" + & 7z.exe x "$env:SCOOP_HELPERS_PATH\innounp.rar" -o"$env:SCOOP_HELPERS_PATH\innounp" -y + $env:SCOOP_INNOUNP_PATH = "$env:SCOOP_HELPERS_PATH\innounp\innounp.exe" + } + if (!(Test-Path "$env:SCOOP_HELPERS_PATH\zstd\zstd.exe")) { + Start-FileDownload 'https://github.com/facebook/zstd/releases/download/v1.5.1/zstd-v1.5.1-win32.zip' -FileName "$env:SCOOP_HELPERS_PATH\zstd.zip" + & 7z.exe x "$env:SCOOP_HELPERS_PATH\zstd.zip" -o"$env:SCOOP_HELPERS_PATH\zstd" -y + $env:SCOOP_ZSTD_PATH = "$env:SCOOP_HELPERS_PATH\zstd\zstd.exe" + } + } } if (!(Test-Path "$PSScriptRoot\..\..\bucket")) {