Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,47 @@ jobs:
tools/among-tools/target/release/among-tools run-ignored-tests "$RUNNER_TEMP/tool-tests.jsonl"
cargo test --locked --no-run --message-format=json > "$RUNNER_TEMP/test-executables.jsonl"
tools/among-tools/target/release/among-tools run-ignored-tests "$RUNNER_TEMP/test-executables.jsonl"
- name: Documentation media on the owned display image
if: matrix.runner == 'ubuntu-24.04'
run: |
set -euo pipefail
touch src/build_info.rs
AMONG_BUILD_VERSION=0.2.0 \
AMONG_BUILD_COMMIT="$(git rev-parse --short HEAD)" \
AMONG_BUILD_DATE="$(date -u +%F)" \
cargo test --locked --no-run --message-format=json > "$RUNNER_TEMP/media-tests.jsonl"
app_test="$(jq -sre '[.[] | select(.reason == "compiler-artifact" and .profile.test == true and .target.name == "among" and .target.kind == ["bin"] and .executable != null) | .executable] | unique | if length == 1 then .[0] else error("expected one application test executable") end' "$RUNNER_TEMP/media-tests.jsonl")"
case "$app_test" in "$PWD"/target/debug/deps/*) ;; *) exit 1 ;; esac
test -x "$PWD/target/debug/examples/fake-plugin"
root="$AMONG_CHECK_ROOT/media"
mkdir -p "$root"/{home,config,data,cache,state,out}
chmod 700 "$root"
container_test="/target/${app_test#"$PWD/target/"}"
docker run --rm --network none --user "$(id -u):$(id -g)" \
--mount type=bind,src="$PWD/target",dst=/target,readonly \
--mount type=bind,src="$PWD/tools/among-tools/target/release/among-tools",dst=/tools/among-tools,readonly \
--mount type=bind,src="$PWD",dst=/source,readonly \
--mount type=bind,src="$root",dst=/run-root \
--env HOME=/run-root --env XDG_DATA_HOME=/run-root/data --env XDG_CONFIG_HOME=/run-root/config \
--env XDG_CACHE_HOME=/run-root/cache --env XDG_STATE_HOME=/run-root/state --env XDG_RUNTIME_DIR=/run-root \
--env AMONG_CHECK_ROOT=/run-root --env AMONG_MEDIA_SOURCE="$(git rev-parse HEAD)" \
--workdir /source among-installer-enospc:ci \
/tools/among-tools media all "$container_test" /run-root/out \
> "$root/media.log" 2>&1
docker run --rm --network none --user "$(id -u):$(id -g)" \
--mount type=bind,src="$PWD/tools/among-tools/target/release/among-tools",dst=/tools/among-tools,readonly \
--mount type=bind,src="$root",dst=/run-root \
among-installer-enospc:ci \
/tools/among-tools media verify /run-root/out
cat "$root/media.log"
- name: Keep documentation media evidence
if: ${{ always() && matrix.runner == 'ubuntu-24.04' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: documentation-media
path: ${{ runner.temp }}/among-checks/media
if-no-files-found: warn
retention-days: 7
- name: Real audio through each distribution's declared packages
run: |
cargo build --locked --example audio-probe --bin among
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ Behaviour that only exists in a running window is verified differently: the
application is driven with scripted actions (`AMONG_SCRIPT`) and real key events
(`xdotool`), and its state is read back from `AMONG_SELFCHECK`. See
[Verification aids](docs/testing.md) for the full list of switches.
Documentation stills and the notification recording come from
[documentation media](docs/media.md); use `among-tools media` instead of a
temporary capture script.

A change to layout, focus, or the plugin pipeline is not finished until it has
been observed at that boundary. A test that only proves a function returns a
Expand Down
185 changes: 185 additions & 0 deletions docs/media.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# Documentation media

Screenshots and demo recordings for the site and README come from one
scene. The scene is real application state: a saved session, three named
workspaces, real PTYs, the real Preferences window and a real GNOME
notification. Nothing is assembled by hand.

The same command produces the files, so a layout change is fixed once instead
of once per page.

Build the display image once; it carries Xvfb, Xephyr, GNOME Shell,
ImageMagick, ffmpeg and `xsetroot`:

```sh
docker build -f tools/among-tools/containers/Dockerfile.display -t among-display:media .
```

## One command

Build the application test binary in the pinned Ubuntu image, build
`among-tools`, then run the capture inside the display image:

```sh
# 0. Prepare the bind mounts and the offline registry cache.
mkdir -p "$HOME/.cache/among/media/cargo" \
"$HOME/.cache/among/media/build/target" \
"$HOME/.cache/among/media/run"
cargo fetch --locked

# 1. Build the application test binary and the plugin fixture.
docker run --rm --network none --user "$(id -u):$(id -g)" \
--mount type=bind,src="$PWD",dst=/source,readonly \
--mount type=bind,src="$HOME/.cache/among/media/cargo",dst=/cargo \
--mount type=bind,src="$HOME/.cargo/registry",dst=/cargo/registry,readonly \
--mount type=bind,src="$HOME/.cache/among/media/build/target",dst=/target \
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
--env HOME=/tmp --env CARGO_HOME=/cargo --env CARGO_TARGET_DIR=/target \
--env AMONG_BUILD_VERSION=0.2.0 \
--env AMONG_BUILD_COMMIT="$(git rev-parse --short HEAD)" \
--env AMONG_BUILD_DATE="$(date -u +%F)" \
--env CARGO_NET_OFFLINE=true --workdir /source \
among-managed-resource-gui:1.98.1-ubuntu24-20261025-01 \
bash -c 'cargo test --locked --offline --bin among --no-run --message-format=json > /target/test.jsonl && cargo build --locked --offline --example fake-plugin'
# Take the last compiler-artifact executable from target/test.jsonl; it is
# usually target/debug/deps/among-<hash>.

# 2. Build the tool.
cargo build --locked --release --manifest-path tools/among-tools/Cargo.toml

# 3. Capture and prepare everything.
docker run --rm --network none --user "$(id -u):$(id -g)" \
--mount type=bind,src="$HOME/.cache/among/media/build/target",dst=/target,readonly \
--mount type=bind,src="$PWD/tools/among-tools/target/release/among-tools",dst=/tools/among-tools,readonly \
--mount type=bind,src="$PWD",dst=/source,readonly \
--mount type=bind,src="$HOME/.cache/among/media/run",dst=/run \
--env HOME=/run --env XDG_DATA_HOME=/run/data --env XDG_CONFIG_HOME=/run/config \
--env XDG_CACHE_HOME=/run/cache --env XDG_STATE_HOME=/run/state \
--env XDG_RUNTIME_DIR=/run --env AMONG_CHECK_ROOT=/run \
--env AMONG_MEDIA_SOURCE="$(git rev-parse HEAD)" \
--workdir /source among-display:media \
/tools/among-tools media all /target/debug/deps/among-<hash> /run/out

# 4. Check the published contract inside the image that carries ffprobe.
docker run --rm --network none --user "$(id -u):$(id -g)" \
--mount type=bind,src="$PWD/tools/among-tools/target/release/among-tools",dst=/tools/among-tools,readonly \
--mount type=bind,src="$HOME/.cache/among/media/run",dst=/run \
among-display:media \
/tools/among-tools media verify /run/out
```

CI runs the same `media all` and `media verify` in the x86_64 native job and
keeps the output as the `documentation-media` artifact.

`among-display:media` is built from
`tools/among-tools/containers/Dockerfile.display`. It contains the owned X11
and GNOME stack, ImageMagick, ffmpeg and `xsetroot`; the image also owns
`/work`, the synthetic project path that may appear in a notification.

The captures write below the output directory and create the synthetic
`/work/among` project inside the disposable display image. The scene removes
that project only when its own `.git/among-media-project` marker is present;
a project without the marker is refused. `/work` is sticky and writable by
any runtime uid, so `--user "$(id -u):$(id -g)"` works without uid 1000.
`raw/` contains the untouched captures and stays as evidence. `media.json`
records every published file, its size, dimensions and SHA-256; set
`AMONG_MEDIA_SOURCE` to the source commit or the manifest keeps `source: null`
and prints a warning.

## Scenarios

| Command | What it captures |
| --- | --- |
| `media stills` | The restore prompt, the three-pane Workbench, an expanded pane, the Review workspace, the plugin status comparison and the seven Preferences pages including About |
| `media panes` | One pane split to five, divider resizes, a pane dragged to a new position, workspace switching, then a new workspace created and renamed |
| `media notification` | The Review workspace with a status terminal, a real GNOME notification, a pointer click and the focused terminal after it |
| `media all` | All three, in one output directory |

The stills and panes runs use an owned 1600x1000 Xvfb/Openbox display with the
application maximized, so the product fills the frame. The notification run
uses an owned Xephyr/GNOME Shell display with a private session bus, a private
desktop identity and dark system settings. All use the same project, terminal
colours, font fixture and application build.

## The published contract

| Asset | Size |
| --- | --- |
| `main-window.png`, `expanded-pane.png`, `workspaces.png` | 1600x1000 |
| `plugin-off.png`, `plugin-on.png` | 1600x1000 |
| `panes.mp4`, `panes-poster.png` | 1600x1000, H.264, 30 fps, no audio |
| `session-restore.png` | 800x480 |
| Preferences stills | 882 wide, 2 px taller than the window |
| `notification-return.mp4` | 1600x1000, H.264, 30 fps, no audio |
| `notification-return-poster.png` | 1600x1000 |
| `desktop-notification.png` | 640x130 |

The application fills the 1600x1000 display. Preferences stills are cropped to
the window with a 1 px `#3a414d` border, so no desktop margin remains. The
application is Adwaita dark, the terminal is Gray on black with the Tango
palette, and every PNG has its metadata stripped. `media verify` checks the
exact 18-name set, hashes, sizes,
and the video stream geometry and rate.

## The notification recording

The scene queues a bell in the unfocused `status` terminal, focuses a neutral
1x1 window so the application is in the background, and records the real
GNOME banner with `ffmpeg x11grab`. The pointer gesture is visible. GNOME's
X11 stage in this owned session does not deliver synthetic XTest clicks to the
banner, so the scene then calls the same `app.focus-pane` action the
notification's default target names. The payload and the real activation
contract are checked separately by
`among-tools check-desktop-notifications`; the recording is a visual
demonstration, not the notification acceptance test.

The shell's own startup notifications are suppressed by keeping banners off
until the scene is ready. They are not part of the product story.

The scene leaves Review for Workbench before recording, so the bell belongs to
the unseen status terminal and the banner click has a visible result. Recording
starts just before the bell, waits until the banner is visible, and captures the
poster from that confirmed frame. The clip contains the ring, the banner and the
return to Review without a hard-coded trim.

## The panes recording

The scene starts from a saved single-pane layout, splits to five with
`Ctrl+Shift+N`, drags the root divider twice, drags pane five onto pane two,
then switches to Review, Notes and back to Workbench with `Alt+2`, `Alt+3` and
`Alt+1`, creates a fourth workspace with `Ctrl+Shift+T` and renames it in
place. The project is synthetic; every terminal is real.

## The plugin comparison

`plugin-off.png` and `plugin-on.png` come from one stills run. The second image
registers the `github:12/demo-status` managed fixture, which answers the status
request with fixed `CPU 18%`, `MEM 6.2 GB` and `DISK 41%` fragments in the
application header. The fixture is a test executable, not a shipped plugin; the
values are synthetic and the page says so.

## Publishing

Copy the verified files into the site repository:

| Output | Site path |
| --- | --- |
| `main-window.png`, `expanded-pane.png`, `workspaces.png`, `session-restore.png` | `docs/public/media/app/` |
| `plugin-off.png`, `plugin-on.png` | `docs/public/media/app/` |
| `panes.mp4`, `panes-poster.png` | `docs/public/media/app/` |
| `notification-return.mp4`, `notification-return-poster.png`, `desktop-notification.png` | `docs/public/media/app/` |
| `plugins.png`, `plugin-access-review.png`, `notifications.png`, `keyboard.png`, `terminal.png`, `about.png` | `docs/public/media/preferences/` |

Use the dimensions above in page markup. Run the site's `npm run build` and
`npm run check` after replacing the files.

## Known limits

- The notification recording uses the owned GNOME X11 stage; it is not a
Wayland or installed-package recording.
- The example project, plugin catalogue and package sizes are synthetic, as
the site captions say.
- The raw captures are kept below the output directory; delete old output
directories yourself when they are no longer needed.
- This pipeline covers documentation stills and the panes and notification
clips. The promo, action and overview films keep their separate production
tooling.
Binary file removed docs/media/among-terminal-action-v5.mp4
Binary file not shown.
Binary file removed docs/media/among-terminal-action-v5.png
Binary file not shown.
9 changes: 9 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,15 @@ paths and desktop never appear because the test runs in the owned display with
its own `HOME`. The tool runs `/usr/bin/convert` with a cleared environment, the
same fixed path the other graphical checks use.

### Site and README media

The differently framed stills and the notification recording used by the
public site and README come from `among-tools media`; see
[documentation media](media.md). That pipeline starts its own owned X11 and
GNOME displays, writes a manifest and checks the published dimensions. The
Preferences captures above remain the in-repository table until its remaining
states are ported to the same scene.

## Installer ENOSPC context

`among-tools check-installer-enospc-from-cargo CARGO_TEST_RECORDS` selects the
Expand Down
15 changes: 15 additions & 0 deletions examples/fake-plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,21 @@ fn serve_managed_transport(mode: &str) -> std::io::Result<()> {
_ => "ok",
};
let mut response = json!({"type":"status","session":message["session"],"generation":message["generation"],"request_id":message["request_id"],"fragments":[{"text":text,"style":"success","priority":10}]});
if mode == "demo-status" {
let slot = message["scope"]["slot"].as_str().unwrap_or_default();
response["fragments"] = if slot == "app_header" {
json!([
{"text": "09:41", "style": "default", "priority": 4},
{"text": "CPU 18%", "style": "accent", "priority": 10},
{"text": "MEM 6.2 GB", "style": "default", "priority": 11},
{"text": "DISK 41%", "style": "warning", "priority": 12}
])
} else if slot.starts_with("pane_footer") {
json!([{"text": "/work/among", "style": "dim", "priority": 10}])
} else {
json!([])
};
}
if mode == "rapid" {
response["refresh_ms"] = json!(0);
}
Expand Down
1 change: 1 addition & 0 deletions src/app/plugin_tests/installation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::os::fd::AsRawFd;
use std::os::unix::fs::PermissionsExt;

mod candidate;
mod doc_media;
mod doc_screenshots;
mod list;
mod local_catalogue;
Expand Down
Loading
Loading