add dora-webcam node
validate / validate (push) Successful in 59m15s

Captures frames from a V4L2 camera and publishes them as std/media/v1/Image:
an Arrow struct of width, height, encoding and data, so a receiver needs
nothing from the message metadata. For a compressed encoding the recorded
dimensions are the image's, not the length of the payload.

Based on opencv-video-capture from dora-hub, with three changes. The output is
the typed image struct rather than a flat UInt8 buffer plus metadata. Camera
selection by id reads /dev/v4l/by-id/ only; the upstream macOS system_profiler
and Windows PowerShell enumeration is not carried. CAPTURE_FRAMES bounds a run
so a test ends on its own, in place of upstream's ten-second CI cutoff -- a
timeout would have made the CI step exit non-zero.

CI=true keeps a failed capture from raising, publishing a labelled black frame
instead, which is what lets dataflow.yml run on a machine with no camera.

Two dataflows, run one at a time, as dora has no cross-dataflow wiring:
dataflow.yml is the camera alone and the CI gate; dataflow_view.yml wires it
into dora-image-view and is not run by CI, since it fetches that node over the
network and needs a tag to exist there.
This commit is contained in:
2026-09-15 06:04:25 -03:00
commit 3c0e0f327d
16 changed files with 1647 additions and 0 deletions
+86
View File
@@ -0,0 +1,86 @@
# Gates that need no camera: the dataflow still matches the typed contract in
# dora-node.yml and still runs end to end, the unit tests pass, and the docs
# lint. CI=true is set by the runner, which is what makes a failed capture
# publish a placeholder frame instead of raising.
name: validate
# A pull request would otherwise run this twice on the same commit: once for
# the branch push and once for the PR.
on:
push:
branches: [main]
pull_request:
env:
DORA_VERSION: v1.0.1
DORA_TARGET: x86_64-unknown-linux-gnu
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# The opencv-python wheel links against libGL at import time, so cv2
# cannot even be imported on the bare runner image.
- name: Install the OpenCV shared libraries
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libgl1 libglib2.0-0
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
# The CLI is a single static binary pinned to DORA_VERSION, so the cache
# hit is exact and the download only happens when the version changes.
- name: Cache the dora CLI
id: dora-cache
uses: actions/cache@v4
with:
path: ~/.local/bin/dora
key: dora-cli-${{ env.DORA_VERSION }}-${{ env.DORA_TARGET }}
- name: Install the dora CLI
if: steps.dora-cache.outputs.cache-hit != 'true'
run: |
curl -fsSL -o dora-cli.tar.gz \
"https://github.com/dora-rs/dora/releases/download/${DORA_VERSION}/dora-cli-${DORA_TARGET}.tar.gz"
tar xzf dora-cli.tar.gz
mkdir -p "$HOME/.local/bin"
install -m 755 "dora-cli-${DORA_TARGET}/dora" "$HOME/.local/bin/dora"
rm -rf dora-cli.tar.gz "dora-cli-${DORA_TARGET}"
- name: Put the dora CLI on PATH
run: echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- run: dora --version
# --locked fails if uv.lock is out of date with pyproject.toml, so a
# dependency change that was never locked cannot reach main.
- name: Install
run: uv sync --locked --group dev
- run: uv run ruff check .
- run: uv run pymarkdown scan *.md
- run: uv run pytest -q
- name: Validate the node manifest
run: dora validate --node-manifest dora-node.yml
# strict_types: true in the dataflow turns a type warning into a non-zero
# exit, so a mismatched annotation fails here rather than at runtime.
- name: Validate the dataflow
run: dora validate dataflow.yml
# dataflow_view.yml is deliberately not run: it fetches dora-image-view
# over the network and needs a tag to exist there.
# CAPTURE_FRAMES bounds the run so it ends on its own; CI=true is already
# set by the runner, which makes a failed capture publish a placeholder
# frame rather than raising on a machine with no camera.
- name: Run the dataflow headless
env:
CAPTURE_FRAMES: 30
run: dora run dataflow.yml --uv