Skip to content

Write HTML. Render video. Built for agents.

ci: skip ffmpeg-static CDN download on ubuntu; retry Windows FFmpeg install (#1275)

Vance Ingalls25420bf4cfc3
diff --git a/.github/actions/install-ffmpeg-windows/action.yml b/.github/actions/install-ffmpeg-windows/action.yml
index 43dea7b927..9b55cc7dd1 100644
--- a/.github/actions/install-ffmpeg-windows/action.yml
+++ b/.github/actions/install-ffmpeg-windows/action.yml
@@ -19,7 +19,7 @@ inputs:
max-attempts:
description: Max download attempts before failing.
required: false
- default: "3"
+ default: "8"
runs:
using: composite
@@ -44,7 +44,7 @@ runs:
} catch {
Write-Warning "Download failed: $($_.Exception.Message)"
if ($attempt -eq $maxAttempts) { throw }
- Start-Sleep -Seconds (10 * $attempt)
+ Start-Sleep -Seconds (30 * $attempt)
}
}
diff --git a/.github/actions/prepare-ffmpeg-bin/action.yml b/.github/actions/prepare-ffmpeg-bin/action.yml
new file mode 100644
index 0000000000..de65407983
--- /dev/null
+++ b/.github/actions/prepare-ffmpeg-bin/action.yml
@@ -0,0 +1,28 @@
+name: Prepare FFMPEG_BIN for bun install
+description: >-
+ Copies the system ffmpeg binary to a writable temp location and sets
+ FFMPEG_BIN in the environment. ffmpeg-static's postinstall script checks
+ whether a file already exists at FFMPEG_BIN; if it does and process.exit(0)
+ is respected by the runtime, the CDN download is skipped entirely. If the
+ runtime intercepts process.exit(0) and the download proceeds anyway, using
+ a writable target prevents the EACCES failure that occurs when the
+ destination is a system path like /usr/bin/ffmpeg.
+
+runs:
+ using: composite
+ steps:
+ - name: Copy ffmpeg to writable path
+ shell: bash
+ run: |
+ FFMPEG=$(which ffmpeg 2>/dev/null || echo "")
+ if [ -n "$FFMPEG" ]; then
+ cp "$FFMPEG" "$RUNNER_TEMP/hf-ffmpeg"
+ else
+ # ffmpeg not pre-installed; write a stub so ffmpeg-static's postinstall
+ # finds a file at FFMPEG_BIN and exits early (statSync check) without
+ # attempting the CDN download. Jobs that need a real ffmpeg binary
+ # install it via apt before calling this action.
+ printf '#!/bin/sh\nexec ffmpeg "$@"\n' > "$RUNNER_TEMP/hf-ffmpeg"
+ fi
+ chmod +x "$RUNNER_TEMP/hf-ffmpeg"
+ echo "FFMPEG_BIN=$RUNNER_TEMP/hf-ffmpeg" >> "$GITHUB_ENV"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4f40a28aff..92993fde18 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -67,6 +67,7 @@ jobs:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
+ - uses: ./.github/actions/prepare-ffmpeg-bin
- run: bun install --frozen-lockfile
- run: bun run build
@@ -84,6 +85,7 @@ jobs:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
+ - uses: ./.github/actions/prepare-ffmpeg-bin
- run: bun install --frozen-lockfile
- run: bun run lint
@@ -117,6 +119,7 @@ jobs:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
+ - uses: ./.github/actions/prepare-ffmpeg-bin
- run: bun install --frozen-lockfile
- name: Run fallow audit
id: audit
@@ -172,6 +175,7 @@ jobs:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
+ - uses: ./.github/actions/prepare-ffmpeg-bin
- run: bun install --frozen-lockfile
- run: bun run format:check
@@ -189,6 +193,7 @@ jobs:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
+ - uses: ./.github/actions/prepare-ffmpeg-bin
- run: bun install --frozen-lockfile
- run: bun run build
- run: bun run --filter '*' typecheck
@@ -207,6 +212,7 @@ jobs:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
+ - uses: ./.github/actions/prepare-ffmpeg-bin
- run: bun install --frozen-lockfile
- run: bun run test:scripts
- run: bun run --cwd packages/core build:hyperframes-runtime
@@ -226,6 +232,7 @@ jobs:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
+ - uses: ./.github/actions/prepare-ffmpeg-bin
- run: bun install --frozen-lockfile
- run: bun run --filter @hyperframes/core test:hyperframe-runtime-ci
@@ -243,6 +250,7 @@ jobs:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
+ - uses: ./.github/actions/prepare-ffmpeg-bin
- run: bun install --frozen-lockfile
- run: bun run --cwd packages/core build:hyperframes-runtime
- name: Start studio and check for runtime errors
@@ -308,6 +316,7 @@ jobs:
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
+ - uses: ./.github/actions/prepare-ffmpeg-bin
- run: bun install --frozen-lockfile
- run: bun run build
@@ -383,6 +392,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg
+ - uses: ./.github/actions/prepare-ffmpeg-bin
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build monorepo
diff --git a/.github/workflows/windows-render.yml b/.github/workflows/windows-render.yml
index e040e2503b..e8d9f5b63a 100644
--- a/.github/workflows/windows-render.yml
+++ b/.github/workflows/windows-render.yml
@@ -108,6 +108,12 @@ jobs:
- name: Install FFmpeg
uses: ./.github/actions/install-ffmpeg-windows
+ - name: Set FFMPEG_BIN for bun install
+ shell: pwsh
+ run: |
+ $path = (Get-Command ffmpeg.exe).Source
+ "FFMPEG_BIN=$path" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
+
# -----------------------------------------------------------------
# Verify FFmpeg feature inventory.
#
@@ -394,6 +400,12 @@ jobs:
- name: Install FFmpeg
uses: ./.github/actions/install-ffmpeg-windows
+ - name: Set FFMPEG_BIN for bun install
+ shell: pwsh
+ run: |
+ $path = (Get-Command ffmpeg.exe).Source
+ "FFMPEG_BIN=$path" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
+
- name: Install Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2