-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (37 loc) · 1.49 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
name: build library
on:
push:
branches:
- '**'
pull_request:
workflow_call:
jobs:
build-library:
runs-on: ubuntu-latest
container:
image: rust:1.81-slim-bookworm
steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -y libclang-dev clang cmake wget ninja-build nodejs npm
(cd /opt && wget -q "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-linux.tar.gz" && tar xvf wasi-sdk-16.0-linux.tar.gz)
echo "WASI_SDK_PATH=/opt/wasi-sdk-16.0" >> "$GITHUB_ENV"
rustup target add wasm32-wasi
rustup component add rustfmt clippy
- name: Checkout sources
uses: actions/checkout@v3
- name: Build
run: CC=${WASI_SDK_PATH}/bin/clang cargo build --target wasm32-wasi --release --features hterm
- name: Run C linter
run: cd c_lib && ${WASI_SDK_PATH}/bin/clang-tidy *.[ch] --warnings-as-errors='*' -- -I third_party
- name: Run C formater
run: |
cd c_lib
${WASI_SDK_PATH}/bin/clang-format --style='{BasedOnStyle: llvm, IndentWidth: 4}' *.[ch] --Werror --dry-run
- name: Run rust linter
run: CC=${WASI_SDK_PATH}/bin/clang cargo clippy --target wasm32-wasi -- -Dwarnings
- name: Run rust linter with hterm feature
run: CC=${WASI_SDK_PATH}/bin/clang cargo clippy --target wasm32-wasi --features hterm -- -Dwarnings
- name: Run Rust formater
run: cargo fmt --check