From 25420bf4cfc37b179b4efeace9db25a7178b61bf Mon Sep 17 00:00:00 2001 From: Vance Ingalls Date: Mon, 8 Jun 2026 10:22:31 -0700 Subject: [PATCH] ci: skip ffmpeg-static CDN download on ubuntu; retry Windows FFmpeg install (#1275) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci: skip ffmpeg-static CDN download on ubuntu; retry Windows FFmpeg install ubuntu-24.04 runners ship /usr/bin/ffmpeg. Set FFMPEG_BIN so ffmpeg-static's postinstall script skips its GitHub-release binary download, preventing bun install failures when that CDN is unavailable. For Windows: increase BtbN/FFmpeg-Builds download max-attempts 3→8 with longer backoff (30×attempt s) and set FFMPEG_BIN after install so bun install also skips ffmpeg-static's download in both render and test jobs. Co-Authored-By: Claude Sonnet 4.6 * ci: fix FFMPEG_BIN approach — use writable copy via composite action /usr/bin/ffmpeg is not writable by the runner user. When bun runs ffmpeg-static's postinstall script in a context where process.exit(0) is intercepted, the skip-if-exists check has no effect and the download proceeds to the destination path. Pointing FFMPEG_BIN at a system path (/usr/bin/ffmpeg) therefore causes EACCES even when the CDN returns 200. Replace the top-level env var with a prepare-ffmpeg-bin composite action that copies the system ffmpeg to $RUNNER_TEMP (writable). Call it before every bun install step in the CI workflow. Whether the postinstall script skips or overwrites, the write target is now writable and the job succeeds. Co-Authored-By: Claude Sonnet 4.6 * ci: skip apt fallback in prepare-ffmpeg-bin; use stub when ffmpeg absent ubuntu-24.04 GHA runners do not have ffmpeg pre-installed. The apt-get fallback triggered the install of ffmpeg and its dependencies, but the Azure apt mirror returned 404 for libcaca0, aborting the composite action. ffmpeg-static's postinstall only needs a regular file to exist at FFMPEG_BIN in order to reach the statSync check and call process.exit(0) — it does not need a real executable. Write a minimal shell stub when 'which ffmpeg' returns empty. Jobs that require an actual ffmpeg binary (cli-smoke-required) install it via apt before calling this action, so 'which ffmpeg' returns the real path and the copy branch runs instead. Co-Authored-By: Claude Sonnet 4.6 --------- Co-authored-by: Claude Sonnet 4.6 --- .../actions/install-ffmpeg-windows/action.yml | 4 +-- .github/actions/prepare-ffmpeg-bin/action.yml | 28 +++++++++++++++++++ .github/workflows/ci.yml | 10 +++++++ .github/workflows/windows-render.yml | 12 ++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 .github/actions/prepare-ffmpeg-bin/action.yml diff --git a/.github/actions/install-ffmpeg-windows/action.yml b/.github/actions/install-ffmpeg-windows/action.yml index 43dea7b92..9b55cc7dd 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 000000000..de6540798 --- /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 4f40a28af..92993fde1 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 e040e2503..e8d9f5b63 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