Skip to content

Commit

Permalink
Added Workflow for building WASM bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx committed Jan 24, 2024
1 parent f7f620e commit 5bb1623
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build_wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 'Build WebAssembly'

on:
push:
branches:
- master

workflow_dispatch:
inputs:
build:
description: 'Build WASM files.'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3

- name: 'Install wasm-pack'
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
export PATH="$HOME/.cargo/bin:$PATH"
- name: 'Build WebAssembly'
run: |
rustup target add wasm32-unknown-unknown
wasm-pack build --release --target web --out-name index
mkdir -p artifacts
find pkg -type f \( -name "*.js" -o -name "*.d.ts" -o -name "*.wasm" \) -exec cp {} artifacts \;
- name: 'Upload Artifacts'
uses: actions/upload-artifact@v3
with:
name: 'wasm'
path: artifacts/*
13 changes: 13 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,16 @@ lto = true
codegen-units = 1
panic = 'abort'
strip = true

[package]
name = 'grass-wasm'
edition = "2021"

[lib]
path = "crates/lib/src/lib.rs"
crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "0.2"
grass_compiler = { path = "crates/compiler" }
getrandom = { version = "0.2", features = ["js"] }

0 comments on commit 5bb1623

Please sign in to comment.