Skip to content

Local video editor for coding agents: 42 FFmpeg tools with a machine-readable contract and an MCP server, for Claude Code, Cursor and Codex. Cut, captions, reframe, loudness, platform exports. No cloud, no API keys.

6.4 KB
Raw Blame

CI for the demo gallery — the YAML to add

The changes described here are not applied: they touch .github/workflows/, which the App token used for these PRs is not allowed to merge. A maintainer copies the two blocks below into the named files; nothing else in this PR depends on them.

Both are cheap: ubuntu-latest bills at 1x, and the whole gallery renders in about six minutes on a runner of that size.


1. .github/workflows/ci.yml — a demos job

Add this as a sibling of test / test-ffmpeg-5 (same indentation, under jobs:). It installs ffmpeg and fonts exactly the way the existing Linux matrix leg does — fonts-dejavu-core for the BEFORE/AFTER labels, plus the CJK and Arabic families the caption demos need, or those demos skip themselves and the job silently proves less than it looks like it does.

  # Renders the whole before/after gallery from synthetic footage on every PR. This is a real
  # end-to-end test of every script under scripts/ except the four inspection-only ones
  # (probe, verify, batch, report), which print a table rather than a picture -- tests/test_orchestration.py
  # pins that split, so a new tool cannot land without either a demo or an entry on that list.
  # It is also the gate on
  # what lands in docs/demos/: build.py fails when a committed preview goes over 500 KB, so a
  # PR cannot quietly grow the repo's binaries. Linux only -- it bills at 1x and the demos are
  # about the tools, not about per-OS ffmpeg differences, which the test matrix already covers.
  demos:
    name: demo gallery (ubuntu-latest)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-python@v7
        with:
          python-version: "3.9"
      # Same apt line as the matrix job, plus the CJK/Arabic faces: without them the
      # captions_ja / _zh / _ko / _ar demos skip, and a skipped demo proves nothing. The
      # stabilize and sphere demos need an ffmpeg built with vidstab and v360; Ubuntu's
      # package has both, and build.py names the missing filter when it does not.
      - name: Install ffmpeg and fonts
        run: |
          sudo apt-get update
          sudo apt-get install -y ffmpeg fonts-dejavu-core fonts-ipafont-gothic \
                                  fonts-wqy-zenhei fonts-noto-core
      - name: Build the demo gallery
        run: python3 demos/build.py
      # The previews are committed, so CI must fail when the working tree's versions differ
      # from what a fresh render produces -- otherwise docs/demos.md shows a picture of an
      # older build of the tool. Only the generated page is diffed, not the GIFs: GIF bytes
      # vary with the ffmpeg build, the page text does not.
      - name: docs/demos.md is up to date with demos/build.py
        run: |
          python3 demos/build.py --docs
          git diff --exit-code -- docs/demos.md
      - uses: actions/upload-artifact@v7
        if: always()
        with:
          name: demo-gallery
          path: |
            demos/out/*.mp4
            docs/demos/*
          retention-days: 14

Add demos to the branch-protection ruleset's required status checks if the intent is that a red gallery blocks a merge (main currently requires 8 checks; this would make 9).

Why the previews are not regenerated by CI and committed back

A bot commit pushing several MB of GIFs onto every PR would churn the repo's history for changes that are usually invisible (GIF bytes differ between ffmpeg builds even when the picture is identical). The author runs python3 demos/build.py and commits the result; CI only proves it still renders and that docs/demos.md matches the table in demos/build.py.


2. .github/workflows/release.yml — attach the full MP4s to the release

The gallery in docs/demos.md shows 480 px GIFs because they have to live in git. The 640 px side-by-side MP4s (and the full-resolution _before / _after pairs) are the better artefact, and a GitHub Release is the right place for them: it is versioned, it is not in the repo's history, and it costs nothing to drop.

Two steps, inserted into the existing release job immediately before the Create tag and GitHub Release step (softprops/action-gh-release@v3, around line 242), and one addition to that step itself.

      # Build the gallery at the exact commit being released and zip it, so the release
      # carries watchable proof of what this version does. `|| true` is deliberate: a failed
      # demo render must never block a release that npm and the tag are already committed to
      # -- the missing asset is visible on the release page, a half-published version is not.
      - name: Render the demo gallery for the release assets
        if: steps.check.outputs.already_released == 'false'
        run: |
          sudo apt-get update
          sudo apt-get install -y ffmpeg fonts-dejavu-core fonts-ipafont-gothic \
                                  fonts-wqy-zenhei fonts-noto-core
          python3 demos/build.py || true
          mkdir -p release_assets
          # Side-by-side comparisons only: the _before/_after pairs are another ~60 MB and are
          # reproducible from the same one command, which is named in the zip's README.
          cp demos/out/*.mp4 release_assets/ 2>/dev/null || true
          rm -f release_assets/*_before.mp4 release_assets/*_after.mp4
          cp -r docs/demos release_assets/previews
          printf 'Rebuild these with:\n\n    python3 demos/build.py\n' > release_assets/README.txt
          cd release_assets && zip -r ../demo-gallery-${{ steps.check.outputs.tag }}.zip .

and on the existing release step:

      - name: Create tag and GitHub Release
        if: steps.check.outputs.already_released == 'false'
        uses: softprops/action-gh-release@v3
        with:
          tag_name: ${{ steps.check.outputs.tag }}
          target_commitish: ${{ steps.check.outputs.sha }}
          body_path: release_notes.md
          generate_release_notes: true
          files: demo-gallery-${{ steps.check.outputs.tag }}.zip   # <- the one added line
          fail_on_unmatched_files: false                           # <- and its guard

fail_on_unmatched_files: false pairs with the || true above: if the render failed, the release still publishes without the asset. The release notes can then link the gallery with a line in the CHANGELOG template — Demos: docs/demos.md (full MP4s attached below).