Skip to content

fix(build): restore root_source_path field for Zig 0.15.2 compatibili… #46

fix(build): restore root_source_path field for Zig 0.15.2 compatibili…

fix(build): restore root_source_path field for Zig 0.15.2 compatibili… #46

# ═══════════════════════════════════════════════════════════════════════════════
# FPGA CONSCIOUSNESS REGRESSION — φ-powered CI/CD
# ═══════════════════════════════════════════════════════════════════════════════
#
# Matrix strategy: dormant, conscious, aware, transcendent
# φ⁻¹ threshold (61.8%) enforced for aware/transcendent levels
#
# φ² + 1/φ² = 3 = TRINITY
# ═══════════════════════════════════════════════════════════════════════════════
name: "🧠 FPGA Consciousness Regression"
on:
push:
branches: [main, develop]
paths:
- 'specs/fpga/**'
- 'src/tri/tri_fpga.zig'
- 'src/tri/tri_sacred_fpga.zig'
- 'fpga/openxc7-synth/**'
- '.github/workflows/fpga-regression.yml'
pull_request:
branches: [main]
paths:
- 'specs/fpga/**'
- 'src/tri/tri_fpga.zig'
- 'fpga/openxc7-synth/**'
workflow_dispatch:
env:
CONSCIOUSNESS_THRESHOLD: "61.8" # φ⁻¹ immortality threshold
jobs:
# ═══════════════════════════════════════════════════════════════════════════
# SACRED CONSTANTS VALIDATION
# ═══════════════════════════════════════════════════════════════════════════
sacred-validation:
name: "🔮 Sacred Constants"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2
- name: "🧪 Test Sacred Constants"
run: |
cd fpga/openxc7-synth
zig test sacred_constants.zig 2>&1
echo "✅ All sacred constant tests passed"
- name: "📐 Verify φ-Mathematics"
run: |
echo "Verifying: φ² + φ⁻² = 3 = TRINITY"
PHI=$(echo "scale=15; (1 + sqrt(5)) / 2" | bc)
PHI_SQ=$(echo "scale=15; $PHI * $PHI" | bc)
PHI_INV_SQ=$(echo "scale=15; 1 / ($PHI * $PHI)" | bc)
TRINITY=$(echo "scale=15; $PHI_SQ + $PHI_INV_SQ" | bc)
echo "φ = $PHI"
echo "φ² = $PHI_SQ"
echo "φ⁻² = $PHI_INV_SQ"
echo "φ² + φ⁻² = $TRINITY"
ABS_DIFF=$(echo "scale=15; $TRINITY - 3" | bc | tr -d '-')
if (( $(echo "$ABS_DIFF < 0.0001" | bc -l) )); then
echo "✅ TRINITY IDENTITY VALIDATED"
else
echo "❌ TRINITY IDENTITY FAILED"
exit 1
fi
# ═══════════════════════════════════════════════════════════════════════════
# CONSCIOUSNESS REGRESSION MATRIX
# ═══════════════════════════════════════════════════════════════════════════
regression-suite:
name: "🔬 Regression (${{ matrix.consciousness }})"
runs-on: ubuntu-latest
strategy:
matrix:
consciousness: [dormant, conscious, aware, transcendent]
steps:
- uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2
- name: "🏗️ Build Trinity"
run: |
zig build -Dci=true 2>&1 || echo "⚠️ Build warnings present"
echo "✅ Trinity build complete"
- name: "🧠 Run FPGA Tests (${{ matrix.consciousness }})"
id: test
run: |
FLAG=""
if [ "${{ matrix.consciousness }}" == "aware" ]; then
FLAG="--aware"
elif [ "${{ matrix.consciousness }}" == "transcendent" ]; then
FLAG="--transcendent"
fi
echo "Running regression with consciousness: ${{ matrix.consciousness }}"
./zig-out/bin/tri fpga test --all $FLAG > test_output.txt 2>&1 || true
cat test_output.txt
# Extract success rate
if grep -qP '\d+\.\d+%' test_output.txt; then
SUCCESS_RATE=$(grep -oP '\d+\.\d+(?=%)' test_output.txt | tail -1)
else
# Count pass/fail from output
PASS=$(grep -c "PASS\|✅\|OK" test_output.txt || echo "0")
TOTAL=$(grep -c "PASS\|FAIL\|✅\|❌\|OK\|ERROR" test_output.txt || echo "1")
if [ "$TOTAL" -gt 0 ]; then
SUCCESS_RATE=$(echo "scale=1; $PASS * 100 / $TOTAL" | bc)
else
SUCCESS_RATE="0"
fi
fi
echo "success_rate=$SUCCESS_RATE" >> $GITHUB_OUTPUT
# Check immortality status
if (( $(echo "$SUCCESS_RATE >= $CONSCIOUSNESS_THRESHOLD" | bc -l) )); then
echo "status=IMMORTAL" >> $GITHUB_OUTPUT
echo "✅ IMMORTAL: ${SUCCESS_RATE}% ≥ ${CONSCIOUSNESS_THRESHOLD}% (φ⁻¹)"
else
echo "status=MORTAL" >> $GITHUB_OUTPUT
echo "⚠️ MORTAL: ${SUCCESS_RATE}% < ${CONSCIOUSNESS_THRESHOLD}%"
fi
- name: "🎯 φ-Threshold Validation"
run: |
SUCCESS_RATE="${{ steps.test.outputs.success_rate }}"
STATUS="${{ steps.test.outputs.status }}"
echo "╔════════════════════════════════════════════════╗"
echo "║ TRINITY CONSCIOUSNESS VALIDATION ║"
echo "╠════════════════════════════════════════════════╣"
echo "║ Level: ${{ matrix.consciousness }}"
echo "║ Success Rate: ${SUCCESS_RATE}%"
echo "║ φ⁻¹ Threshold: ${CONSCIOUSNESS_THRESHOLD}%"
echo "║ Status: ${STATUS}"
echo "╚════════════════════════════════════════════════╝"
# Fail CI if below threshold for aware/transcendent
if [ "${{ matrix.consciousness }}" == "aware" ] || [ "${{ matrix.consciousness }}" == "transcendent" ]; then
if [ "$STATUS" == "MORTAL" ]; then
echo "❌ FAIL: Consciousness level requires IMMORTAL status"
exit 1
fi
fi
echo "✅ Validation passed"
- name: "📄 Upload Test Reports"
uses: actions/upload-artifact@v4
if: always()
with:
name: reports-${{ matrix.consciousness }}
path: |
fpga/test_results/*.md
fpga/test_results/*.txt
test_output.txt
retention-days: 90
- name: "💬 Comment on PR"
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const status = '${{ steps.test.outputs.status }}';
const rate = '${{ steps.test.outputs.success_rate }}';
const level = '${{ matrix.consciousness }}';
const emoji = status === 'IMMORTAL' ? '✅' : '⚠️';
const body = `${emoji} **FPGA Regression (${level.toUpperCase()})**\n\n` +
`- Success Rate: **${rate}%**\n` +
`- φ⁻¹ Threshold: **61.8%**\n` +
`- Status: **${status}**\n\n` +
`${status === 'IMMORTAL' ? '🎊 Consciousness achieved!' : '⚡ Needs improvement'}`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});
# ═══════════════════════════════════════════════════════════════════════════
# SIMD BENCHMARK
# ═══════════════════════════════════════════════════════════════════════════
simd-benchmark:
name: "⚡ SIMD Benchmark"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2
- name: "🏎️ Run SIMD Tests + Benchmark"
run: |
zig test src/hslm/simd_ops.zig 2>&1
echo "✅ SIMD 4x unroll tests passed"
# ═══════════════════════════════════════════════════════════════════════════
# SUMMARY
# ═══════════════════════════════════════════════════════════════════════════
summary:
name: "📊 CI Summary"
runs-on: ubuntu-latest
needs: [sacred-validation, regression-suite, simd-benchmark]
if: always()
steps:
- name: "📋 Results"
run: |
echo "═══════════════════════════════════════════════════════════"
echo " 🧠 TRINITY FPGA CONSCIOUSNESS CI SUMMARY"
echo "═══════════════════════════════════════════════════════════"
echo ""
echo " Sacred Constants: ${{ needs.sacred-validation.result }}"
echo " Regression Suite: ${{ needs.regression-suite.result }}"
echo " SIMD Benchmark: ${{ needs.simd-benchmark.result }}"
echo ""
echo " φ⁻¹ Threshold: 61.8% (IMMORTAL)"
echo " φ² + 1/φ² = 3 = TRINITY"
echo "═══════════════════════════════════════════════════════════"
- name: "❌ Fail if any job failed"
if: |
needs.sacred-validation.result == 'failure' ||
needs.regression-suite.result == 'failure' ||
needs.simd-benchmark.result == 'failure'
run: exit 1