-
Notifications
You must be signed in to change notification settings - Fork 3
133 lines (113 loc) · 4.7 KB
/
build.yml
File metadata and controls
133 lines (113 loc) · 4.7 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
name: Build
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
artifact: OpenCut-Server-Windows
- os: ubuntu-latest
artifact: OpenCut-Server-Linux
- os: macos-latest
artifact: OpenCut-Server-macOS
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install ffmpeg (macOS)
if: runner.os == 'macOS'
run: brew install ffmpeg
- name: Install ffmpeg (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Install ffmpeg (Windows)
if: runner.os == 'Windows'
run: choco install ffmpeg -y --no-progress
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install -e ".[standard]"
- name: Lint with ruff
run: |
pip install ruff
ruff check opencut/ --select E,F,I --ignore E501,E402
- name: Run tests with coverage
run: |
pip install pytest-cov
python -m pytest tests/ -v --tb=short --cov=opencut --cov-report=term-missing --cov-fail-under=50
- name: Check version sync
run: python scripts/sync_version.py --check
- name: Smoke test imports
run: |
python -c "from opencut.server import create_app; app = create_app(); print('Server OK')"
python -c "from opencut.security import get_csrf_token; print('Security OK')"
python -c "from opencut.jobs import _new_job; print('Jobs OK')"
python -c "from opencut.workers import get_pool, JobPriority; print('Workers OK')"
python -c "from opencut.core.repeat_detect import detect_repeated_takes; print('Core OK')"
python -c "from opencut.core.nlp_command import parse_command; print('NLP OK')"
python -c "from opencut.mcp_server import MCP_TOOLS; print(f'MCP: {len(MCP_TOOLS)} tools')"
python -c "from opencut.cli import cli; print(f'CLI: {len(cli.commands)} commands')"
python -c "from opencut.schemas import WorkflowResult; print('Schemas OK')"
- name: Build with PyInstaller
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
run: pyinstaller opencut_server.spec
- name: Archive build output
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist/OpenCut-Server/
- name: Build Windows installer (Inno Setup)
if: runner.os == 'Windows' && (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch')
shell: pwsh
run: |
$iscc = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
if (-not (Test-Path $iscc)) {
choco install innosetup -y --no-progress
}
# The .iss script expects ffmpeg binaries in a local ffmpeg/
# folder. CI installed ffmpeg via choco into PATH — copy the
# exes into place so ISCC can bundle them.
New-Item -ItemType Directory -Force -Path ffmpeg | Out-Null
$ff = (Get-Command ffmpeg.exe -ErrorAction Stop).Source
$fp = (Get-Command ffprobe.exe -ErrorAction Stop).Source
Copy-Item $ff ffmpeg/ffmpeg.exe -Force
Copy-Item $fp ffmpeg/ffprobe.exe -Force
& $iscc OpenCut.iss
Get-ChildItem installer/dist
- name: Archive Windows installer
if: runner.os == 'Windows' && (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch')
uses: actions/upload-artifact@v4
with:
name: OpenCut-Setup-Windows
path: installer/dist/OpenCut-Setup-*.exe
- name: Upload to release
if: startsWith(github.ref, 'refs/tags/')
run: |
cd dist
tar -czf ${{ matrix.artifact }}.tar.gz OpenCut-Server/
gh release upload ${{ github.ref_name }} ${{ matrix.artifact }}.tar.gz --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
- name: Upload installer to release
if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
gh release upload ${{ github.ref_name }} installer/dist/OpenCut-Setup-*.exe --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}