-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Fix reproducibility tests after release (#76)
- Loading branch information
Showing
6 changed files
with
110 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,100 @@ | ||
$ErrorActionPreference = "Stop" | ||
|
||
function New-TemporaryDirectory { | ||
$parent = [System.IO.Path]::GetTempPath() | ||
[string] $name = [System.Guid]::NewGuid() | ||
$tempDir = New-Item -ItemType Directory -Path (Join-Path $parent $name) | ||
return $tempDir.FullName | ||
} | ||
|
||
$TEMPDIR = New-TemporaryDirectory | ||
$USAGE = @" | ||
Usage: $($MyInvocation.MyCommand.Name) [OPTIONS] | ||
Arguments: | ||
Path to an environment packed using pixi-pack | ||
Options: | ||
-o, --output-directory <DIR> Where to unpack the environment. The environment will be unpacked into a subdirectory of this path [default: env] | ||
-e, --env-name <NAME> Name of the environment [default: env] | ||
-s, --shell <SHELL> Sets the shell [options: bash, zsh, xonsh, cmd, powershell, fish, nushell] | ||
-v, --verbose Increase logging verbosity | ||
-q, --quiet Decrease logging verbosity | ||
-h, --help Print help | ||
"@ | ||
|
||
foreach ($arg in $args) { | ||
if ($arg -eq "-h" -or $arg -eq "--help") { | ||
Write-Output $USAGE | ||
exit 0 | ||
} | ||
} | ||
|
||
# Extract the archive and pixi-pack executable, and decode them | ||
$scriptContent = Get-Content -Raw -Path $MyInvocation.MyCommand.Path | ||
$lines = $scriptContent -split "`r?`n" | ||
|
||
$headerLine = $null | ||
$archiveLine = $null | ||
|
||
# Find the lines where __END_HEADER__ and __END_ARCHIVE__ occur | ||
for ($i = 0; $i -lt $lines.Count; $i++) { | ||
if ($lines[$i] -like "*__END_HEADER__*") { | ||
$headerLine = $i + 2 | ||
} | ||
if ($lines[$i] -like "*__END_ARCHIVE__*") { | ||
$archiveLine = $i + 1 | ||
} | ||
} | ||
|
||
if (-not $headerLine -or -not $archiveLine) { | ||
Write-Error "ERROR: Markers __END_HEADER__ or __END_ARCHIVE__ not found." | ||
exit 1 | ||
} | ||
|
||
# Extract Base64 content for the tar archive | ||
$archiveContent = $lines[($headerLine)..($archiveLine - 2)] -join "" | ||
$archiveContent = $archiveContent.Trim() | ||
|
||
# Decode Base64 content into tar file | ||
try { | ||
$decodedArchive = [System.Convert]::FromBase64String($archiveContent) | ||
$archivePath = "$TEMPDIR\archive.tar" | ||
[System.IO.File]::WriteAllBytes($archivePath, $decodedArchive) | ||
} catch { | ||
Write-Error "ERROR: Failed to decode Base64 archive content: $_" | ||
exit 1 | ||
} | ||
|
||
# Extract Base64 content for pixi-pack executable | ||
$pixiPackContent = $lines[($archiveLine)..($lines.Count - 1)] -join "" | ||
$pixiPackContent = $pixiPackContent.Trim() | ||
|
||
# Decode Base64 content into the pixi-pack executable file | ||
try { | ||
$decodedPixiPack = [System.Convert]::FromBase64String($pixiPackContent) | ||
$pixiPackPath = "$TEMPDIR\pixi-pack.exe" | ||
[System.IO.File]::WriteAllBytes($pixiPackPath, $decodedPixiPack) | ||
} catch { | ||
Write-Error "Failed to decode Base64 pixi-pack content: $_" | ||
exit 1 | ||
} | ||
|
||
# Build the command with flags | ||
$arguments = @("unpack") | ||
$arguments += $args | ||
|
||
# Add the path to the archive | ||
$arguments += $archivePath | ||
|
||
& $pixiPackPath $arguments | ||
if ($LASTEXITCODE -ne 0) { | ||
Remove-Item -Path $TEMPDIR -Recurse -Force | ||
exit $LASTEXITCODE | ||
} | ||
|
||
Remove-Item -Path $TEMPDIR -Recurse -Force | ||
|
||
exit 0 | ||
|
||
__END_HEADER__ | ||
$ErrorActionPreference = "Stop" | ||
|
||
function New-TemporaryDirectory { | ||
$parent = [System.IO.Path]::GetTempPath() | ||
[string] $name = [System.Guid]::NewGuid() | ||
$tempDir = New-Item -ItemType Directory -Path (Join-Path $parent $name) | ||
return $tempDir.FullName | ||
} | ||
|
||
$TEMPDIR = New-TemporaryDirectory | ||
$USAGE = @" | ||
Usage: $($MyInvocation.MyCommand.Name) [OPTIONS] | ||
Arguments: | ||
Path to an environment packed using pixi-pack | ||
Options: | ||
-o, --output-directory <DIR> Where to unpack the environment. The environment will be unpacked into a subdirectory of this path [default: env] | ||
-e, --env-name <NAME> Name of the environment [default: env] | ||
-s, --shell <SHELL> Sets the shell [options: bash, zsh, xonsh, cmd, powershell, fish, nushell] | ||
-v, --verbose Increase logging verbosity | ||
-q, --quiet Decrease logging verbosity | ||
-h, --help Print help | ||
"@ | ||
|
||
foreach ($arg in $args) { | ||
if ($arg -eq "-h" -or $arg -eq "--help") { | ||
Write-Output $USAGE | ||
exit 0 | ||
} | ||
} | ||
|
||
# Extract the archive and pixi-pack executable, and decode them | ||
$scriptContent = Get-Content -Raw -Path $MyInvocation.MyCommand.Path | ||
$lines = $scriptContent -split "`r?`n" | ||
|
||
$headerLine = $null | ||
$archiveLine = $null | ||
|
||
# Find the lines where __END_HEADER__ and __END_ARCHIVE__ occur | ||
for ($i = 0; $i -lt $lines.Count; $i++) { | ||
if ($lines[$i] -like "*__END_HEADER__*") { | ||
$headerLine = $i + 2 | ||
} | ||
if ($lines[$i] -like "*__END_ARCHIVE__*") { | ||
$archiveLine = $i + 1 | ||
} | ||
} | ||
|
||
if (-not $headerLine -or -not $archiveLine) { | ||
Write-Error "ERROR: Markers __END_HEADER__ or __END_ARCHIVE__ not found." | ||
exit 1 | ||
} | ||
|
||
# Extract Base64 content for the tar archive | ||
$archiveContent = $lines[($headerLine)..($archiveLine - 2)] -join "" | ||
$archiveContent = $archiveContent.Trim() | ||
|
||
# Decode Base64 content into tar file | ||
try { | ||
$decodedArchive = [System.Convert]::FromBase64String($archiveContent) | ||
$archivePath = "$TEMPDIR\archive.tar" | ||
[System.IO.File]::WriteAllBytes($archivePath, $decodedArchive) | ||
} catch { | ||
Write-Error "ERROR: Failed to decode Base64 archive content: $_" | ||
exit 1 | ||
} | ||
|
||
# Extract Base64 content for pixi-pack executable | ||
$pixiPackContent = $lines[($archiveLine)..($lines.Count - 1)] -join "" | ||
$pixiPackContent = $pixiPackContent.Trim() | ||
|
||
# Decode Base64 content into the pixi-pack executable file | ||
try { | ||
$decodedPixiPack = [System.Convert]::FromBase64String($pixiPackContent) | ||
$pixiPackPath = "$TEMPDIR\pixi-pack.exe" | ||
[System.IO.File]::WriteAllBytes($pixiPackPath, $decodedPixiPack) | ||
} catch { | ||
Write-Error "Failed to decode Base64 pixi-pack content: $_" | ||
exit 1 | ||
} | ||
|
||
# Build the command with flags | ||
$arguments = @("unpack") | ||
$arguments += $args | ||
|
||
# Add the path to the archive | ||
$arguments += $archivePath | ||
|
||
& $pixiPackPath $arguments | ||
if ($LASTEXITCODE -ne 0) { | ||
Remove-Item -Path $TEMPDIR -Recurse -Force | ||
exit $LASTEXITCODE | ||
} | ||
|
||
Remove-Item -Path $TEMPDIR -Recurse -Force | ||
|
||
exit 0 | ||
|
||
__END_HEADER__ |
4 changes: 2 additions & 2 deletions
4
tests/snapshots/integration_test__sha256-linux-64-executable.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
source: tests/integration_test.rs | ||
assertion_line: 352 | ||
assertion_line: 358 | ||
expression: "&sha256_digest" | ||
snapshot_kind: text | ||
--- | ||
5A797AC80010BCFCE103F53892CDEA582C82364264CE6C4FF8EF5643F23CD3BD | ||
00FFF8329F4CCECC1BC5D5210770ABDF61DFA471288A5265D6C171BE705E416E |
4 changes: 2 additions & 2 deletions
4
tests/snapshots/integration_test__sha256-linux-aarch64-executable.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
source: tests/integration_test.rs | ||
assertion_line: 352 | ||
assertion_line: 358 | ||
expression: "&sha256_digest" | ||
snapshot_kind: text | ||
--- | ||
2D9DACCC1641D534A8B4003F121296F37D550C07B87108DFBE135D06FDD5D8A2 | ||
A54DBE60FBFE8FAC7D5334D899092DDAE7154E829F4E817ED38442FBEDC710AE |
4 changes: 2 additions & 2 deletions
4
tests/snapshots/integration_test__sha256-osx-64-executable.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
source: tests/integration_test.rs | ||
assertion_line: 352 | ||
assertion_line: 358 | ||
expression: "&sha256_digest" | ||
snapshot_kind: text | ||
--- | ||
5D75D036EA7C29A43E15755D79381827A34B3160026776AC3D5A53B2073082B8 | ||
5DD69B8319D10E1B210404C096FC2621F701EEBFAA1DB047922A249D6D34B80C |
4 changes: 2 additions & 2 deletions
4
tests/snapshots/integration_test__sha256-osx-arm64-executable.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
source: tests/integration_test.rs | ||
assertion_line: 352 | ||
assertion_line: 358 | ||
expression: "&sha256_digest" | ||
snapshot_kind: text | ||
--- | ||
906049EA301E1E033E5AF4E12630B0A0C4BDD60D7F6F05741F0A10F3638214A6 | ||
DA8DCC36D8F284F7CB4882F32C6AB7BE34A9A59BDC18839109C9F10C737B0CEE |
4 changes: 2 additions & 2 deletions
4
tests/snapshots/integration_test__sha256-win-64-executable.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
source: tests/integration_test.rs | ||
assertion_line: 366 | ||
assertion_line: 358 | ||
expression: "&sha256_digest" | ||
snapshot_kind: text | ||
--- | ||
D651688B08263EA415C95AF1298D337088953CD260BFFC1AB287D75E2F467D2A | ||
66EE65C5068E586279361987E7F3921F9159619827439946FE32A61C2A8B5C39 |