Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 42 additions & 67 deletions .github/workflows/brain-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
- cron: '0 0 * * 0'

env:
ZIG_VERSION: "0.15.2"
BRAIN_HEALTH_THRESHOLD: "80" # Minimum health score for merge
STRESS_TEST_THRESHOLD: "270" # Minimum stress test score (270/300 = 90%)

Expand All @@ -24,13 +23,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Install Zig
run: |
wget -q https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz
tar -xf zig-linux-x86_64-${ZIG_VERSION}.tar.xz
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zig /usr/local/bin/
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zigmCache /usr/local/bin/
zig version
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Checkout Trinity
uses: actions/checkout@v4
Expand All @@ -39,7 +35,7 @@ jobs:

- name: Build TRI Binary
run: |
zig build tri
zig build tri -Dci=true

- name: Run Brain Health Check
id: health
Expand Down Expand Up @@ -125,22 +121,19 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Install Zig
run: |
wget -q https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz
tar -xf zig-linux-x86_64-${ZIG_VERSION}.tar.xz
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zig /usr/local/bin/
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zigmCache /usr/local/bin/
zig version
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Checkout Trinity
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build All Binaries
- name: Build TRI Binary
run: |
zig build
zig build tri -Dci=true

# =========================================================================
# Phase 2: Unit Tests — Individual Brain Regions
Expand All @@ -160,13 +153,10 @@ jobs:
- intraparietal
- hslm
steps:
- name: Install Zig
run: |
wget -q https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz
tar -xf zig-linux-x86_64-${ZIG_VERSION}.tar.xz
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zig /usr/local/bin/
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zigmCache /usr/local/bin/
zig version
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Checkout Trinity
uses: actions/checkout@v4
Expand All @@ -175,7 +165,7 @@ jobs:

- name: Test ${{ matrix.region }}
run: |
zig build test-${{ matrix.region }}
zig build test-${{ matrix.region }} -Dci=true

# =========================================================================
# Phase 3: Integration Test — Brain Aggregator
Expand All @@ -186,13 +176,10 @@ jobs:
needs: brain-unit
timeout-minutes: 10
steps:
- name: Install Zig
run: |
wget -q https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz
tar -xf zig-linux-x86_64-${ZIG_VERSION}.tar.xz
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zig /usr/local/bin/
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zigmCache /usr/local/bin/
zig version
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Checkout Trinity
uses: actions/checkout@v4
Expand All @@ -201,7 +188,7 @@ jobs:

- name: Test Brain Integration
run: |
zig build test-brain
zig build test-brain -Dci=true

# =========================================================================
# Phase 4: Stress Test — "Functional MRI" Gate
Expand All @@ -212,13 +199,10 @@ jobs:
needs: brain-integration
timeout-minutes: 15
steps:
- name: Install Zig
run: |
wget -q https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz
tar -xf zig-linux-x86_64-${ZIG_VERSION}.tar.xz
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zig /usr/local/bin/
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zigmCache /usr/local/bin/
zig version
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Checkout Trinity
uses: actions/checkout@v4
Expand All @@ -229,7 +213,7 @@ jobs:
id: stress
run: |
# Run stress test and capture output
zig build test-brain-stress 2>&1 | tee /tmp/stress-output.txt
zig build test-brain-stress -Dci=true 2>&1 | tee /tmp/stress-output.txt

# Extract score from output
STRESS_SCORE=$(grep "Score:" /tmp/stress-output.txt | tail -1 | grep -oE "[0-9]+" || echo "0")
Expand Down Expand Up @@ -331,13 +315,10 @@ jobs:
needs: brain-stress
timeout-minutes: 5
steps:
- name: Install Zig
run: |
wget -q https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz
tar -xf zig-linux-x86_64-${ZIG_VERSION}.tar.xz
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zig /usr/local/bin/
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zigmCache /usr/local/bin/
zig version
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Checkout Trinity
uses: actions/checkout@v4
Expand All @@ -346,7 +327,7 @@ jobs:

- name: Build TRI Binary
run: |
zig build tri
zig build tri -Dci=true

- name: CLI Commands Test
run: |
Expand All @@ -373,13 +354,10 @@ jobs:
if: always()
timeout-minutes: 5
steps:
- name: Install Zig
run: |
wget -q https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz
tar -xf zig-linux-x86_64-${ZIG_VERSION}.tar.xz
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zig /usr/local/bin/
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zigmCache /usr/local/bin/
zig version
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Checkout Trinity
uses: actions/checkout@v4
Expand All @@ -388,7 +366,7 @@ jobs:

- name: Build TRI Binary
run: |
zig build tri
zig build tri -Dci=true

- name: Export Metrics
run: |
Expand Down Expand Up @@ -471,13 +449,10 @@ jobs:
if: github.event_name == 'schedule'
timeout-minutes: 10
steps:
- name: Install Zig
run: |
wget -q https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz
tar -xf zig-linux-x86_64-${ZIG_VERSION}.tar.xz
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zig /usr/local/bin/
sudo mv zig-linux-x86_64-${ZIG_VERSION}/zigmCache /usr/local/bin/
zig version
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Checkout Trinity
uses: actions/checkout@v4
Expand All @@ -486,11 +461,11 @@ jobs:

- name: Build TRI Binary
run: |
zig build tri
zig build tri -Dci=true

- name: Run Full Stress Test
run: |
zig build test-brain-stress 2>&1 | tee /tmp/weekly-stress.txt
zig build test-brain-stress -Dci=true 2>&1 | tee /tmp/weekly-stress.txt

- name: Record Weekly Snapshot
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: zig build -Dci=true --summary all

- name: Test
run: zig build test --summary all
run: zig build test -Dci=true --summary all

- name: Telegram notify
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
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
zig build test -Dci=true 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"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fpga-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:

- name: Build and run tests
run: |
zig build test 2>&1 | tee test-output.txt
zig build test -Dci=true 2>&1 | tee test-output.txt

- name: Check test results
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fpga-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:

- name: "🏗️ Build Trinity"
run: |
zig build 2>&1 || echo "⚠️ Build warnings present"
zig build -Dci=true 2>&1 || echo "⚠️ Build warnings present"
echo "✅ Trinity build complete"

- name: "🧠 Run FPGA Tests (${{ matrix.consciousness }})"
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/pre-commit-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,30 @@ jobs:
name: Code Format Validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Check zig fmt
run: |
git diff --name-only --cached --diff-filter=M '*.zig' | grep '^A.*zig$' | xargs zig fmt --check
if [ $? -ne 0 ]; then
echo "❌ Code not formatted. Run: zig fmt src/"
exit 1
FILES=$(git diff --name-only origin/main...HEAD -- '*.zig' || true)
if [ -n "$FILES" ]; then
echo "$FILES" | xargs zig fmt --check
if [ $? -ne 0 ]; then
echo "Code not formatted. Run: zig fmt src/"
exit 1
fi
fi
echo "All zig code formatted"
echo "All zig code formatted"

- name: Check whitespace
run: |
TRAILING=$(git diff --cached HEAD -- '*.zig' | grep -E '^\+.*$' | wc -l)
TRAILING=$(git diff origin/main...HEAD -- '*.zig' | grep -E '^\+.*[[:space:]]$' | wc -l)
if [ "$TRAILING" -gt 0 ]; then
echo "Trailing whitespace detected"
echo "Trailing whitespace detected"
exit 1
fi
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ fpga/openxc7-synth/forge_ref.bit
fpga/openxc7-synth/*.json
fpga/fly-vivado/output/

# Generated segbits data (7MB+, regenerate with: python3 tools/gen_segbits.py)
src/forge/segbits_data.zig
# Generated segbits data — stub is tracked, full data (7MB+) is generated by:
# python3 tools/gen_segbits.py --part xc7a100t
# Do NOT add the full generated file to git. The stub provides compile-time API.

# Microsoft model weights
data/models/microsoft-bitnet-2b/
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "zig-half"]
path = tools/bin/repo-root/zig-half
url = /Users/playra/zig-half
44 changes: 4 additions & 40 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ pub fn build(b: *std.Build) void {
.root_source_file = b.path("src/queen_api.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
}),
});
const run_queen_api_tests = b.addRunArtifact(queen_api_tests);
Expand Down Expand Up @@ -249,46 +250,6 @@ pub fn build(b: *std.Build) void {
const run_vm_tests = b.addRunArtifact(vm_tests);
test_step.dependOn(&run_vm_tests.step);

// VM Core Consolidation Tests (Phase 1)
const vm_core_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/vm/core/vm_core.zig"),
.target = target,
.optimize = optimize,
}),
});
const vm_memory_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/vm/core/vm_memory.zig"),
.target = target,
.optimize = optimize,
}),
});
const vm_dispatch_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/vm/core/vm_dispatch.zig"),
.target = target,
.optimize = optimize,
}),
});
const vm_test_utils_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/vm/core/vm_test_utils.zig"),
.target = target,
.optimize = optimize,
}),
});

const run_vm_core_tests = b.addRunArtifact(vm_core_tests);
const run_vm_memory_tests = b.addRunArtifact(vm_memory_tests);
const run_vm_dispatch_tests = b.addRunArtifact(vm_dispatch_tests);
const run_vm_test_utils_tests = b.addRunArtifact(vm_test_utils_tests);

test_step.dependOn(&run_vm_core_tests.step);
test_step.dependOn(&run_vm_memory_tests.step);
test_step.dependOn(&run_vm_dispatch_tests.step);
test_step.dependOn(&run_vm_test_utils_tests.step);

// E2E + Benchmarks + Verdict tests (Phase 4)
const e2e_tests = b.addTest(.{
.root_module = b.createModule(.{
Expand All @@ -308,6 +269,7 @@ pub fn build(b: *std.Build) void {
.root_source_file = b.path("src/c_api.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
}),
});
const run_c_api_tests = b.addRunArtifact(c_api_tests);
Expand Down Expand Up @@ -2599,6 +2561,7 @@ pub fn build(b: *std.Build) void {
.root_source_file = b.path("src/tri/main.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "trinity_workspace", .module = trinity_workspace_mod },
.{ .name = "trinity_swe", .module = vibeec_swe },
Expand Down Expand Up @@ -3624,6 +3587,7 @@ pub fn build(b: *std.Build) void {
.root_source_file = b.path("src/tri/sacred_alu.zig"),
.target = target,
.optimize = .ReleaseFast,
.link_libc = true,
}),
});
b.installArtifact(sacred);
Expand Down
Loading
Loading