-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (63 loc) · 2.33 KB
/
rust-wasm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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@692973e3d937129bcbf40652eb9f2f61becf3332 # 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