refactor(build): 统一本地与 CI 构建入口及平台发布工具 (#9)
Gitea CI / Check code and tests (push) Successful in 7m38s
Gitea CI / Build Android APK (push) Successful in 6m20s
Gitea CI / Audit and package Windows x64 (push) Canceled after 0s
Gitea CI / Assemble and validate CI artifacts (push) Canceled after 0s
Gitea CI / Gitea CI passed (push) Canceled after 0s
Gitea CI / Build Windows x64 app (push) Canceled after 14m42s

This commit was merged in pull request #9.
This commit is contained in:
lingjhf committed 2026-10-06 16:14:42 +00:00
1 parent a13a54d5ec
commit 4a759d81a6
61 files changed
+1913 -388

No files matched your search

+15 -10
View File
@@ -2,19 +2,23 @@
The JSON config supplies WHISPER_SOURCE, M2M100_SOURCE, MELBAND_SOURCE and
CUTDEX_ASR_FIXTURE. Models are copied into the app-managed resource layout.
Run build_macos_release.sh afterwards to produce the normal application.
Run build_macos_release.py afterwards to produce the normal application.
"""
import argparse
import json
import os
import shutil
from pathlib import Path
import subprocess
import tempfile
import sys
from functools import partial
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from project_tools import project_environment, tool_command
from common.process import cli, run as run_command
from release import sign_app
def run(command, **kwargs):
subprocess.run(list(map(str, command)), check=True, timeout=900, **kwargs)
run = partial(run_command, timeout=900)
def main():
@@ -24,14 +28,15 @@ def main():
parser.add_argument('--report', type=Path, required=True)
args = parser.parse_args()
repo = Path(__file__).resolve().parents[2]
config = json.loads(args.config.read_text())
config = json.loads(args.config.read_text(encoding='utf-8'))
model_keys = ['WHISPER_SOURCE', 'M2M100_SOURCE', 'MELBAND_SOURCE']
for key in model_keys + ['CUTDEX_ASR_FIXTURE']:
if not Path(config[key]).is_absolute() or not Path(config[key]).exists():
raise ValueError(f'Missing absolute input path: {key}')
runtime = args.runtime.resolve()
run([os.environ.get('FLUTTER', 'flutter'), 'build', 'macos', '--release',
'--flavor=production', '--target=tool/testing/release_smoke.dart'], cwd=repo)
environment = project_environment()
run(tool_command('flutter', ['build', 'macos', '--release',
'--flavor=production', '--target=tool/testing/release_smoke.dart']), cwd=repo, env=environment)
with tempfile.TemporaryDirectory(prefix='cutdex relocated release ') as temporary:
root = Path(temporary)
app = root / 'cutdex.app'
@@ -41,8 +46,8 @@ def main():
if embedded.exists():
shutil.rmtree(embedded)
run(['/usr/bin/ditto', runtime, embedded])
run(['/bin/bash', repo / 'tool/macos/sign_macos_app.sh', app])
run([os.environ.get('PYTHON', 'python3'), repo / 'tool/macos/check_macos_release.py', '--app', app])
sign_app(app, environment=environment)
run([sys.executable, repo / 'tool/macos/check_macos_release.py', '--app', app], env=environment)
results = []
for configured in [False, True]:
home = root / ('with-models' if configured else 'without-models')
@@ -79,4 +84,4 @@ def main():
if __name__ == '__main__':
main()
sys.exit(cli(main))