Skip to content

CI validation

rereel validate reads only rereel.json, rereel.lock.json, props.json and mix_plan.json. It needs no media, no storage credentials, no FFmpeg and no Remotion, so it fits in a few seconds of CI on every pull request.

It exits 0 when valid is true and 1 otherwise. Usage errors exit 2.

Code Level Meaning
SPEC_MISSING, SPEC_INVALID, SCHEMA_VERSION error rereel.json is missing, not valid JSON, or has an unsupported schemaVersion
VIDEO_SPEC_INVALID error video.width, height and fps must be positive
LOCK_MISSING, LOCK_INVALID error lockfile missing or invalid
PROPS_MISSING, PROPS_INVALID error props file missing or invalid (non-composite reels)
PARTS_MISSING, CHAPTER_MISSING error composite_merge without parts, or a child reel without rereel.json
MIX_PLAN_MISSING warning audioMode: "mix_plan" but no mix_plan.json
MIX_PLAN_INVALID, NEGATIVE_TIME, INVALID_DURATION error invalid mix plan, or a narration segment with start_sec/src_start_sec < 0 or duration_sec ≤ 0
ABSOLUTE_PATH error a media reference starts with /, so the reel is not portable
UNLOCKED_ASSET error a media reference is neither in the lockfile nor on disk. Someone forgot to run freeze.
MISSING_URI error a storage lock entry has no uri
VFR_MEDIA warning a locked video has a variable frame rate
MEDIA_NOT_HYDRATED, MEDIA_SHA_MISMATCH error only with --check-media
.github/workflows/rereel.yml
name: rereel
on:
pull_request:
paths: ["reels/**"]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Validate every reel
run: |
status=0
for spec in reels/*/rereel.json; do
dir=$(dirname "$spec")
out=$(npx rereel validate "$dir") || status=1
echo "$out" | jq -r --arg dir "$dir" \
'(.errors[] | "::error title=\(.code)::\($dir): \(.path): \(.message)"),
(.warnings[] | "::warning title=\(.code)::\($dir): \(.path): \(.message)")'
done
exit $status

This assumes @mathrunet/rereel is in the repository’s devDependencies. Each validate prints one JSON line, and jq turns errors into annotations on the pull request. jq is preinstalled on GitHub-hosted runners.

To confirm that every locked object can actually be downloaded and matches its hash, hydrate in CI with read-only credentials:

hydrate:
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 22, cache: npm }
- run: npm ci
- name: Hydrate and verify
env:
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
run: |
for spec in reels/*/rereel.json; do
dir=$(dirname "$spec")
npx rereel hydrate "$dir"
npx rereel validate "$dir" --check-media
done

rereel.storage.json must be committed at the repository root, with the same provider names as the lockfiles. hydrate re-hashes every download and exits 1 on any mismatch. Template-sourced entries are skipped unless you pass --template-dir.

build additionally needs ffmpeg/ffprobe (sudo apt-get install -y ffmpeg), the Remotion template with its dependencies installed, and the browser dependencies Remotion requires on Linux. Cache <reel_dir>/build/chunks/ between runs (for example with actions/cache, keyed on the reel directory) to keep incremental rebuilds fast.