docs(readme): TRI-27 as Trinity Core Kernel (#411) #1355
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Author attribution guard | |
| run: zig build author-guard -Dci=true | |
| - name: Build | |
| run: | | |
| # Build with -Dci=true to skip GUI targets requiring raylib | |
| zig build -Dci=true | |
| # P0.4: Memory leak detection via Zig's General Purpose Allocator (GPA). | |
| # Any memory leaks will cause the test to fail with a "leaked" error message. | |
| # This is a HARD GATE - the build will fail if any tests leak memory. | |
| # The leak checking is enabled by using std.testing.allocator in tests. | |
| # Additional runtime leak checking can be enabled with --zig-lib-dir. | |
| - name: Test (with leak detection) | |
| run: | | |
| # Run tests with Zig's built-in leak detection | |
| # Tests using std.testing.allocator will automatically detect leaks | |
| zig build test 2>&1 | tee test-output.txt | |
| # Check for any memory leak indicators | |
| if grep -i "leak\|memory.*leak\|allocation.*leak" test-output.txt; then | |
| echo "::error::Memory leaks detected in tests" | |
| exit 1 | |
| fi | |
| - name: Format check | |
| run: | | |
| # Check core modules that compile (skip WIP/broken files) | |
| # Exclude src/vsa/trinity_canvas/ — generated files with non-standard syntax | |
| zig fmt --check src/vsa.zig src/vm.zig src/hybrid.zig src/trinity.zig \ | |
| src/bsd/ src/hslm/ src/vsa/*.zig src/vsa/agent/ tools/mcp/ | |
| # P0.4: Explicit leak check for critical modules | |
| - name: Leak check critical modules | |
| run: | | |
| # Test modules with explicit allocator checking | |
| zig test src/tri/job_system.zig | |
| zig test src/tri/unified_output.zig | |
| zig test src/registry/command_table.zig | |
| # P1.6: Schema drift detection - Registry must be exported from code | |
| - name: Registry schema check | |
| run: | | |
| # Export registry to temporary location | |
| zig build export-registry 2>&1 | |
| # Compare with committed registry (if exists) | |
| if [ -f .trinity/registry.json ]; then | |
| # Move generated registry to temp file for comparison | |
| mv .trinity/registry.json .trinity/registry.json.generated | |
| # Restore original and compare (ignore generated_at timestamp) | |
| git restore .trinity/registry.json 2>/dev/null || true | |
| # Strip volatile generated_at field before comparison | |
| sed 's/"generated_at":"[0-9]*"/"generated_at":"0"/g' .trinity/registry.json > /tmp/reg_committed.json | |
| sed 's/"generated_at":"[0-9]*"/"generated_at":"0"/g' .trinity/registry.json.generated > /tmp/reg_generated.json | |
| if ! diff -q /tmp/reg_committed.json /tmp/reg_generated.json; then | |
| echo "::error::Registry schema drift detected!" | |
| echo "The committed .trinity/registry.json does not match the generated one." | |
| echo "Run 'zig build export-registry' and commit the updated registry." | |
| echo "" | |
| echo "Diff:" | |
| diff /tmp/reg_committed.json /tmp/reg_generated.json || true | |
| exit 1 | |
| fi | |
| # Clean up | |
| rm .trinity/registry.json.generated /tmp/reg_committed.json /tmp/reg_generated.json | |
| else | |
| echo "::warning::No .trinity/registry.json in repo. Run 'zig build export-registry' and commit it." | |
| fi | |
| # P1.6: MCP schema drift detection - MCP schemas must be exported from code | |
| # continue-on-error: tri binary segfaults on Linux (tvc_corpus init bug) | |
| - name: MCP schema check | |
| continue-on-error: true | |
| run: | | |
| # Export MCP schemas using tri mcp export command | |
| ./zig-out/bin/tri mcp export .trinity/mcp_schemas.json.generated 2>&1 | |
| # Compare with committed MCP schemas (if exists) | |
| if [ -f .trinity/mcp_schemas.json ]; then | |
| if ! diff -q .trinity/mcp_schemas.json .trinity/mcp_schemas.json.generated; then | |
| echo "::error::MCP schema drift detected!" | |
| echo "The committed .trinity/mcp_schemas.json does not match the generated one." | |
| echo "Run './zig-out/bin/tri mcp export .trinity/mcp_schemas.json' and commit the updated schemas." | |
| echo "" | |
| echo "Diff:" | |
| diff .trinity/mcp_schemas.json .trinity/mcp_schemas.json.generated || true | |
| rm .trinity/mcp_schemas.json.generated | |
| exit 1 | |
| fi | |
| # Clean up | |
| rm .trinity/mcp_schemas.json.generated | |
| else | |
| echo "::warning::No .trinity/mcp_schemas.json in repo. Run 'tri mcp export .trinity/mcp_schemas.json' and commit it." | |
| rm .trinity/mcp_schemas.json.generated | |
| fi |