-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (83 loc) · 2.72 KB
/
build.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Build
on:
push:
branches:
- dev
- main
- release-*
- feat-*
- ci-*
- refactor-*
- fix-*
- test-*
paths:
- ".github/workflows/build.yml"
- "**/Cargo.toml"
- "**/Cargo.lock"
- "**/*.rs"
- "**/*.sh"
pull_request:
branches:
- dev
- main
types: [opened, synchronize, reopened]
paths:
- ".github/workflows/build.yml"
- "**/Cargo.toml"
- "**/*.rs"
- "**/*.sh"
jobs:
build-wasm:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-13, macos-14]
steps:
- name: Clone project
id: checkout
uses: actions/checkout@v3
- name: Install Rust-nightly
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
target: wasm32-wasip1
components: rustfmt, clippy
- name: Install Rust-stable
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-wasip1
- name: Download wasi-sdk for x86_64-macos
if: matrix.os == 'macos-13'
run: |
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-x86_64-macos.tar.gz
tar -xzvf wasi-sdk-24.0-x86_64-macos.tar.gz
mv wasi-sdk-24.0-x86_64-macos wasi-sdk-24.0
- name: Download wasi-sdk for arm64-macos
if: matrix.os == 'macos-14'
run: |
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-arm64-macos.tar.gz
tar -xzvf wasi-sdk-24.0-arm64-macos.tar.gz
mv wasi-sdk-24.0-arm64-macos wasi-sdk-24.0
- name: Clippy and fmt check
if: startsWith(matrix.os, 'ubuntu')
env:
RUSTFLAGS: "--cfg wasmedge --cfg tokio_unstable"
run: |
cargo +nightly fmt --all -- --check
cargo +nightly clippy --target wasm32-wasip1 -- -D warnings
- name: Build api-server for linux
id: build_api_server_linux
if: startsWith(matrix.os, 'ubuntu')
env:
RUSTFLAGS: "--cfg wasmedge --cfg tokio_unstable"
run: |
cargo build --target wasm32-wasip1 --release
- name: Build api-server for macos
id: build_api_server_macos
if: startsWith(matrix.os, 'macos')
env:
WASI_SDK_PATH: /Users/runner/work/sd-api-server/sd-api-server/wasi-sdk-24.0
CC: "/Users/runner/work/sd-api-server/sd-api-server/wasi-sdk-24.0/bin/clang --sysroot=/Users/runner/work/sd-api-server/sd-api-server/wasi-sdk-24.0/share/wasi-sysroot"
RUSTFLAGS: "--cfg wasmedge --cfg tokio_unstable"
run: |
cargo build --target wasm32-wasip1 --release