Install wasm ig #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Test | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-x86: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: cargo build --verbose | |
- name: Test | |
run: cargo test --verbose | |
build-wasm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Target | |
run: rustup target add wasm32-unknown-unknown | |
- name: Build | |
run: cargo build --verbose --target wasm32-unknown-unknown | |
- name: Test | |
run: cargo test --verbose --target wasm32-unknown-unknown | |
build-deploy-release: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
needs: build-wasm | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Target | |
run: rustup target add wasm32-unknown-unknown | |
- name: Install Bindgen | |
uses: jetli/[email protected] | |
- name: Build | |
run: cargo build --release --target wasm32-unknown-unknown | |
- name: Copy Assets | |
run: mkdir -p serve/app && { cp -r assets imported_assets serve/static/app || true; } | |
- name: Run Bindgen | |
run: wasm-bindgen --target web --out-dir serve/static/app --out-name stratmat target/wasm32-unknown-unknown/release/stratmat.wasm | |
- name: Deploy | |
uses: ptienchuan/[email protected] | |
with: | |
source-directory: serve | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |