|
| 1 | +# wrkflw-local-docgen: local visualization pipeline test workflow |
| 2 | +# Run with: wrkflw run .github/workflows/wrkflw-docgen.yml |
| 3 | +# |
| 4 | +# IMPORTANT: |
| 5 | +# - Uses `emulation` runtime (Docker not required) — steps run as host processes |
| 6 | +# - Assumes host has: Rust toolchain, cargo, node, just, mdBook toolchain installed |
| 7 | +# - wrkflw copies the repo into a sandboxed temp dir — use relative file paths |
| 8 | +# - Each stage does fresh `cargo build` in sandbox — no shared target dir |
| 9 | +# - Expected runtime for full 9-stage run: 20-60+ minutes |
| 10 | +# - ${{ }} expressions, `needs.<id>.result`, `toJSON(needs)` NOT supported in wrkflw |
| 11 | +name: wrkflw-local-docgen |
| 12 | + |
| 13 | +on: |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +env: |
| 17 | + CARGO_TERM_COLOR: always |
| 18 | + RUST_BACKTRACE: "1" |
| 19 | + |
| 20 | +defaults: |
| 21 | + run: |
| 22 | + shell: bash |
| 23 | + |
| 24 | +jobs: |
| 25 | + # Stage 1: Rust unit tests for mdbook-rhai-mermaid parser/emitter |
| 26 | + stage-1-rhai-parser-tests: |
| 27 | + name: "S1 Rhai Parser Tests" |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + - name: Run mdbook-rhai-mermaid unit tests |
| 32 | + run: | |
| 33 | + cargo test -p mdbook-rhai-mermaid 2>&1 | tee parser-test-output.txt |
| 34 | +
|
| 35 | + # Stage 2: ledger-core iso/isometric lint tests |
| 36 | + stage-2-iso-lint: |
| 37 | + name: "S2 Iso Lint Tests" |
| 38 | + needs: [stage-1-rhai-parser-tests] |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + - name: Run iso lint tests |
| 43 | + run: | |
| 44 | + cargo test -p ledger-core --test iso_lint --features legal-z3 2>&1 | tee iso-lint-output.txt |
| 45 | +
|
| 46 | + # Stage 3: ledger-core visualization tests (LayoutSolver, to_mermaid, to_html) |
| 47 | + stage-3-viz-tests: |
| 48 | + name: "S3 Viz/Derive Tests" |
| 49 | + needs: [stage-1-rhai-parser-tests] |
| 50 | + runs-on: ubuntu-latest |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + - name: Run ledger-core visualization tests |
| 54 | + run: | |
| 55 | + cargo test -p ledger-core --features legal-z3 2>&1 | tee viz-test-output.txt |
| 56 | +
|
| 57 | + # Stage 4: ledger-core Z3 legal solver integration tests |
| 58 | + stage-4-legal-z3: |
| 59 | + name: "S4 Legal Z3 Integration" |
| 60 | + needs: [stage-2-iso-lint, stage-3-viz-tests] |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + - name: Run legal-z3 integration test |
| 65 | + run: | |
| 66 | + cargo test -p ledger-core --test legal_z3_integration --features legal-z3 2>&1 | tee legal-z3-output.txt |
| 67 | +
|
| 68 | + # Stage 5: Build mdBook docs with rhai→mermaid injection |
| 69 | + stage-5-docgen-build: |
| 70 | + name: "S5 Docgen Build" |
| 71 | + needs: [stage-1-rhai-parser-tests] |
| 72 | + runs-on: ubuntu-latest |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v4 |
| 75 | + - name: Build docs |
| 76 | + run: | |
| 77 | + just docgen 2>&1 | tee docgen-build-output.txt |
| 78 | +
|
| 79 | + - name: Verify Mermaid injection |
| 80 | + run: | |
| 81 | + echo "=== Checking Mermaid injection ===" |
| 82 | + grep -q 'class="mermaid"' book/book/theory.html && echo "✓ theory.html: Mermaid OK" || { echo "✗ theory.html: NO MERMAID"; exit 1; } |
| 83 | + grep -q 'class="language-rhai"' book/book/theory.html && echo "✓ theory.html: Rhai blocks OK" || { echo "✗ theory.html: NO RHAI"; exit 1; } |
| 84 | + grep -q 'class="mermaid"' book/book/visualize.html && echo "✓ visualize.html: Mermaid OK" || { echo "✗ visualize.html: NO MERMAID"; exit 1; } |
| 85 | +
|
| 86 | + # Stage 6: Kasuari constraint solver tests from ledger-core |
| 87 | + stage-6-kasuari-constraints: |
| 88 | + name: "S6 Kasuari Constraint Tests" |
| 89 | + needs: [stage-2-iso-lint] |
| 90 | + runs-on: ubuntu-latest |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v4 |
| 93 | + - name: Run constraint solver tests |
| 94 | + run: | |
| 95 | + cargo test -p ledger-core -- constraints::test 2>&1 | tee kasuari-output.txt |
| 96 | + cargo test -p ledger-core -- pipeline::test 2>&1 | tee -a kasuari-output.txt |
| 97 | +
|
| 98 | + # Stage 7: Iso object lint — verify all HasVisualization impls produce valid specs |
| 99 | + stage-7-iso-objects: |
| 100 | + name: "S7 Iso Objects HasVisualization" |
| 101 | + needs: [stage-2-iso-lint] |
| 102 | + runs-on: ubuntu-latest |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v4 |
| 105 | + - name: Run iso_objects tests |
| 106 | + run: | |
| 107 | + cargo test -p ledger-core --features legal-z3 -- --test-threads=1 2>&1 | tee iso-objects-output.txt |
| 108 | +
|
| 109 | + # Stage 8: Live-editor JS unit tests |
| 110 | + stage-8-live-editor-js: |
| 111 | + name: "S8 Live Editor JS Tests" |
| 112 | + needs: [stage-5-docgen-build] |
| 113 | + runs-on: ubuntu-latest |
| 114 | + steps: |
| 115 | + - uses: actions/checkout@v4 |
| 116 | + - name: Run live-editor unit tests |
| 117 | + run: | |
| 118 | + node --test book/theme/rhai-live-core.test.js 2>&1 | tee js-test-output.txt |
| 119 | +
|
| 120 | + - name: Run JS syntax checks |
| 121 | + run: | |
| 122 | + node -c book/theme/rhai-live-core.js |
| 123 | + node -c book/theme/rhai-live.js |
| 124 | +
|
| 125 | + # Stage 9: Xero MCP smoke test (build + unit tests, no live API calls) |
| 126 | + stage-9-xero-mcp: |
| 127 | + name: "S9 Xero MCP Smoke" |
| 128 | + needs: [stage-1-rhai-parser-tests] |
| 129 | + runs-on: ubuntu-latest |
| 130 | + steps: |
| 131 | + - uses: actions/checkout@v4 |
| 132 | + - name: Build MCP server |
| 133 | + run: | |
| 134 | + cargo build -p ledgerr-mcp --bin ledgerr-mcp-server 2>&1 | tee xero-mcp-output.txt |
| 135 | +
|
| 136 | + - name: Run MCP tests |
| 137 | + run: | |
| 138 | + cargo test -p ledgerr-mcp 2>&1 | tee -a xero-mcp-output.txt |
0 commit comments