ferrotherm 0.7.0

Thermodynamic computing in pure Rust: sparse energy-based models, chromatic block-Gibbs, parallel tempering, thermodynamic linear algebra, stochastic differentiable programs, a variational compiler onto device topologies, exact inference by variable elimination, planted instances with known optima, sampler certificates, and a first-class joules ledger. std-only, zero dependencies, wasm-clean, deterministic by seed.
Documentation
name: ci
on:
  push:
    branches: [main]
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Install icarus-verilog (RTL bit-exactness gate)
        run: sudo apt-get update && sudo apt-get install -y iverilog
      - name: Unit tests
        run: cargo test --release
      - name: Examples build
        run: cargo build --release --examples
      - name: Verification examples (exact-physics gates)
        run: |
          cargo run --release --example ring_tv
          cargo run --release --example onsager
  c-abi:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Build the library the header describes
        run: cargo build --release
      - name: The header compiles and links against it
        run: |
          cc -I include include/check.c -L target/release -lferrotherm -o /tmp/check
          LD_LIBRARY_PATH=target/release /tmp/check

  python:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: Build the library the bindings load
        run: cargo build --release
      - name: Python tests
        run: |
          pip install pytest
          python -m pytest python/test_model.py -q

  wasm:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: wasm32-unknown-unknown
      - name: wasm cdylib builds clean
        run: cargo build --release --lib --target wasm32-unknown-unknown
      # Not a byte comparison against a fresh build: a wasm binary is not reproducible across
      # toolchain versions, so that fails on a runner whose rustc differs from the author's and
      # says nothing about whether the artefact works. What matters is that every symbol the pages
      # reach for is present -- a missing export makes the call `undefined`, and calling undefined
      # in a click handler leaves the page looking fine and doing nothing.
      - name: the committed wasm exports everything the pages call
        run: scripts/check-wasm-exports.sh

  zig:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: mlugg/setup-zig@v2
        with:
          version: 0.16.0
      - name: Build the library the binding loads
        run: cargo build --release
      - name: Zig tests
        run: |
          set -x
          ls -la target/release/libferrotherm.* || true
          # Build and run as separate steps so a link-time problem is distinguishable from a
          # runtime one: a test that segfaults at address 0 is calling through a symbol that never
          # resolved, and `ldd` is what says so.
          zig test zig/ferrotherm.zig -I include -L target/release -lferrotherm -lc \
            -rpath "$PWD/target/release" -femit-bin=/tmp/zigtest --test-no-exec
          ldd /tmp/zigtest || true
          LD_LIBRARY_PATH="$PWD/target/release" /tmp/zigtest

  julia:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: julia-actions/setup-julia@v2
        with:
          version: "1.12"
      - name: Build the library the binding loads
        run: cargo build --release
      - name: Julia tests
        working-directory: julia/Ferrotherm
        env:
          FERROTHERM_LIB: ${{ github.workspace }}/target/release/libferrotherm.so
        run: julia --project=. -e 'using Pkg; Pkg.test()'

  editor:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: "22"
      - name: Install
        working-directory: web-tests
        run: npm install && npx playwright install --with-deps chromium
      - name: Editor tests
        working-directory: web-tests
        run: npm test