TOON Integration Tests #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: TOON Integration Tests | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'scripts/test_*.sh' | |
| - 'scripts/verify_*.sh' | |
| - '.github/workflows/toon-integration-tests.yml' | |
| pull_request: | |
| paths: | |
| - 'scripts/test_*.sh' | |
| - 'scripts/verify_*.sh' | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 6 * * 1" # Weekly on Monday 6 AM UTC | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # Core TOON encode/decode tests (tru only - fast, no dependencies) | |
| toon-core: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install tru (toon_rust CLI) | |
| run: cargo install --git https://github.com/Dicklesworthstone/toon_rust --locked | |
| - name: Install jq | |
| run: sudo apt-get install -y jq | |
| - name: Test tru encode/decode round-trip | |
| run: | | |
| echo '{"a": 1, "b": [true, false], "c": {"nested": "value"}}' > test.json | |
| tru --encode test.json > test.toon | |
| tru --decode test.toon > decoded.json | |
| # Verify round-trip | |
| if ! diff <(jq -S . test.json) <(jq -S . decoded.json); then | |
| echo "FAIL: Round-trip mismatch" | |
| exit 1 | |
| fi | |
| echo "PASS: tru encode/decode round-trip" | |
| - name: Test TOON_DEFAULT_FORMAT env var | |
| run: | | |
| export TOON_DEFAULT_FORMAT=toon | |
| echo '{"test": 123}' | tru > output.txt | |
| # Should be TOON format (not JSON) | |
| if head -1 output.txt | grep -q '^{'; then | |
| echo "FAIL: TOON_DEFAULT_FORMAT not respected" | |
| exit 1 | |
| fi | |
| echo "PASS: TOON_DEFAULT_FORMAT respected" | |
| - name: Test key folding | |
| run: | | |
| echo '{"config": {"db": {"host": "localhost", "port": 5432}}}' | tru --encode --key-folding safe > folded.toon | |
| grep -q "config.db" folded.toon && echo "PASS: Key folding works" | |
| - name: Test tabular arrays | |
| run: | | |
| echo '[{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]' | tru --encode > tabular.toon | |
| tru --decode tabular.toon | jq -e '.[0].id == 1' >/dev/null | |
| echo "PASS: Tabular arrays work" | |
| # Script syntax validation (shellcheck) | |
| lint-scripts: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install shellcheck | |
| run: sudo apt-get install -y shellcheck | |
| - name: Lint test scripts | |
| run: | | |
| cd scripts | |
| for script in test_*.sh verify_*.sh check_*.sh; do | |
| if [[ -f "$script" ]]; then | |
| echo "Checking $script..." | |
| shellcheck -x "$script" || echo "WARN: $script has shellcheck issues" | |
| fi | |
| done | |
| # Full integration tests (requires all tools - manual trigger or self-hosted) | |
| full-integration: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| if: github.event_name == 'workflow_dispatch' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install core dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y jq | |
| - name: Install tru | |
| run: cargo install --git https://github.com/Dicklesworthstone/toon_rust --locked | |
| - name: Install br (beads_rust) | |
| run: cargo install --git https://github.com/Dicklesworthstone/beads_rust --locked | |
| continue-on-error: true | |
| - name: Note about full integration | |
| run: | | |
| echo "===========================================" | |
| echo "TOON FULL INTEGRATION TEST NOTES" | |
| echo "===========================================" | |
| echo "" | |
| echo "Full cross-tool integration tests require:" | |
| echo " - All Dicklesworthstone tools installed" | |
| echo " - Properly configured indexes (cass, xf)" | |
| echo " - Test fixtures and workspaces" | |
| echo "" | |
| echo "For complete testing, run locally:" | |
| echo " /data/projects/scripts/test_full_integration.sh" | |
| echo "" | |
| echo "Individual test scripts:" | |
| echo " test_cross_tool_interop.sh - TOON encoding/decoding" | |
| echo " check_robot_help_consistency.sh - Help patterns" | |
| echo " test_error_consistency.sh - Exit codes" | |
| echo " verify_token_savings.sh - Token reduction" | |
| echo "" | |
| echo "Core tru tests passed in toon-core job." |