feat(ci): add Julia, R, C, C++ to CI workflow + run all ports in wolfram_verify.py

AVM CI now tests: Python, Go, Rust, C, C++, Julia, R (7 languages)
Wolfram verify script extended to attempt all available language ports
and report status for each.

All ports verified against the same arithmetic spec:
- INT32_MAX, Q16 scale, negation involution, floor division
This commit is contained in:
allaun 2026-06-30 18:03:30 -05:00
parent b305b634f3
commit c4619d0d97
2 changed files with 65 additions and 29 deletions

View file

@ -3,12 +3,17 @@ name: AVM ISA Cross-Port CI
on: on:
push: push:
paths: paths:
- 'python/avm.py' - 'python/**'
- 'go/avm.go' - 'go/**'
- 'rust/src/avm/**' - 'rust/src/**'
- 'c/avm.c' - 'c/**'
- 'cpp/avm.hpp' - 'cpp/**'
- 'julia/**'
- 'r/**'
- 'fortran/**' - 'fortran/**'
- 'octave/**'
- 'scala/**'
- 'coq/**'
- 'tests/**' - 'tests/**'
- 'scripts/wolfram_verify.py' - 'scripts/wolfram_verify.py'
workflow_dispatch: workflow_dispatch:
@ -18,16 +23,18 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-python@v5 with: { python-version: '3.12' } - uses: actions/setup-python@v5
- name: Run Python AVM tests with: { python-version: '3.12' }
run: PYTHONPATH=python python3 -m pytest tests/test_avm_python.py -v - name: Python AVM tests
run: PYTHONPATH=python python3 tests/test_avm_python.py
go: go:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-go@v5 with: { go-version: '1.26' } - uses: actions/setup-go@v5
- name: Run Go AVM tests with: { go-version: '1.26' }
- name: Go AVM tests
run: go test -v ./go/ run: go test -v ./go/
rust: rust:
@ -35,32 +42,45 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Run Rust AVM tests - name: Rust AVM tests
run: cd rust && cargo test run: cd rust && cargo test
c: c:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build and run C AVM tests - name: C AVM tests
run: | run: gcc -o /tmp/c_avm c/test_avm.c -lm && /tmp/c_avm
gcc -o c/test_avm c/test_avm.c -lm
./c/test_avm
cpp: cpp:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build and run C++ AVM tests - name: C++ AVM tests
run: | run: g++ -std=c++17 -o /tmp/cpp_avm cpp/test_avm.cpp && /tmp/cpp_avm
g++ -std=c++20 -o cpp/test_avm cpp/test_avm.cpp
./cpp/test_avm julia:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
- name: Julia AVM tests
run: julia julia/AVMIsa/test_avm.jl
r:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
- name: R AVM tests
run: Rscript r/AVMIsa/test_avm.r
wolfram-verify: wolfram-verify:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-python@v5 with: { python-version: '3.12' } - uses: actions/setup-python@v5
with: { python-version: '3.12' }
- name: Wolfram Alpha verification - name: Wolfram Alpha verification
run: python3 scripts/wolfram_verify.py run: python3 scripts/wolfram_verify.py
env: env:
@ -68,8 +88,8 @@ jobs:
cross-verify: cross-verify:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [python, go, rust, c, cpp] needs: [python, go, rust, c, cpp, julia, r]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: All AVM ports passed - name: All AVM ports passed
run: echo "✅ All AVM ISA port tests passed" run: echo "✅ All AVM ISA port tests passed (Python, Go, Rust, C, C++, Julia, R)"

View file

@ -36,18 +36,34 @@ def verify_arithmetic():
return results return results
def run_port_tests(): def run_port_tests():
"""Run all AVM port test harnesses and collect results.""" """Run ALL AVM port test harnesses."""
import shutil
results = {} results = {}
# Each port: (name, [cmd, args...], working_dir_relative, env_add)
ports = [ ports = [
("Python", [sys.executable, "tests/test_avm_python.py"], {"cwd": SILVER, "env": {**os.environ, "PYTHONPATH": str(SILVER / "python")}}), ("Python", [sys.executable, "tests/test_avm_python.py"], ".", {"PYTHONPATH": str(SILVER / "python")}),
("Rust", ["cargo", "test"], {"cwd": SILVER / "rust"}), ("Rust", ["cargo", "test"], "rust", {}),
("Go", ["go", "test", "-v", "./go/"], ".", {}),
("C", ["sh", "-c", "gcc -o /tmp/c_avm_test c/test_avm.c -lm && /tmp/c_avm_test"], ".", {}),
("C++", ["sh", "-c", "g++ -std=c++20 -o /tmp/cpp_avm_test cpp/test_avm.cpp && /tmp/cpp_avm_test"], ".", {}),
("Julia", ["julia", "julia/AVMIsa/test_avm.jl"], ".", {}),
("R", ["Rscript", "r/AVMIsa/test_avm.r"], ".", {}),
("Octave", ["octave", "--no-gui", "octave/test_avm.m"], ".", {}),
] ]
for name, cmd, kw in ports:
for name, cmd, wd, env_add in ports:
exe = cmd[0]
if not shutil.which(exe.split()[0] if '/' in exe else exe):
results[name] = {"passed": False, "skipped": True, "reason": f"{exe} not found"}
continue
try: try:
r = subprocess.run(cmd, capture_output=True, text=True, timeout=60, **kw) env = {**os.environ, **env_add}
results[name] = {"passed": r.returncode == 0, "output": r.stdout[-200:]} r = subprocess.run(cmd, capture_output=True, text=True, timeout=120, cwd=SILVER / wd, env=env)
ok = r.returncode == 0 and ("fail" not in r.stdout.lower() and "error" not in r.stdout.lower()[:500])
results[name] = {"passed": ok, "output": r.stdout[-300:]}
except Exception as e: except Exception as e:
results[name] = {"passed": False, "error": str(e)} results[name] = {"passed": False, "error": str(e)[:200]}
return results return results
def main(): def main():