Repository navigation
181 lines (176 loc) · 7.74 KB
/
Copy pathci.yml
File metadata and controls
181 lines (176 loc) · 7.74 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: ci
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [main]
permissions: {}
# Only superseded PR checks may be canceled; main runs stay independent.
concurrency:
group: ci-${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
ci:
# Draft PRs are skipped (reported as passing); marking one ready runs CI.
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
timeout-minutes: 8
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# The whole history, so the secret scan sees every commit of the change.
fetch-depth: 0
persist-credentials: false
# Release binaries pinned by version and SHA-256; Dependabot does not update them.
- name: Install actionlint, zizmor and betterleaks
run: |
mkdir -p "$RUNNER_TEMP/tools"
cd "$RUNNER_TEMP/tools"
while read -r sha name url; do
curl -fsSL --retry 3 -o tool.tar.gz "$url"
echo "$sha tool.tar.gz" | sha256sum --check --quiet
tar -xzf tool.tar.gz "$name"
done <<'EOF'
8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 actionlint https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz
e65324f4430c2717591937edcec90ccbefaf14c174f8ec9415e03ca875b46e1a zizmor https://github.com/zizmorcore/zizmor/releases/download/v1.30.1/zizmor-x86_64-unknown-linux-gnu.tar.gz
f8b185a39ffcece2a1ca82bf3a4e7435cd81963ffd16b7a9128daf75f35f6de7 betterleaks https://github.com/betterleaks/betterleaks/releases/download/v1.9.0/betterleaks_1.9.0_linux_x64.tar.gz
EOF
echo "$RUNNER_TEMP/tools" >> "$GITHUB_PATH"
- name: Lint workflows (actionlint)
run: actionlint
- name: Audit workflows (zizmor)
run: zizmor --config .github/zizmor.yml --format github .github/
env:
GH_TOKEN: ${{ github.token }}
- name: Scan the tested change for secrets (betterleaks)
# Every commit of a pull request, or every commit a push added; a new branch's first push
# has no previous commit, so the tested commit's history is scanned whole.
run: |
if [ -n "$BASE" ]; then range="$BASE..$HEAD_SHA"
elif [ -n "$BEFORE" ] && [ "$BEFORE" != 0000000000000000000000000000000000000000 ]; then range="$BEFORE..$HEAD_SHA"
else range=$HEAD_SHA; fi
betterleaks git --no-banner --redact --log-opts="$range" .
env:
BASE: ${{ github.event.pull_request.base.sha }}
BEFORE: ${{ github.event.before }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: jdx/mise-action@08ae2a091c038e1e05ec6f5115dc5c69d5a2a6b8 # v5.1.2
with:
cache: false
- name: Check each Python package
run: |
for package in bench worker; do
(
cd "$package"
# The quick checks leave the worker's models out.
if [ "$package" = worker ]; then export UV_NO_GROUP=ml; fi
uv sync --locked
uv run ruff format --check .
uv run ruff check .
uv run pytest -q
)
done
(cd bench && uv run vebench tables --check)
# After the Python packages: check-gen runs the worker's model generator.
- name: Check the TypeScript workspace
run: |
pnpm install --frozen-lockfile
pnpm lint
pnpm knip
pnpm typecheck
pnpm test
pnpm check-gen
# The renderer on macOS (Apple silicon) and on Windows, with each one's pinned
# FFmpeg: the engine tests, then a synthetic edit scored by vebench. On Windows also the rest of
# the workspace, the worker and the page as `mise run start` starts it.
platforms:
name: ${{ matrix.check }}
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
strategy:
fail-fast: false
matrix:
include:
- check: macos
runner: macos-latest
timeout: 15
- check: windows
runner: windows-latest
timeout: 35
runs-on: ${{ matrix.runner }}
timeout-minutes: ${{ matrix.timeout }}
permissions:
contents: read
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: jdx/mise-action@08ae2a091c038e1e05ec6f5115dc5c69d5a2a6b8 # v5.1.2
with:
cache: false
- name: Test the engine
run: |
pnpm install --frozen-lockfile
pnpm --filter @video-editor/engine test
# Paths, processes and the start script differ on Windows, so the rest of the workspace is
# tested there too.
- name: Test the other packages
if: runner.os == 'Windows'
run: pnpm --filter '!@video-editor/engine' -r test
- name: Check the worker
if: runner.os == 'Windows'
working-directory: worker
env:
UV_NO_GROUP: ml
run: |
uv sync --locked
uv run ruff format --check .
uv run ruff check .
uv run pytest -q
# From the checkout to the page answering, as `mise run start` does it for a new user: the
# packages, the analysis environment with its CPU PyTorch, the build and the server.
- name: Start the page
if: runner.os == 'Windows'
run: |
mise run start --no-open > "$RUNNER_TEMP/start.log" 2>&1 &
start=$!
until grep -q "the page is at" "$RUNNER_TEMP/start.log"; do
kill -0 "$start" 2>/dev/null || { cat "$RUNNER_TEMP/start.log"; exit 1; }
sleep 1
done
cat "$RUNNER_TEMP/start.log"
curl -fsS http://127.0.0.1:3000/api/key
uv run --project worker python -c \
"import torch; assert torch.version.cuda is None, torch.version.cuda; print(torch.__version__)"
# The model weights the ml tests download, kept between runs; a change to the worker's code
# starts from the last cache and adds what changed.
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
if: runner.os == 'Windows'
with:
path: |
~/.cache/huggingface
~/.cache/torch
~/.cache/video-editor/deepfilternet3-*
key: ml-models-${{ runner.os }}-${{ hashFiles('worker/src/vework/**/*.py') }}
restore-keys: ml-models-${{ runner.os }}-
# The tests with real model weights, in the environment the page just set up; the speech
# model's (3.6 GB with its aligner) are left to local runs.
- name: Test the worker's models
if: runner.os == 'Windows'
working-directory: worker
run: uv run pytest -q -m "ml and not big"
# copy-joined is the `-c copy` join the engine is measured against; every other run must
# have no clicks and under 10 ms of drift.
- name: Render a synthetic edit and score it (vebench)
run: |
node packages/engine/scripts/synthetic-edit.ts "$RUNNER_TEMP/edit" --width 320 --height 180
cd bench
uv sync --locked
uv run vebench report "$RUNNER_TEMP/edit" | tee "$RUNNER_TEMP/report.json"
jq -e 'del(.["copy-joined"]) | length == 2 and all(.[];
.errors == [] and .missing == [] and .render.clicks == 0 and .render.max_abs_drift_ms < 10)' \
"$RUNNER_TEMP/report.json"