Skip to content

Commit

Permalink
[#66069] Update github CI
Browse files Browse the repository at this point in the history
  • Loading branch information
GPlaczek committed Sep 30, 2024
1 parent a7d3f76 commit 77e29ad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 87 deletions.
74 changes: 16 additions & 58 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,64 +10,22 @@ on:
jobs:
build-library:
runs-on: ubuntu-latest
container:
image: rust:1.81-slim-bookworm
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 bzip2
wget -q https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-linux.tar.gz
wget -q https://raw.githubusercontent.com/antmicro/wasi_ext_lib/main/canonicalize.patch
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 toolchain add nightly
rustup target add wasm32-wasi --toolchain nightly
- name: Run Rust linter
run: |
source $HOME/.cargo/env
CLIPPY_OUT=${TMPDIR:-/tmp}/cargo-clippy-log.out
export CC="${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot"
cargo +nightly 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 "The rust sources are not formatted properly. Please fix it."
exit 1
fi
- name: Setup Rust toolchain
run: |
dir=$(pwd)
cd /opt
git clone https://github.com/rust-lang/rust.git -b beta
cd rust
git apply "$dir/canonicalize.patch"
mkdir tmp
cd tmp
sudo ../src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
cd ..
./configure --target=wasm32-wasi --disable-docs --set target.wasm32-wasi.wasi-root=/wasm32-wasi --enable-lld --tools=cargo
./x.py build --target x86_64-unknown-linux-gnu,wasm32-wasi --stage 2
source $HOME/.cargo/env
rustup toolchain link stage2 "$(pwd)/build/x86_64-unknown-linux-gnu/stage2"
cargo --version
- name: Build wasm32-wasi
run: |
source $HOME/.cargo/env
export CC="${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot"
cargo +stage2 build --target wasm32-wasi --release
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: wasibox
path: ./target/wasm32-wasi/release/wasibox.wasm
apt-get update
apt-get install -y clang libclang-dev cmake wget ninja-build bzip2 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 wasi
run: cargo build --target wasm32-wasi --release
- name: Lint wasi
run: cargo clippy --target wasm32-wasi
- name: Format
run: cargo fmt --check
29 changes: 0 additions & 29 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 77e29ad

Please sign in to comment.