Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to automatically build WASM files #92

Merged
merged 15 commits into from
Feb 24, 2024
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"] }
Loading