The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.
TypeScript agent-skillsagentic-aiai-agentsai-videobyokclaude-codecodexdeepseek-harnessdsh-plugingenerative-ailocal-firstmcpmotionmotion-graphicsmultimodalopenmotionreverse-engineeringvideo-editingvideo-generationworkbuddy
[OPEND-4851] fix(ci): cache rendering package downloads (#244)
open-design-crew[bot]e796ace0ad94
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex cbebd710..30ba0d86 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -83,6 +83,14 @@ jobs:node-version: '26.11.1'cache: npmcache-dependency-path: package-lock.json+ - name: Restore rendering package downloads+ uses: actions/cache@v4+ with:+ path: ${{ runner.temp }}/motion-rendering-apt/*.deb+ # Cache entries are immutable, so save under a per-run key and restore the newest entry by prefix.+ key: rendering-apt-ubuntu24.04-${{ runner.arch }}-zip-unzip-ffmpeg-fonts-noto-core-${{ github.run_id }}-${{ github.run_attempt }}+ restore-keys: |+ rendering-apt-ubuntu24.04-${{ runner.arch }}-zip-unzip-ffmpeg-fonts-noto-core-- name: Install rendering test toolsrun: |# The hosted Ubuntu image provides Chrome; Ubuntu's chromium package pulls a desktop snap.@@ -94,9 +102,15 @@ jobs:fidoneif ((${#missing[@]})); then- apt_options=(-o Acquire::Retries=2 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30)- sudo apt-get "${apt_options[@]}" update- sudo apt-get "${apt_options[@]}" install -y --no-install-recommends "${missing[@]}"+ mkdir -p "$RUNNER_TEMP/motion-rendering-apt/partial"+ apt_options=(-o Acquire::Retries=2 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30+ -o "Dir::Cache::archives=$RUNNER_TEMP/motion-rendering-apt" -o APT::Keep-Downloaded-Packages=true)+ # Hosted runners already have package indexes. Refresh only if installation needs it.+ if ! sudo apt-get "${apt_options[@]}" install -y --no-install-recommends "${missing[@]}"; then+ sudo apt-get "${apt_options[@]}" update+ sudo apt-get "${apt_options[@]}" install -y --no-install-recommends "${missing[@]}"+ fi+ du -sh "$RUNNER_TEMP/motion-rendering-apt/"*.debfi- name: Validate manual package selectionenv:diff --git a/.github/workflows/motion-candidate.yml b/.github/workflows/motion-candidate.ymlindex 994d0d1f..2035deba 100644--- a/.github/workflows/motion-candidate.yml+++ b/.github/workflows/motion-candidate.yml@@ -61,6 +61,14 @@ jobs:run: |node control/.github/scripts/motion-scan.mjs install "$RUNNER_TEMP/scanner"node control/.github/scripts/motion-scan.mjs source source "$RUNNER_TEMP/source-scan.json" "$RUNNER_TEMP/scanner/gitleaks"+ - name: Restore rendering package downloads+ uses: actions/cache@v4+ with:+ path: ${{ runner.temp }}/motion-rendering-apt/*.deb+ # Cache entries are immutable, so save under a per-run key and restore the newest entry by prefix.+ key: rendering-apt-ubuntu24.04-${{ runner.arch }}-zip-unzip-ffmpeg-fonts-noto-core-${{ github.run_id }}-${{ github.run_attempt }}+ restore-keys: |+ rendering-apt-ubuntu24.04-${{ runner.arch }}-zip-unzip-ffmpeg-fonts-noto-core-- name: Install rendering test toolsrun: |# The hosted Ubuntu image provides Chrome; avoid Ubuntu's desktop Chromium snap.@@ -72,9 +80,15 @@ jobs:fidoneif ((${#missing[@]})); then- apt_options=(-o Acquire::Retries=2 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30)- sudo apt-get "${apt_options[@]}" update- sudo apt-get "${apt_options[@]}" install -y --no-install-recommends "${missing[@]}"+ mkdir -p "$RUNNER_TEMP/motion-rendering-apt/partial"+ apt_options=(-o Acquire::Retries=2 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30+ -o "Dir::Cache::archives=$RUNNER_TEMP/motion-rendering-apt" -o APT::Keep-Downloaded-Packages=true)+ # Hosted runners already have package indexes. Refresh only if installation needs it.+ if ! sudo apt-get "${apt_options[@]}" install -y --no-install-recommends "${missing[@]}"; then+ sudo apt-get "${apt_options[@]}" update+ sudo apt-get "${apt_options[@]}" install -y --no-install-recommends "${missing[@]}"+ fi+ du -sh "$RUNNER_TEMP/motion-rendering-apt/"*.debfi- name: Check the selected sourceworking-directory: sourcediff --git a/tests/release-workflows.test.mjs b/tests/release-workflows.test.mjsindex 0db9aa77..ef1f0b54 100644--- a/tests/release-workflows.test.mjs+++ b/tests/release-workflows.test.mjs@@ -310,30 +310,50 @@ test('each manual entry accepts only feature/motion before checkout or publicati}});-test('rendering tools reuse installed packages, bound apt networking and stop on installation failure', async t => {+test('rendering tools reuse packages and indexes, refresh stale indexes once, and preserve failures', async t => {const directory = await mkdtemp(path.join(os.tmpdir(), 'motion-render-tools-'));t.after(() => rm(directory, { recursive: true, force: true }));- const workflow = await readFile(new URL('../.github/workflows/motion-candidate.yml', import.meta.url), 'utf8');- const step = workflow.split(' - name: Install rendering test tools\n')[1].split('\n - name: ')[0];- const script = step.split(' run: |\n')[1].split('\n').map(line => line.replace(/^ {10}/, '')).join('\n');const calls = path.join(directory, 'apt-calls');const mock = `dpkg-query() { if [[ "$MISSING_FONT" == 1 && "$*" == *fonts-noto-core* ]]; then return 1; fi; printf 'install ok installed'; }-sudo() { printf '%s\\n' "$*" >> "$APT_CALLS"; [[ "$FAIL_APT" != 1 ]]; }`;- const env = { ...process.env, APT_CALLS: calls, HYPERFRAMES_BROWSER_PATH: '/usr/bin/true', FAIL_APT: '0' };- for (const missing of ['0', '1']) {- await writeFile(calls, '');- await runFile('bash', ['-e', '-o', 'pipefail', '-c', mock + '\n' + script], { env: { ...env, MISSING_FONT: missing } });- const commands = (await readFile(calls, 'utf8')).trim().split('\n').filter(Boolean);- assert.equal(commands.length, missing === '1' ? 2 : 0);- if (missing === '1') {+sudo() {+ printf '%s\\n' "$*" >> "$APT_CALLS"+ case "$FAIL_APT" in+ first) if [[ $(wc -l < "$APT_CALLS") -eq 1 ]]; then return 1; fi ;;+ always) return 1 ;;+ install) if [[ "$*" == *' install '* ]]; then return 1; fi ;;+ esac+ if [[ "$*" == *' install '* ]]; then touch "$RUNNER_TEMP/motion-rendering-apt/fixture.deb"; fi+}`;+ const env = { ...process.env, APT_CALLS: calls, HYPERFRAMES_BROWSER_PATH: '/usr/bin/true', RUNNER_TEMP: directory };+ for (const name of ['ci', 'motion-candidate']) {+ const workflow = await readFile(new URL(`../.github/workflows/${name}.yml`, import.meta.url), 'utf8');+ const step = workflow.split(' - name: Install rendering test tools\n')[1].split('\n - name: ')[0];+ assert.match(workflow, /path: \$\{\{ runner.temp \}\}\/motion-rendering-apt/);+ const cacheStep = workflow.split(' - name: Restore rendering package downloads\n')[1].split('\n - name: ')[0];+ const keyPrefix = 'rendering-apt-ubuntu24.04-${{ runner.arch }}-zip-unzip-ffmpeg-fonts-noto-core-';+ assert(cacheStep.includes(`key: ${keyPrefix}\${{ github.run_id }}-\${{ github.run_attempt }}\n`), 'the save key must rotate so newer packages can be stored');+ assert(cacheStep.includes(`restore-keys: |\n ${keyPrefix}`), 'the newest saved entry must be restored by key prefix');+ const script = step.split(' run: |\n')[1].split('\n').map(line => line.replace(/^ {10}/, '')).join('\n');+ const run = (missing, failure) => runFile('bash', ['-e', '-o', 'pipefail', '-c', mock + '\n' + script], {+ env: { ...env, MISSING_FONT: missing, FAIL_APT: failure },+ });+ for (const [missing, failure, expected, rejects] of [+ ['0', '', [], false],+ ['1', '', ['install'], false],+ ['1', 'first', ['install', 'update', 'install'], false],+ ['1', 'always', ['install', 'update'], true],+ ['1', 'install', ['install', 'update', 'install'], true],+ ]) {+ await writeFile(calls, '');+ if (rejects) await assert.rejects(run(missing, failure));+ else await run(missing, failure);+ const commands = (await readFile(calls, 'utf8')).trim().split('\n').filter(Boolean);+ assert.deepEqual(commands.map(command => command.includes(' install ') ? 'install' : 'update'), expected);assert(commands.every(command => command.includes('Acquire::Retries=2') && command.includes('Acquire::http::Timeout=30') && command.includes('Acquire::https::Timeout=30')));- assert(commands[0].endsWith(' update'));- assert(commands[1].endsWith(' install -y --no-install-recommends fonts-noto-core'));+ assert(commands.filter(command => command.includes(' install ')).every(command => command.endsWith(' install -y --no-install-recommends fonts-noto-core')));+ assert(commands.every(command => command.includes(`Dir::Cache::archives=${directory}/motion-rendering-apt`) && command.includes('APT::Keep-Downloaded-Packages=true')));}}- await writeFile(calls, '');- await assert.rejects(runFile('bash', ['-e', '-o', 'pipefail', '-c', mock + '\n' + script], { env: { ...env, MISSING_FONT: '1', FAIL_APT: '1' } }));- assert.equal((await readFile(calls, 'utf8')).trim().split('\n').length, 1, 'Failed apt update must not continue');});function storage(candidate) {