[#55011] Bump patch #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build library | |
on: [push, pull_request] | |
jobs: | |
build-library: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libclang-dev clang cmake wget ninja-build | |
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=$(pwd)/wasi-sdk-16.0" >> "$GITHUB_ENV" | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y > /dev/null 2> /dev/null | |
source $HOME/.cargo/env | |
rustup target add wasm32-wasi | |
- name: Run C linter | |
run: | | |
cd c_lib | |
TIDY_OUT=${TMPDIR:-/tmp}/clang-tidy-log.out | |
${WASI_SDK_PATH}/bin/clang-tidy *.[ch] -- -I third_party > ${TIDY_OUT} | |
cat ${TIDY_OUT} | |
if [ -s ${TIDY_OUT} ]; then | |
echo "There were clang-tidy warnings. Please fix." | |
exit 1 | |
fi | |
- name: Run C formater | |
run: | | |
cd c_lib | |
${WASI_SDK_PATH}/bin/clang-format --style="{BasedOnStyle: llvm, IndentWidth: 4}" *.[ch] -i | |
if [ -n "$(git status --porcelain --untracked-files='no')" ]; then | |
git status --porcelain --untracked-files="no" | |
echo "There were not well formated C files. Please fix." | |
exit 1 | |
fi | |
- name: Run Rust linter | |
run: | | |
source $HOME/.cargo/env | |
CLIPPY_OUT=${TMPDIR:-/tmp}/cargo-clippy-log.out | |
cargo clippy --target wasm32-wasi --features hterm --quiet 2> ${CLIPPY_OUT} | |
cargo clippy --target wasm32-wasi --quiet 2>> ${CLIPPY_OUT} | |
cat ${CLIPPY_OUT} | |
if [ -s ${CLIPPY_OUT} ]; then | |
echo "There were cargo-clippy warnings. Please fix." | |
exit 1 | |
fi | |
- name: Run Rust formater | |
run: | | |
source $HOME/.cargo/env | |
cargo fmt | |
if [ -n "$(git status --porcelain --untracked-files='no')" ]; then | |
git status --porcelain --untracked-files="no" | |
echo "There were not well formated Rust files. Please fix." | |
exit 1 | |
fi | |
- name: Setup Rust toolchain | |
run: | | |
git clone https://github.com/rust-lang/rust.git -b beta | |
cd rust | |
git apply ../canonicalize.patch | |
./configure --target=wasm32-wasi --disable-docs --set target.wasm32-wasi.wasi-root=${WASI_SDK_PATH}/share/wasi-sysroot --enable-lld --tools=cargo | |
./x.py build --target wasm32-wasi,x86_64-unknown-linux-gnu --stage 1 | |
source $HOME/.cargo/env | |
rustup toolchain link wasi_extended "$(pwd)/build/host/stage1" | |
cargo --version | |
- name: Build | |
run: | | |
source $HOME/.cargo/env | |
export CC="${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot" | |
cargo +wasi_extended build --target wasm32-wasi --release --features hterm | |