-
-
Notifications
You must be signed in to change notification settings - Fork 137
162 lines (143 loc) · 5.97 KB
/
Copy pathbuild-windows.yml
File metadata and controls
162 lines (143 loc) · 5.97 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
157
158
159
160
161
162
# Builds the standalone Windows zip for x86_64 and attaches it to the
# GitHub release that triggered the run.
#
# Mirrors build-linux.yml and build-macos.yml. The package bundles EVERYTHING
# (Python runtime, onnxruntime, PyAV/ffmpeg, the ONNX models, embedded
# PostgreSQL via pgserver and embedded Redis), so an installed package needs no
# Docker and no separately-installed database/broker.
#
# The small native build inputs (redis-server.exe, the unaccent/pg_trgm contrib
# modules) are built or downloaded in this workflow, then baked into the bundle
# by the shared AudioMuse-AI.spec.
#
# The ~5 GB of models are NOT in git. This workflow assembles ./model from the
# same GitHub releases the Dockerfile/macOS/Linux builds use, INCLUDING the
# HuggingFace cache (trimmed to just the roberta-base tokenizer the app actually
# loads) so the release assets stay under GitHub's 2 GB per-file limit.
name: Build standalone Windows zip
on:
push:
tags:
- 'v*.*.*' # Build on every version tag
pull_request: # Build on PRs too, to catch bundle breakage early.
types:
- opened
- reopened
- synchronize
workflow_dispatch: # Allow manual runs for testing without a release
concurrency:
group: build-windows-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
# Releases the models live on. Bump these in lockstep with the Dockerfile.
MODEL_RELEASE: v5.0.0-model
DCLAP_RELEASE: v1
jobs:
build:
# Skip draft PRs and fork PRs -- the same guard the other build workflows use.
if: >-
github.event_name != 'pull_request' ||
(github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.full_name == github.repository)
runs-on: windows-2022
permissions:
contents: read
env:
ARCH: amd64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Sanity-check runner architecture
shell: powershell
run: |
$got = (Get-WmiObject Win32_Processor).Architecture
Write-Host "CPU Architecture: $got (9=amd64, 12=arm64)"
if ($got -ne 9) {
Write-Error "Expected amd64 runner but got architecture $got"
exit 1
}
- name: Install Python dependencies
shell: powershell
run: |
python -m venv .venv-windows
.venv-windows\Scripts\activate
pip install --upgrade pip
pip install -r requirements/windows.txt
- name: Build vendored redis-server.exe
shell: cmd
run: native-build\windows\vendor\build-redis.bat
- name: Verify vendored PostgreSQL contrib is present
shell: powershell
run: |
$dest = "native-build\windows\vendor\pg-contrib\$env:ARCH"
$required = @("lib\unaccent.dll", "lib\pg_trgm.dll", "extension\unaccent.control", "extension\pg_trgm.control", "extension\unaccent--1.1.sql", "extension\pg_trgm--1.3.sql", "tsearch_data\unaccent.rules")
$bad = @()
foreach ($f in $required) {
$p = Join-Path $dest $f
if (-not (Test-Path $p) -or (Get-Item $p).Length -eq 0) { $bad += $f }
}
if ($bad.Count -ne 0) {
Write-Error "Missing or empty vendored pg-contrib files: $($bad -join ', '). Regenerate with native-build/windows/vendor/pg-contrib/build-pg-contrib-cross.sh -- never ship empty placeholders (they silently disable unaccent/pg_trgm search)."
exit 1
}
Write-Host "Vendored pg-contrib present and non-empty."
- name: Assemble ./model (mirrors the Dockerfile/macOS/Linux models stage)
shell: powershell
env:
GH_TOKEN: ${{ github.token }}
run: python scripts/standalone/assemble_model.py
- name: Verify the assembled model/ is complete
shell: powershell
run: python scripts/standalone/assemble_model.py --verify
- name: Build the bundle
shell: powershell
run: .venv-windows\Scripts\python scripts\standalone\build.py --platform windows
- name: Upload bundle as a workflow artifact
uses: actions/upload-artifact@v4
with:
name: AudioMuse-AI-${{ env.ARCH }}-windows-zip
path: dist/AudioMuse-AI/
if-no-files-found: error
# NB: the PR-description "test build links" block is written by the
# dedicated `pr-test-link.yml` workflow (which runs after this build,
# verifies the artifacts exist, and posts the consolidated link block).
# Attach the zip to the release. Runs only for tag pushes.
release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download built packages
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create zip for release
run: |
python -c "
import zipfile, pathlib, sys
# upload-artifact strips the directory pointed at by 'path:', so the
# bundle's files land directly under artifacts/ (not artifacts/AudioMuse-AI/).
src = pathlib.Path('artifacts')
out = 'AudioMuse-AI-amd64-windows.zip'
files = [f for f in sorted(src.rglob('*')) if f.is_file()]
if not files:
sys.exit('No files found under artifacts/ -- the build artifact is missing or empty; refusing to ship an empty zip')
with zipfile.ZipFile(out, 'w', zipfile.ZIP_DEFLATED, allowZip64=True) as zf:
for f in files:
zf.write(f, 'AudioMuse-AI/' + f.relative_to(src).as_posix())
print(f'Created {out} with {len(files)} files')
"
- name: Attach packages to the release
uses: softprops/action-gh-release@v2
with:
files: AudioMuse-AI-*-windows.zip
fail_on_unmatched_files: true