Fix rust-src component by specifying nightly toolchain version in bui… #12
This file contains hidden or 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-wasm | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "vendor/**" | |
- "transpiler/**" | |
- "wasm_binding/**" | |
- ".github/workflows/build-wasm.yml" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "vendor/**" | |
- "transpiler/**" | |
- "wasm_binding/**" | |
- ".github/workflows/build-wasm.yml" | |
env: | |
VERSION: 0.1.${{ github.run_number }} | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-wasm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: jetli/wasm-pack-action@v0.4.0 | |
with: | |
version: 'latest' | |
- name: Install rust toolchain nightly | |
run: rustup override set nightly-2024-04-17 | |
- name: Output rust version for verification | |
run: rustup --version | |
- name: Add wasm32 target | |
run: rustup target add wasm32-unknown-unknown | |
- name: fix rust-src | |
run: rustup component add rust-src --toolchain nightly-2023-09-19-x86_64-unknown-linux-gnu | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
wasm_binding/target | |
key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build | |
run: | | |
cd wasm_binding && wasm-pack build --target web --release | |
- name: Add version info | |
run: | | |
echo ${VERSION}>wasm_binding/pkg/version.txt | |
- name: Upload wasm artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wasm | |
path: wasm_binding/pkg |