This repository was archived by the owner on Feb 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
60 lines (50 loc) · 2.28 KB
/
test-winget.yml
File metadata and controls
60 lines (50 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Test Winget Manifest
on:
pull_request:
paths:
- 'packaging/winget/**'
- '.github/workflows/test-winget.yml'
push:
branches: [main]
paths:
- 'packaging/winget/**'
- '.github/workflows/test-winget.yml'
jobs:
validate-winget:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Validate manifest schema
shell: pwsh
run: |
$testDir = "winget-validate-test"
$testVersion = "0.0.1"
$testHash1 = "0000000000000000000000000000000000000000000000000000000000000001"
$testHash2 = "0000000000000000000000000000000000000000000000000000000000000002"
New-Item -ItemType Directory -Path $testDir -Force | Out-Null
# Read actual templates and substitute placeholders for validation
Write-Host "Reading and processing actual template files..."
# Version manifest
$content = Get-Content "packaging/winget/OpenCLICollective.cfl.yaml" -Raw
$content = $content -replace "0\.0\.0", $testVersion
Set-Content "$testDir/OpenCLICollective.cfl.yaml" $content -Encoding UTF8
# Locale manifest
$content = Get-Content "packaging/winget/OpenCLICollective.cfl.locale.en-US.yaml" -Raw
$content = $content -replace "0\.0\.0", $testVersion
Set-Content "$testDir/OpenCLICollective.cfl.locale.en-US.yaml" $content -Encoding UTF8
# Installer manifest (substitute version and checksums)
$content = Get-Content "packaging/winget/OpenCLICollective.cfl.installer.yaml" -Raw
$content = $content -replace "0\.0\.0", $testVersion
$regex = [regex]"0{64}"
$content = $regex.Replace($content, $testHash1, 1)
$content = $regex.Replace($content, $testHash2, 1)
Set-Content "$testDir/OpenCLICollective.cfl.installer.yaml" $content -Encoding UTF8
Write-Host "Generated test manifests:"
Get-ChildItem $testDir | ForEach-Object { Write-Host " $_" }
Write-Host "`nValidating winget manifest schema..."
winget validate --manifest $testDir/
if ($LASTEXITCODE -ne 0) {
Write-Error "Manifest schema validation failed"
exit 1
}
Write-Host "Manifest schema validation passed!"