Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

test(zstd): Fix 'zstd' extraction error in test #4651

Merged
merged 5 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 2 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions test/Scoop-Decompress.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
26 changes: 1 addition & 25 deletions test/bin/init.ps1
Original file line number Diff line number Diff line change
@@ -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
Expand Down
29 changes: 26 additions & 3 deletions test/bin/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ $splat = @{
PassThru = $true
}

$excludes = @()
if ($env:CI -eq $true) {
$resultsXml = "$PSScriptRoot/TestResults.xml"
$excludes = @()

$splat += @{
OutputFile = $resultsXml
Expand All @@ -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'
}
Expand All @@ -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")) {
Expand Down