-
Notifications
You must be signed in to change notification settings - Fork 19
68 lines (64 loc) · 2.24 KB
/
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
name: WASM
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
name: Build target ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
matrix:
target:
- wasm32-unknown-unknown
- wasm32-wasi
steps:
- uses: actions/checkout@v4
with:
path: crates
# We use a synthetic crate to ensure no dev-dependencies are enabled, which can
# be incompatible with some of these targets.
- name: Create synthetic crate for testing
run: cargo init --lib ci-build
- name: Copy Rust version into synthetic crate
run: cp crates/rust-toolchain.toml ci-build/
- name: Copy patch directives into synthetic crate
run: |
echo "[patch.crates-io]" >> ./ci-build/Cargo.toml
cat ./crates/Cargo.toml | sed "0,/.\+\(patch.crates.\+\)/d" >> ./ci-build/Cargo.toml
- name: Add atrium-api as a dependency of the synthetic crate
working-directory: ./ci-build
run: >
cargo add
--path ../crates/atrium-api
- name: Add atrium-xrpc as a dependency of the synthetic crate
working-directory: ./ci-build
run: >
cargo add
--path ../crates/atrium-xrpc
- name: Add atrium-xrpc-client as a dependency of the synthetic crate
working-directory: ./ci-build
run: >
cargo add
--path ../crates/atrium-xrpc-client
- name: Copy pinned dependencies into synthetic crate
run: cp crates/Cargo.lock ci-build/
- name: Add target
working-directory: ./ci-build
run: rustup target add ${{ matrix.target }}
- name: Build for target
working-directory: ./ci-build
run: cargo build --verbose --target ${{ matrix.target }}
tests:
name: Testing with wasm-bindgen-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Add target
run: rustup target add wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- run: wasm-pack test --node atrium-api
- run: wasm-pack test --node atrium-xrpc
- run: wasm-pack test --node atrium-xrpc-client