Files
runner-images/images/windows/scripts/build/Install-Zstd.ps1
T

30 lines
1.0 KiB
PowerShell
Raw Normal View History

2020-02-17 09:01:43 +09:00
################################################################################
## File: Install-Zstd.ps1
2020-02-17 09:01:43 +09:00
## Desc: Install zstd
################################################################################
2023-12-04 10:50:53 +01:00
$downloadUrl = Resolve-GithubReleaseAssetUrl `
-Repo "facebook/zstd" `
-Version "latest" `
2023-12-04 10:50:53 +01:00
-UrlMatchPattern "zstd-*-win64.zip"
$zstdArchivePath = Invoke-DownloadWithRetry $downloadUrl
$zstdName = [IO.Path]::GetFileNameWithoutExtension($zstdArchivePath)
2021-03-12 14:28:18 +03:00
$toolPath = "C:\tools"
$zstdPath = Join-Path $toolPath zstd
2021-03-15 15:26:01 +03:00
$filesInArchive = 7z l $zstdArchivePath | Out-String
2023-12-04 10:50:53 +01:00
if ($filesInArchive.Contains($zstdName)) {
Expand-7ZipArchive -Path $zstdArchivePath -DestinationPath $toolPath
Invoke-ScriptBlockWithRetry -Command {
Move-Item -Path "${zstdPath}*" -Destination $zstdPath -ErrorAction Stop
}
2021-03-15 15:26:01 +03:00
} else {
Expand-7ZipArchive -Path $zstdArchivePath -DestinationPath $zstdPath
2021-03-15 15:26:01 +03:00
}
2021-03-12 14:28:18 +03:00
# Add zstd-win64 to PATH
Add-MachinePathItem $zstdPath
2020-07-30 12:12:49 +05:00
Invoke-PesterTests -TestFile "Tools" -TestName "Zstd"