beffroi-reporting/scripts/check-components.sh

24 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Check the independent Typst plugins and their source-faithful publication.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
for command in git typst python3 uv; do
command -v "$command" >/dev/null 2>&1 || { echo "Missing test dependency: $command" >&2; exit 1; }
done
reporter/tests/test.sh
python3 -m unittest discover -s scripts/tests -p 'test_*.py' -v
work=$(mktemp -d "${TMPDIR:-/tmp}/beffroi-check.XXXXXXXX")
trap 'rm -rf -- "$work"' EXIT
./beffroi.sh diagnostic \
reporter/plugins/diagnostics/tests/fixtures/legacy/windiagnostics-v1.json \
reporter/plugins/diagnostics/tests/fixtures/legacy \
"$work/workflow" 2026-09-15T12:00:00Z
cp scripts/check-diagnostic.typ "$work/workflow/check-diagnostic.typ"
typst eval --root "$work/workflow" --input diagnostic=diagnostic.json \
--in "$work/workflow/check-diagnostic.typ" 'query(<valid>).first().value' >/dev/null
[[ $(head -c 5 "$work/workflow/report.pdf") == '%PDF-' ]]
scripts/build-publication.sh "$work/publication"
uv run --isolated --no-project --with pypdf==6.7.5 python3 \
scripts/check-legacy-parity.py "$work/publication"
echo 'Component checks and all 17 legacy PDF parity checks passed.'