Skip to content

Commit 4bd99dc

Browse files
committed
build(windows): include pinned runtime notices in verified preview
1 parent 3c6fcdd commit 4bd99dc

4 files changed

Lines changed: 6259 additions & 1 deletion

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Package verified Windows preview
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
source_run_id:
6+
description: Successful Windows native dictation run containing the tested preview
7+
required: true
8+
default: '34675859921'
9+
type: string
10+
push:
11+
branches: [feat/windows-native-dictation]
12+
paths:
13+
- '.github/workflows/windows-package-verified.yml'
14+
permissions:
15+
contents: read
16+
jobs:
17+
package:
18+
runs-on: windows-2025
19+
timeout-minutes: 10
20+
env:
21+
SOURCE_RUN: ${{ inputs.source_run_id || '34675859921' }}
22+
GH_TOKEN: ${{ github.token }}
23+
steps:
24+
- uses: actions/checkout@v6
25+
with:
26+
fetch-depth: 0
27+
- name: Verify the source build and unchanged native implementation
28+
shell: pwsh
29+
run: |
30+
if ($env:SOURCE_RUN -notmatch '^\d+$') { throw 'Invalid source run' }
31+
$run = gh api "repos/$env:GITHUB_REPOSITORY/actions/runs/$env:SOURCE_RUN" | ConvertFrom-Json
32+
if ($run.conclusion -ne 'success' -or $run.head_repository.full_name -ne $env:GITHUB_REPOSITORY -or $run.name -ne 'Windows native dictation') { throw 'Source build was not successfully validated' }
33+
$changed = git diff --name-only $run.head_sha HEAD -- src packaging/windows/setup-models.ps1 packaging/windows/models.json packaging/windows/build-funasr.ps1
34+
if ($LASTEXITCODE -ne 0 -or $changed) { throw "Native implementation changed; run the full inference workflow first: $changed" }
35+
"SOURCE_COMMIT=$($run.head_sha)" >> $env:GITHUB_ENV
36+
- uses: actions/download-artifact@v5
37+
with:
38+
name: VocoType-Windows-x64-preview
39+
path: verified-input
40+
run-id: ${{ env.SOURCE_RUN }}
41+
github-token: ${{ github.token }}
42+
- name: Add notices without changing tested binaries
43+
shell: pwsh
44+
run: |
45+
$archive = @(Get-ChildItem verified-input -Filter '*.zip')
46+
if ($archive.Count -ne 1) { throw 'Expected exactly one tested portable archive' }
47+
Expand-Archive $archive[0].FullName -DestinationPath stage
48+
$root = (Resolve-Path stage).Path
49+
$metadata = Get-Content stage/build-info.json -Raw | ConvertFrom-Json
50+
if ($metadata.git_commit -ne $env:SOURCE_COMMIT) { throw 'Archive source metadata mismatch' }
51+
foreach ($entry in Get-Content stage/SHA256SUMS) {
52+
if ($entry -notmatch '^([a-f0-9]{64}) (.+)$') { throw 'Invalid original checksum manifest' }
53+
$expected = $Matches[1]; $path = Join-Path $root $Matches[2]
54+
if (-not ([IO.Path]::GetFullPath($path).StartsWith($root + [IO.Path]::DirectorySeparatorChar))) { throw 'Unsafe manifest path' }
55+
if ((Get-FileHash $path -Algorithm SHA256).Hash.ToLowerInvariant() -ne $expected) { throw "Source checksum mismatch: $path" }
56+
}
57+
$before = @{}
58+
Get-ChildItem stage -Recurse -File | Where-Object Extension -in '.exe', '.dll' | ForEach-Object { $before[$_.FullName] = (Get-FileHash $_.FullName -Algorithm SHA256).Hash }
59+
New-Item -ItemType Directory -Force stage/share/licenses | Out-Null
60+
Copy-Item resources/licenses/windows-runtime/* stage/share/licenses -Force
61+
if (Test-Path stage/licenses) { Copy-Item stage/licenses/* stage/share/licenses -Force; Remove-Item stage/licenses -Recurse }
62+
Copy-Item docs/integrations/windows.md stage/README.md -Force
63+
$metadata | Add-Member -NotePropertyName packaging_git_commit -NotePropertyValue $env:GITHUB_SHA
64+
$metadata | Add-Member -NotePropertyName validated_inference_run -NotePropertyValue $env:SOURCE_RUN
65+
$metadata | ConvertTo-Json | Set-Content stage/build-info.json -Encoding utf8NoBOM
66+
foreach ($file in $before.Keys) { if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $before[$file]) { throw 'Tested executable or DLL changed' } }
67+
./stage/vocotype-windows.exe --self-test
68+
if ($LASTEXITCODE) { throw 'Packaged executable failed' }
69+
./stage/vocotype-offline-worker.exe --help
70+
if ($LASTEXITCODE) { throw 'Packaged native runtime failed' }
71+
Get-ChildItem stage -Recurse -File | Where-Object Name -ne 'SHA256SUMS' | Sort-Object FullName | ForEach-Object { "$((Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant()) $([IO.Path]::GetRelativePath($root, $_.FullName))" } | Set-Content stage/SHA256SUMS -Encoding utf8NoBOM
72+
New-Item -ItemType Directory -Force dist | Out-Null
73+
Compress-Archive stage/* "dist/VocoType-Windows-x64-preview-$($env:GITHUB_SHA.Substring(0,7)).zip"
74+
Copy-Item verified-input/real-asr-report.json dist/
75+
Get-FileHash dist/*.zip -Algorithm SHA256 | Format-List
76+
- uses: actions/upload-artifact@v7
77+
with:
78+
name: VocoType-Windows-x64-preview
79+
path: dist/*
80+
if-no-files-found: error

packaging/windows/package-preview.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ Copy-Item "$root/docs/integrations/windows.md" "$Destination/README.md" -Force
1616
Copy-Item "$root/LICENSE" "$Destination/LICENSE.txt" -Force
1717
Copy-Item "$root/THIRD_PARTY_NOTICES.md" $Destination -Force
1818
# Include dependency notices from vcpkg; no test helper executables are shipped.
19-
$notices = "$Destination/licenses"
19+
$notices = "$Destination/share/licenses"
2020
New-Item -ItemType Directory -Force $notices | Out-Null
21+
Copy-Item "$root/resources/licenses/windows-runtime/*" $notices -Force
2122
Get-ChildItem "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows/share" -Recurse -Filter copyright | ForEach-Object { Copy-Item $_.FullName "$notices/$($_.Directory.Name).txt" -Force }
2223
# Include the MSVC runtime app-locally when the redistributable files are present.
2324
$vswhere = "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Microsoft Corporation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)