Skip to content

Merge pull request #201 from KisaragiEffective/renovate/swatinem-rust… #54

Merge pull request #201 from KisaragiEffective/renovate/swatinem-rust…

Merge pull request #201 from KisaragiEffective/renovate/swatinem-rust… #54

Workflow file for this run

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
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
wasmpack_target_triple: x86_64-unknown-linux-musl
wasmpack_name: wasm-pack
- os: windows-latest
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@v3
- 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: |
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