فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

ci(a08): preserve NSIS and support SHA-pinned targeted WebView2 reruns

Davood Mehraban committed Nov 23, 2026 at 18:42 UTC 1e104a31cf7bee00b3dda3ed053970e6896e05cf
3 files changed +107
.github/workflows/a08-targeted-native-reuse.yml new
+64
@@ -0,0 +1,64 @@
1 +name: A08 targeted installed Windows benchmark (reuse NSIS)
2 +on:
3 + workflow_dispatch:
4 + inputs:
5 + artifact_run_id:
6 + description: 'Native Windows workflow run holding candidate NSIS from this exact commit'
7 + required: true
8 + type: string
9 + expected_version:
10 + description: 'Candidate installer version from that run'
11 + required: true
12 + type: string
13 +permissions:
14 + contents: read
15 + actions: read
16 +jobs:
17 + targeted-native-a08:
18 + runs-on: windows-latest
19 + timeout-minutes: 35
20 + steps:
21 + - uses: actions/checkout@v4
22 + with:
23 + persist-credentials: false
24 + - uses: actions/setup-node@v4
25 + with:
26 + node-version: '22'
27 + - name: Verify artifact source SHA and workflow identity
28 + shell: pwsh
29 + env:
30 + GH_TOKEN: ${{ github.token }}
31 + SOURCE_RUN: ${{ inputs.artifact_run_id }}
32 + EXPECTED_VERSION: ${{ inputs.expected_version }}
33 + run: |
34 + if ($env:SOURCE_RUN -notmatch '^[0-9]+$') { throw 'Invalid source run ID' }
35 + if ($env:EXPECTED_VERSION -notmatch '^\d+\.\d+\.\d+$') { throw 'Invalid candidate version' }
36 + $run=gh api "repos/$env:GITHUB_REPOSITORY/actions/runs/$env:SOURCE_RUN" | ConvertFrom-Json
37 + if ($run.head_sha -ne $env:GITHUB_SHA -or $run.status -ne 'completed' -or
38 + $run.path -notmatch 'windows-vm-native-lab.yml') {
39 + throw 'Source must be a completed native lab run on exactly this commit'
40 + }
41 + Write-Host ("Verified candidate run "+$run.html_url+" SHA "+$run.head_sha)
42 + - name: Reuse already-built candidate NSIS
43 + uses: actions/download-artifact@v4
44 + with:
45 + run-id: ${{ inputs.artifact_run_id }}
46 + github-token: ${{ github.token }}
47 + name: phase-a-native-candidate-nsis
48 + path: test-installer
49 + - name: Run only real installed WebView2 A08 10k/50k benchmark
50 + shell: pwsh
51 + env:
52 + EXPECTED_VERSION: ${{ inputs.expected_version }}
53 + run: |
54 + $files=@(Get-ChildItem test-installer -Recurse -Filter '*x64-setup.exe')
55 + if ($files.Count -ne 1) { throw 'Expected exactly one reused NSIS installer' }
56 + ./scripts/windows-vm-targeted-a08.ps1 -Installer $files[0].FullName -ExpectedVersion $env:EXPECTED_VERSION
57 + - name: Upload targeted native A08 evidence
58 + if: always()
59 + uses: actions/upload-artifact@v4
60 + with:
61 + name: a08-targeted-installed-webview2-evidence
62 + path: ${{ runner.temp }}/factor-a08-targeted-native/reports/*.json
63 + retention-days: 14
64 + if-no-files-found: warn
.github/workflows/windows-vm-native-lab.yml
+7
@@ -113,6 +113,13 @@ jobs:
113 }
114 if ($installer.Length -lt 500000) { throw 'Native installer is suspiciously small' }
115 (Get-FileHash $installer.FullName -Algorithm SHA256) | Format-List
116 + - name: Preserve candidate installer for SHA-pinned targeted native reruns
117 + uses: actions/upload-artifact@v4
118 + with:
119 + name: phase-a-native-candidate-nsis
120 + path: src-tauri/target/release/bundle/nsis/*x64-setup.exe
121 + retention-days: 14
122 + if-no-files-found: error
123 - name: Install released 2.0.3, launch real native WebView2 and upgrade in place
124 shell: pwsh
125 run: |
scripts/windows-vm-targeted-a08.ps1 new
+36
@@ -0,0 +1,36 @@
1 +# Disposable Windows runner: run only the installed native A08 benchmark using an existing NSIS artifact.
2 +[CmdletBinding()]
3 +param([Parameter(Mandatory=$true)][string]$Installer,
4 + [Parameter(Mandatory=$true)][string]$ExpectedVersion)
5 +$ErrorActionPreference='Stop'
6 +if ($env:GITHUB_ACTIONS -ne 'true' -or $env:RUNNER_OS -ne 'Windows') {
7 + throw 'Targeted native test is restricted to disposable Windows GitHub Actions runners'
8 +}
9 +if ($ExpectedVersion -notmatch '^\d+\.\d+\.\d+$') { throw 'Invalid expected version' }
10 +$installerFile=Get-Item -LiteralPath $Installer
11 +if ($installerFile.Length -lt 500000 -or $installerFile.Name -notlike "*$ExpectedVersion*x64-setup.exe") {
12 + throw 'Installer size/name/version mismatch'
13 +}
14 +$lab=Join-Path $env:RUNNER_TEMP 'factor-a08-targeted-native'
15 +$install=Join-Path $lab 'installed'
16 +$profile=Join-Path $lab 'profile'
17 +$reports=Join-Path $lab 'reports'
18 +New-Item -ItemType Directory -Force $install,$profile,$reports | Out-Null
19 +$report=Join-Path $reports 'benchmark-native-result.json'
20 +$proc=Start-Process -FilePath $installerFile.FullName -ArgumentList @('/S',("/D="+$install)) -PassThru
21 +try {
22 + if (!$proc.WaitForExit(150000)) { $proc.Kill(); throw 'NSIS installation timeout' }
23 + if ($proc.ExitCode -ne 0) { throw "NSIS install failed: $($proc.ExitCode)" }
24 +} finally { $proc.Dispose() }
25 +$exe=@(Get-ChildItem $install -Recurse -File | Where-Object { $_.Name -in @('app.exe','Factor-easyPro.exe') })
26 +if ($exe.Count -ne 1 -or $exe[0].Length -lt 300000) { throw 'Installed native executable not verified' }
27 +& node tests/windows-vm-installed-tauri-cdp.cjs $exe[0].FullName $profile benchmark $ExpectedVersion $report
28 +if ($LASTEXITCODE -ne 0) { throw 'Installed WebView2 A08 benchmark failed' }
29 +$result=Get-Content $report -Raw | ConvertFrom-Json
30 +if ($result.status -ne 'PASSED' -or $result.installedNativeTauri -ne $true -or
31 + $result.nativePerformance.products -ne 10000 -or
32 + $result.nativePerformance.invoices -ne 50000 -or
33 + $result.nativePerformance.companyInvoices -ne 50000) {
34 + throw 'Targeted A08 acceptance incomplete'
35 +}
36 +Write-Host 'Installed native A08 10k/50k benchmark PASSED'