feat: dockerfile for easy local wasm #12
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: Rust WASM CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup env | |
run: rustup toolchain install nightly && rustup default nightly && rustup target add wasm32-unknown-emscripten | |
- name: Install EMCC | |
run: git clone https://github.com/emscripten-core/emsdk.git && cd ./emsdk && ./emsdk install latest && ./emsdk activate latest | |
- name: Build | |
run: cd ./emsdk && source emsdk_env.sh && cd .. && ./build_wasm.sh | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Clean Output | |
run: mkdir www && cp index.html ./www/ && cp ./target/wasm32-unknown-emscripten/release/spline-drawer.d ./www/ && cp ./target/wasm32-unknown-emscripten/release/spline-drawer.js ./www/ && cp ./target/wasm32-unknown-emscripten/release/spline_drawer.wasm ./www/ | |
- name: Upload Artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: "./www" | |
deploy-coverage: | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
# environment created automatically by GitHub | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |