make tonbo build under wasm32 arch (#216) #7
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: WASM CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_REGISTRIES_MY_REGISTRY_INDEX: https://github.com/rust-lang/crates.io-index | |
jobs: | |
check: | |
name: Rust project wasm check | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: Run cargo clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
- name: Setup for wasm32 | |
run: | | |
rustup target add wasm32-unknown-unknown | |
- name: Run cargo build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target wasm32-unknown-unknown --no-default-features --features aws,bytes,opfs | |
- name: Install Chrome Environment | |
run: | | |
mkdir -p /tmp/chrome | |
wget $(curl https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r '.versions | sort_by(.version) | reverse | .[0] | .downloads.chrome | .[] | select(.platform == "linux64") | .url') | |
wget $(curl https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq -r '.versions | sort_by(.version) | reverse | .[0] | .downloads.chromedriver | .[] | select(.platform == "linux64") | .url') | |
unzip chromedriver-linux64.zip | |
unzip chrome-linux64.zip | |
cp -r chrome-linux64/ /tmp/chrome/ | |
cp -r chromedriver-linux64 /tmp/chrome/chromedriver | |
- name: Setup wasm-pack | |
run: | | |
cargo install wasm-pack | |
- name: Run wasm-pack test | |
run: | | |
export PATH=$PATH:/tmp/chrome/chrome-linux64/:/tmp/chrome/chromedriver-linux64/ | |
wasm-pack test --chrome --headless --test wasm --no-default-features --features aws,bytes,opfs |