-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (132 loc) · 5.14 KB
/
Copy pathdev-build-windows.yml
File metadata and controls
156 lines (132 loc) · 5.14 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Dev Build (Windows + Vosk)
on:
push:
branches: [ "**" ]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
windows-dev-build:
runs-on: windows-latest
timeout-minutes: 30
defaults:
run:
shell: pwsh
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.26.3'
- name: Setup MSYS2 (UCRT64)
id: msys2
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: >-
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-tools
- name: Check MSYS2 availability
shell: pwsh
run: |
Get-Command bash -ErrorAction SilentlyContinue
Get-Command gcc -ErrorAction SilentlyContinue
- name: Resolve MSYS2 UCRT bin
run: |
$msysRoot = "${{ steps.msys2.outputs.msys2-location }}"
$ucrtBin = Join-Path $msysRoot "ucrt64\bin"
"MSYS2_ROOT=$msysRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"MSYS2_UCRT_BIN=$ucrtBin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Write-Host "MSYS2 root: $msysRoot"
Write-Host "UCRT bin : $ucrtBin"
- name: Show tool versions
run: |
& (Join-Path $env:MSYS2_UCRT_BIN "gcc.exe") --version
& (Join-Path $env:MSYS2_UCRT_BIN "g++.exe") --version
& (Join-Path $env:MSYS2_UCRT_BIN "dlltool.exe") --version
& (Join-Path $env:MSYS2_UCRT_BIN "objdump.exe") --version
go version
- name: Build with Vosk script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./scripts/build-with-vosk.ps1 -Msys2UcrtBin $env:MSYS2_UCRT_BIN
- name: Dump build stderr on failure
if: failure()
run: |
$p = "bin/build.stderr.log"
if (Test-Path $p) {
Write-Host "===== BEGIN build.stderr.log (tail 400) ====="
Get-Content $p -Tail 4000
Write-Host "===== END build.stderr.log ====="
} else {
Write-Host "No $p found"
}
- name: Dump build stdout on failure
if: failure()
run: |
$p = "bin/build.stdout.log"
if (Test-Path $p) {
Write-Host "===== BEGIN build.stdout.log (tail 200) ====="
Get-Content $p -Tail 2000
Write-Host "===== END build.stdout.log ====="
} else {
Write-Host "No $p found"
}
- name: Extract likely linker errors on failure
if: failure()
run: |
$patterns = 'undefined reference|cannot find|-lvosk|ld\.exe|collect2|fatal error|error:|cgo:|runtime/cgo:|gcc: error|clang: error|exit status [0-9]+'
function Show-MatchesWithContext {
param(
[Parameter(Mandatory = $true)][string]$Path,
[Parameter(Mandatory = $true)][string]$Label,
[Parameter(Mandatory = $true)][string]$Pattern,
[int]$Context = 40,
[int]$MaxMatches = 5
)
if (-not (Test-Path $Path)) {
Write-Host "No $Path found"
return
}
Write-Host "===== $Label matches ====="
$hits = Select-String -Path $Path -Pattern $Pattern -CaseSensitive:$false
if (-not $hits) {
Write-Host "(no matches)"
return
}
$hits | Select-Object -Last 200 | ForEach-Object { $_.Line }
$lines = Get-Content $Path
$firstHits = $hits | Select-Object -First $MaxMatches
foreach ($h in $firstHits) {
$start = [Math]::Max(1, $h.LineNumber - $Context)
$end = [Math]::Min($lines.Count, $h.LineNumber + $Context)
Write-Host "===== $Label context around line $($h.LineNumber) ====="
for ($i = $start; $i -le $end; $i++) {
Write-Host ("{0,6}: {1}" -f $i, $lines[$i - 1])
}
}
}
Show-MatchesWithContext -Path "bin/build.stderr.log" -Label "stderr" -Pattern $patterns
Show-MatchesWithContext -Path "bin/build.stdout.log" -Label "stdout" -Pattern $patterns
- name: Prepare dev artifact bundle
run: |
$bundle = "artifact-bundle"
if (Test-Path $bundle) { Remove-Item -Recurse -Force $bundle }
New-Item -ItemType Directory -Path $bundle | Out-Null
# All files from bin go to artifact root.
Copy-Item -Path "bin/*" -Destination $bundle -Recurse -Force
Copy-Item -Path "config.json" -Destination $bundle -Force
Copy-Item -Path "user" -Destination $bundle -Recurse -Force
Copy-Item -Path "static" -Destination $bundle -Recurse -Force
Copy-Item -Path "README.md" -Destination $bundle -Force
Copy-Item -Path "LICENSE" -Destination $bundle -Force
- name: Upload dev artifact
uses: actions/upload-artifact@v4
with:
name: OmniPanel-go-windows-dev
path: artifact-bundle
if-no-files-found: warn