Finish Electron shell and workflow wiring
Template tests / tests (push) Failing after 4s

This commit is contained in:
Iisyourdad
2026-06-10 18:32:30 -05:00
parent a5bbdde480
commit f47aca67c2
22 changed files with 5002 additions and 2 deletions
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# Workflow check: ensure the Electron launcher boots without the
# ELECTRON_RUN_AS_NODE shim leaking into the app process.
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$ROOT_DIR"
TMP_ROOT="$(mktemp -d)"
trap 'rm -rf "$TMP_ROOT"' EXIT
LOG_FILE="$TMP_ROOT/start.log"
set +e
STEPFORGE_DATA_DIR="$TMP_ROOT/data" timeout 8s npm start >"$LOG_FILE" 2>&1
status=$?
set -e
if [[ $status -ne 124 ]]; then
cat "$LOG_FILE" >&2
echo "electron launcher did not stay alive under timeout (status $status)" >&2
exit 1
fi
if grep -Eq 'TypeError: Cannot read properties of undefined \(reading '\''requestSingleInstanceLock'\''\)|bad option: --ozone-platform=headless' "$LOG_FILE"; then
cat "$LOG_FILE" >&2
echo "launcher still exposed a Node-mode startup failure" >&2
exit 1
fi
echo "startup smoke OK"
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# Workflow check: run the offline build with temp output roots and verify the
# report, manifest, and sample assets are produced.
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$ROOT_DIR"
TMP_ROOT="$(mktemp -d)"
trap 'rm -rf "$TMP_ROOT"' EXIT
BUILD_ROOT="$TMP_ROOT/build"
EXAMPLES_ROOT="$TMP_ROOT/examples"
STEPFORGE_BUILD_DIR="$BUILD_ROOT" \
STEPFORGE_EXAMPLES_DIR="$EXAMPLES_ROOT" \
bash scripts/build-release.sh >/dev/null
for f in build_report.md artifacts_manifest.json; do
if [[ ! -s "$BUILD_ROOT/$f" ]]; then
echo "Missing build output: $f" >&2
exit 1
fi
done
if ! find "$BUILD_ROOT/artifacts" -maxdepth 1 -type f -name '*.tar.gz' -print -quit | grep -q .; then
echo "Missing portable tarball" >&2
exit 1
fi
if [[ ! -s "$EXAMPLES_ROOT/sample-manifest.json" ]]; then
echo "Missing sample manifest from build" >&2
exit 1
fi
if [[ ! -s "$EXAMPLES_ROOT/sample-guide.sfgz" ]]; then
echo "Missing sample archive from build" >&2
exit 1
fi
MANIFEST_FILE="$BUILD_ROOT/artifacts_manifest.json" node - <<'NODE'
const fs = require('node:fs');
const manifest = JSON.parse(fs.readFileSync(process.env.MANIFEST_FILE, 'utf8'));
if (manifest.format !== 'stepforge-artifacts-manifest') throw new Error('unexpected build manifest format');
if (!Array.isArray(manifest.files) || manifest.files.length < 3) throw new Error('missing build files');
if (!manifest.files.some((file) => file.path.endsWith('.tar.gz'))) throw new Error('missing tarball entry');
if (!manifest.files.some((file) => file.path.endsWith('sample-guide.sfgz'))) throw new Error('missing sample archive entry');
NODE
echo "build release OK"
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Workflow check: generate the offline sample guide and verify the expected
# outputs exist. This exercises the sample pipeline end to end in a temp root.
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$ROOT_DIR"
TMP_ROOT="$(mktemp -d)"
trap 'rm -rf "$TMP_ROOT"' EXIT
SAMPLE_ROOT="$TMP_ROOT/sample"
node scripts/make-sample-guide.js --root "$SAMPLE_ROOT" >/dev/null
for f in sample-manifest.json sample-guide.sfgz; do
if [[ ! -s "$SAMPLE_ROOT/$f" ]]; then
echo "Missing sample output: $f" >&2
exit 1
fi
done
for dir in sample-data sample-exports/json sample-exports/markdown sample-exports/html-simple \
sample-exports/html-rich sample-exports/pdf sample-exports/gif \
sample-exports/image-bundle sample-exports/docx sample-exports/pptx; do
if ! find "$SAMPLE_ROOT/$dir" -type f -print -quit | grep -q .; then
echo "Sample export directory is empty: $dir" >&2
exit 1
fi
done
MANIFEST_FILE="$SAMPLE_ROOT/sample-manifest.json" node - <<'NODE'
const fs = require('node:fs');
const manifest = JSON.parse(fs.readFileSync(process.env.MANIFEST_FILE, 'utf8'));
if (manifest.format !== 'stepforge-sample-manifest') throw new Error('unexpected sample manifest format');
if (!manifest.guideId) throw new Error('missing guideId');
if (!manifest.exports || Object.keys(manifest.exports).length < 9) throw new Error('missing sample exports');
NODE
echo "sample artifacts OK"