test: add Linux build E2E test scripts
Test-Ns7zipBuild-Linux.ps1: e2e test for nsis7z plugin build on Linux VM (confirmed PASS: nsis7z.dll 2272 KB in 03:09 2026-05-11) Test-NsinnounpBuild-Linux.ps1: e2e test for nsinnounp plugin build on Linux VM
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
#Requires -Version 5.1
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Runs a full end-to-end CI test build of nsis-plugin-ns7zip on the Linux template.
|
||||
|
||||
.DESCRIPTION
|
||||
Invokes Invoke-CIJob.ps1 with the ns7zip repo parameters targeting the Linux
|
||||
build template (LinuxBuild2404) and verifies the artifact was produced.
|
||||
The Linux build cross-compiles Windows DLLs via mingw-w64.
|
||||
|
||||
Exits 0 on success, 1 on failure.
|
||||
|
||||
.PARAMETER JobId
|
||||
Job identifier used for artifact and log directory names.
|
||||
Default: e2e-ns7zip-linux-<yyyyMMdd_HHmmss>
|
||||
|
||||
.PARAMETER Branch
|
||||
Branch to build. Default: main
|
||||
|
||||
.PARAMETER Commit
|
||||
Optional specific commit SHA. Default: empty (HEAD of branch).
|
||||
|
||||
.PARAMETER Config
|
||||
Plugin config to build: x86-ansi | x86-unicode | x64-unicode. Default: x64-unicode
|
||||
|
||||
.PARAMETER ZipVersion
|
||||
7-Zip version (Linux-supported subset): 25.01 | 26.00 | 26.01 | zstd. Default: 26.01
|
||||
|
||||
.PARAMETER TemplatePath
|
||||
Path to the Linux template VMX. Default: env:GITEA_CI_LINUX_TEMPLATE_PATH or
|
||||
F:\CI\Templates\LinuxBuild2404\LinuxBuild2404.vmx
|
||||
|
||||
.PARAMETER SnapshotName
|
||||
Snapshot name to clone from. Default: BaseClean-Linux
|
||||
|
||||
.PARAMETER SshKeyPath
|
||||
SSH private key for the ci_build user in the guest. Default: F:\CI\keys\ci_linux
|
||||
|
||||
.PARAMETER VerifyArtifact
|
||||
If set, expands artifacts.zip (or scans the dir) and checks that at least one DLL is present.
|
||||
Default: $true
|
||||
|
||||
.EXAMPLE
|
||||
.\Test-Ns7zipBuild-Linux.ps1
|
||||
|
||||
.\Test-Ns7zipBuild-Linux.ps1 -Config x86-unicode -ZipVersion 26.00
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string] $JobId = "e2e-ns7zip-linux-$(Get-Date -Format 'yyyyMMdd_HHmmss')",
|
||||
[string] $Branch = 'main',
|
||||
[string] $Commit = '',
|
||||
[ValidateSet('x86-ansi', 'x86-unicode', 'x64-unicode')]
|
||||
[string] $Config = 'x64-unicode',
|
||||
[ValidateSet('25.01', '26.00', '26.01', 'zstd')]
|
||||
[string] $ZipVersion = '26.01',
|
||||
[string] $TemplatePath = $(
|
||||
if ($env:GITEA_CI_LINUX_TEMPLATE_PATH) { $env:GITEA_CI_LINUX_TEMPLATE_PATH }
|
||||
else { 'F:\CI\Templates\LinuxBuild2404\LinuxBuild2404.vmx' }
|
||||
),
|
||||
[string] $SnapshotName = 'BaseClean-Linux',
|
||||
[string] $SshKeyPath = 'F:\CI\keys\ci_linux',
|
||||
[switch] $VerifyArtifact = $true
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$scriptDir = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
$orchestrator = Join-Path $scriptDir 'Invoke-CIJob.ps1'
|
||||
$artifactDir = "F:\CI\Artifacts\$JobId"
|
||||
|
||||
Write-Host "============================================================"
|
||||
Write-Host " nsis-plugin-ns7zip Linux e2e test"
|
||||
Write-Host " JobId : $JobId"
|
||||
Write-Host " Branch : $Branch"
|
||||
if ($Commit) { Write-Host " Commit : $Commit" }
|
||||
Write-Host " Config : $Config"
|
||||
Write-Host " 7-Zip ver : $ZipVersion"
|
||||
Write-Host " Template : $TemplatePath"
|
||||
Write-Host " Snapshot : $SnapshotName"
|
||||
Write-Host " Artifacts : $artifactDir"
|
||||
Write-Host "============================================================"
|
||||
Write-Host ""
|
||||
|
||||
# ns7zip Linux build copies built DLLs under plugins/<config>/nsis7z.dll
|
||||
$buildCmd = "python3 build_plugin.py --host linux --7zip-version $ZipVersion --configs $Config --verbose"
|
||||
|
||||
$params = @{
|
||||
JobId = $JobId
|
||||
RepoUrl = 'ssh://gitea-ci/Simone/nsis-plugin-ns7zip.git'
|
||||
Branch = $Branch
|
||||
TemplatePath = $TemplatePath
|
||||
SnapshotName = $SnapshotName
|
||||
Submodules = $true
|
||||
BuildCommand = $buildCmd
|
||||
GuestArtifactSource = 'plugins'
|
||||
GuestOS = 'Linux'
|
||||
SshKeyPath = $SshKeyPath
|
||||
SshUser = 'ci_build'
|
||||
}
|
||||
if ($Commit -ne '') { $params['Commit'] = $Commit }
|
||||
|
||||
$startTime = Get-Date
|
||||
$exitCode = 0
|
||||
|
||||
try {
|
||||
& $orchestrator @params
|
||||
$exitCode = $LASTEXITCODE
|
||||
}
|
||||
catch {
|
||||
Write-Host "[Test] Invoke-CIJob.ps1 threw: $_"
|
||||
$exitCode = 1
|
||||
}
|
||||
|
||||
$elapsed = (Get-Date) - $startTime
|
||||
Write-Host ""
|
||||
Write-Host "============================================================"
|
||||
|
||||
if ($exitCode -ne 0) {
|
||||
Write-Host "[Test] FAIL - Invoke-CIJob.ps1 exited $exitCode after $($elapsed.ToString('mm\:ss'))" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Verify at least one .dll arrived from the guest
|
||||
if ($VerifyArtifact) {
|
||||
if (-not (Test-Path $artifactDir)) {
|
||||
Write-Host "[Test] FAIL - artifact directory not found: $artifactDir" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
$dlls = @(Get-ChildItem -Path $artifactDir -Recurse -Filter '*.dll' -ErrorAction SilentlyContinue)
|
||||
if ($dlls.Count -eq 0) {
|
||||
Write-Host "[Test] FAIL - no .dll found under $artifactDir" -ForegroundColor Red
|
||||
Get-ChildItem -Path $artifactDir -Recurse -ErrorAction SilentlyContinue | ForEach-Object {
|
||||
Write-Host " $($_.FullName)"
|
||||
}
|
||||
exit 1
|
||||
}
|
||||
foreach ($dll in $dlls) {
|
||||
$kb = [math]::Round($dll.Length / 1KB)
|
||||
Write-Host "[Test] Artifact OK: $($dll.FullName) ($kb KB)"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "[Test] PASS - completed in $($elapsed.ToString('mm\:ss'))" -ForegroundColor Green
|
||||
exit 0
|
||||
Reference in New Issue
Block a user