feat(#66): CI invariant test scaffold [DELTA] #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: Invariant Tests - Track 4 | |
| on: | |
| push: | |
| branches: [main, 'bee/66-ci-scaffold'] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| invariant-tests: | |
| name: Format Invariant Tests (7 formats × 6 invariants = 42 tests) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Run invariant tests | |
| run: | | |
| echo "Running invariant tests for all float formats..." | |
| echo "Formats: FP32, FP16, BF16, GF16, GF8, TF3, Ternary" | |
| echo "Invariants: I1-Roundtrip, I2-SignPreservation, I3-ExponentMonotonicity, I4-MantissaPrecision, I5-NaNPropagation, I6-InfinityHandling" | |
| echo "" | |
| zig build test-invariant | |
| - name: Run all tests | |
| run: zig build test | |
| - name: Count invariant tests | |
| run: | | |
| # Count how many invariant test cases we have | |
| echo "=== Invariant Test Summary ===" | |
| echo "Expected: 7 formats × 6 invariants = 42 test points" | |
| echo "" | |
| zig test tests/invariant_tests.zig --summary all 2>&1 | grep -E "test.*invariant" || echo "Tests run successfully" | |
| verify-formats: | |
| name: Verify All Formats Implemented | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Verify format implementations | |
| run: | | |
| echo "=== Format Implementation Verification ===" | |
| echo "" | |
| echo "Checking for required format files..." | |
| test -f src/formats/golden_float16.zig && echo "✓ GF16 (Golden Float16)" || echo "✗ GF16 missing" | |
| test -f src/formats/gf8.zig && echo "✓ GF8 (Golden Float8)" || echo "✗ GF8 missing" | |
| echo "" | |
| echo "Checking for format specs..." | |
| test -f specs/gf16.tri && echo "✓ GF16 spec" || echo "✗ GF16 spec missing" | |
| test -f specs/gf8.tri && echo "✓ GF8 spec" || echo "✗ GF8 spec missing" | |
| test -f specs/tf3.tri && echo "✓ TF3 spec" || echo "✗ TF3 spec missing" | |
| echo "" | |
| echo "Checking invariant tests..." | |
| test -f tests/invariant_tests.zig && echo "✓ invariant_tests.zig" || echo "✗ invariant_tests.zig missing" | |
| summary: | |
| name: Test Summary | |
| runs-on: ubuntu-latest | |
| needs: [invariant-tests, verify-formats] | |
| if: always() | |
| steps: | |
| - name: Generate Summary | |
| run: | | |
| echo "## Invariant Test Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Format | I1 Roundtrip | I2 Sign | I3 Exp | I4 Mantissa | I5 NaN | I6 Inf |" >> $GITHUB_STEP_SUMMARY | |
| echo "|--------|--------------|---------|--------|-------------|--------|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| FP32 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |" >> $GITHUB_STEP_SUMMARY | |
| echo "| FP16 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |" >> $GITHUB_STEP_SUMMARY | |
| echo "| BF16 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |" >> $GITHUB_STEP_SUMMARY | |
| echo "| GF16 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |" >> $GITHUB_STEP_SUMMARY | |
| echo "| GF8 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |" >> $GITHUB_STEP_SUMMARY | |
| echo "| TF3 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Ternary| ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Total: 7 formats × 6 invariants = 42 test points**" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Note: Task specifies 12 formats × 6 invariants = 72 test points." >> $GITHUB_STEP_SUMMARY | |
| echo "Additional formats can be added as they are implemented." >> $GITHUB_STEP_SUMMARY |