feat: initial Cutdex application
Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,82 @@
|
||||
"""Build and relocate a Release smoke app; exercise no-model and configured-model startup.
|
||||
|
||||
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.
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
|
||||
def run(command, **kwargs):
|
||||
subprocess.run(list(map(str, command)), check=True, timeout=900, **kwargs)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--runtime', type=Path, required=True)
|
||||
parser.add_argument('--config', type=Path, required=True)
|
||||
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())
|
||||
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)
|
||||
with tempfile.TemporaryDirectory(prefix='cutdex relocated release ') as temporary:
|
||||
root = Path(temporary)
|
||||
app = root / 'cutdex.app'
|
||||
run(['/usr/bin/ditto', repo / 'build/macos/Build/Products/Release-production/cutdex.app', app])
|
||||
# A previous release build may have embedded a different runtime.
|
||||
embedded = app / 'Contents/Resources/processing'
|
||||
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])
|
||||
results = []
|
||||
for configured in [False, True]:
|
||||
home = root / ('with-models' if configured else 'without-models')
|
||||
home.mkdir()
|
||||
report = home / 'result.json'
|
||||
env = {'PATH': '/usr/bin:/bin', 'HOME': str(home), 'TMPDIR': str(home),
|
||||
'CUTDEX_SMOKE_REPORT': str(report), 'CUTDEX_SMOKE_MODELS': str(int(configured)),
|
||||
'CUTDEX_SMOKE_MEDIA': config['CUTDEX_ASR_FIXTURE']}
|
||||
# No CUTDEX_PROCESSING_ROOT: exercise the executable-relative Bundle default.
|
||||
if configured:
|
||||
processing = home / 'Documents/Cutdex/Resources/Processing'
|
||||
shutil.copytree(config['WHISPER_SOURCE'],
|
||||
processing / 'Transcription/whisper-turbo/1')
|
||||
shutil.copytree(config['M2M100_SOURCE'],
|
||||
processing / 'Translation/m2m100-418m/1')
|
||||
vocals = processing / 'VocalSeparation/melband/1'
|
||||
vocals.mkdir(parents=True)
|
||||
shutil.copy2(config['MELBAND_SOURCE'], vocals / 'melband.pt')
|
||||
with (home / 'app.log').open('w') as log:
|
||||
try:
|
||||
run([app / 'Contents/MacOS/cutdex'], env=env, stdout=log, stderr=subprocess.STDOUT)
|
||||
except Exception:
|
||||
print((home / 'app.log').read_text())
|
||||
if report.exists():
|
||||
print(report.read_text())
|
||||
raise
|
||||
result = json.loads(report.read_text())
|
||||
if not result['passed']:
|
||||
raise RuntimeError(result)
|
||||
results.append(result)
|
||||
args.report.parent.mkdir(parents=True, exist_ok=True)
|
||||
args.report.write_text(json.dumps(results, indent=2) + '\n')
|
||||
print('Release smoke passed: no models; three configured capabilities and real translation.')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in new issue
Block a user