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
39 changes: 37 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,44 @@ jobs:
env:
RUSTDOCFLAGS: -Dwarnings

wasm:
name: WASM Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-wasm-

- name: Check WASM crate compiles
run: cargo check -p fugue-evo-wasm --target wasm32-unknown-unknown

- name: Build WASM package
run: wasm-pack build crates/fugue-evo-wasm --target web

- name: Run WASM tests (Node.js)
run: wasm-pack test --node crates/fugue-evo-wasm

# Summary job that depends on all other jobs
ci-success:
name: CI Success
needs: [check, fmt, clippy, test, doc]
needs: [check, fmt, clippy, test, doc, wasm]
runs-on: ubuntu-latest
if: always()
steps:
Expand All @@ -135,7 +169,8 @@ jobs:
[[ "${{ needs.fmt.result }}" != "success" ]] || \
[[ "${{ needs.clippy.result }}" != "success" ]] || \
[[ "${{ needs.test.result }}" != "success" ]] || \
[[ "${{ needs.doc.result }}" != "success" ]]; then
[[ "${{ needs.doc.result }}" != "success" ]] || \
[[ "${{ needs.wasm.result }}" != "success" ]]; then
echo "One or more jobs failed"
exit 1
fi
Expand Down
152 changes: 105 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 20 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[workspace]
members = [".", "crates/fugue-evo-wasm"]

[package]
name = "fugue-evo"
version = "0.1.0"
Expand All @@ -9,6 +12,12 @@ repository = "https://github.com/alexnodeland/fugue-evo"
keywords = ["genetic-algorithm", "evolution", "optimization", "probabilistic-programming"]
categories = ["algorithms", "science"]

[features]
default = ["std", "parallel", "checkpoint"]
std = []
parallel = ["rayon"]
checkpoint = [] # File-based checkpointing (requires std)

[dependencies]
# Linear algebra for CMA-ES
nalgebra = "0.33"
Expand All @@ -17,27 +26,33 @@ nalgebra = "0.33"
rand = "0.8"
rand_distr = "0.4"

# Parallelism
rayon = "1.10"
# Parallelism (optional)
rayon = { version = "1.10", optional = true }

# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
bincode = "1.3"

# Compression for checkpoints
zstd = "0.13"

# Error handling
thiserror = "2.0"

# Observability
tracing = "0.1"
fugue-ppl = "0.1.0"

# WASM support (enabled via getrandom js feature when targeting wasm32)
[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] }

[dev-dependencies]
# Testing utilities
proptest = "1.5"
criterion = "0.5"
approx = "0.5"
tempfile = "3.10"

# Examples requiring parallel feature
[[example]]
name = "island_model"
required-features = ["parallel"]
Loading