Merge pull request #589 from KisaragiEffective/renovate/swatinem-rust… #187
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: WebAssembly | |
on: | |
push: | |
branches: [ "master" ] | |
paths: | |
- package/origlang-interop/**/* | |
- package/origlang-interop-frontend-webserver/**/* | |
- .github/workflows/rust-wasm.yml | |
pull_request: | |
branches: [ "master" ] | |
paths: | |
- package/origlang-interop/**/* | |
- package/origlang-interop-frontend-webserver/**/* | |
- .github/workflows/rust-wasm.yml | |
env: | |
CARGO_TERM_COLOR: always | |
CI_RUST_CACHE_VERSION: v0 | |
permissions: | |
contents: read | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-24.04 | |
wasmpack_target_triple: x86_64-unknown-linux-musl | |
wasmpack_name: wasm-pack | |
- os: windows-2022 | |
wasmpack_target_triple: x86_64-pc-windows-msvc | |
wasmpack_name: wasm-pack.exe | |
# FIXME: windows does not recognize /usr/local/bin, causing build to be failed | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Rust Cache | |
uses: Swatinem/[email protected] | |
with: | |
prefix-key: ${{ matrix.os }}-${{ env.CI_RUSTC_VERSION }}-${{ env.CI_RUST_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}-wasm | |
# If it requires full-build, wasm-pack is required to build origlang-interop. | |
- name: Install wasm-pack | |
shell: bash | |
run: | | |
# renovate: wasm-pack | |
git_tag="v0.11.0" | |
tt="${{ matrix.wasmpack_target_triple }}" | |
exe_name="${{ matrix.wasmpack_name }}" | |
d="$(mktemp)" | |
f="wasm-pack-${git_tag}-${tt}" | |
curl -L "https://github.com/rustwasm/wasm-pack/releases/download/$git_tag/${f}.tar.gz" > "$d" | |
e="${f}/${exe_name}" | |
tar xf "$d" "$e" | |
chmod +x "$e" | |
# Windows' bash does not have "/usr/local/bin" | |
(mv "$e" /usr/local/bin || mv "$e" /usr/bin) && ("${e}" --version || true) | |
rm "$d" | |
- name: Build origlang-interop (pre) | |
shell: bash | |
run: $GITHUB_WORKSPACE/package/origlang-interop/build.sh | |
- name: Build origlang-interop and origlang-interop-frontend-webserver | |
run: cargo build -p origlang-interop -p origlang-interop-frontend-webserver --verbose | |
- name: Run tests | |
run: cargo test -p origlang-interop -p origlang-interop-frontend-webserver --verbose |