-
Notifications
You must be signed in to change notification settings - Fork 7
89 lines (74 loc) · 3.67 KB
/
Copy pathtest-winget.yml
File metadata and controls
89 lines (74 loc) · 3.67 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Test Winget Manifests
on:
push:
branches: [main]
paths:
- 'tools/*/packaging/winget/**'
jobs:
test-cfl:
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
# Version manifest
$content = Get-Content "tools/cfl/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 "tools/cfl/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
$content = Get-Content "tools/cfl/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 "Validating cfl winget manifest..."
winget validate --manifest $testDir/
if ($LASTEXITCODE -ne 0) {
Write-Error "Manifest validation failed"
exit 1
}
Write-Host "Manifest validation passed!"
test-jtk:
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
# Version manifest
$content = Get-Content "tools/jtk/packaging/winget/OpenCLICollective.jira-ticket-cli.yaml" -Raw
$content = $content -replace "0\.0\.0", $testVersion
Set-Content "$testDir/OpenCLICollective.jira-ticket-cli.yaml" $content -Encoding UTF8
# Locale manifest
$content = Get-Content "tools/jtk/packaging/winget/OpenCLICollective.jira-ticket-cli.locale.en-US.yaml" -Raw
$content = $content -replace "0\.0\.0", $testVersion
Set-Content "$testDir/OpenCLICollective.jira-ticket-cli.locale.en-US.yaml" $content -Encoding UTF8
# Installer manifest
$content = Get-Content "tools/jtk/packaging/winget/OpenCLICollective.jira-ticket-cli.installer.yaml" -Raw
$content = $content -replace "0\.0\.0", $testVersion
$content = $content -replace 'CHECKSUM_AMD64_PLACEHOLDER', $testHash1
$content = $content -replace 'CHECKSUM_ARM64_PLACEHOLDER', $testHash2
Set-Content "$testDir/OpenCLICollective.jira-ticket-cli.installer.yaml" $content -Encoding UTF8
Write-Host "Validating jtk winget manifest..."
winget validate --manifest $testDir/
if ($LASTEXITCODE -ne 0) {
Write-Error "Manifest validation failed"
exit 1
}
Write-Host "Manifest validation passed!"