Skip to content

Commit

Permalink
[#66069] Update github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
GPlaczek committed Sep 27, 2024
1 parent 9b07537 commit 7f849df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 83 deletions.
69 changes: 15 additions & 54 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,27 @@ 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
apt-get update
apt-get install -y nodejs npm wget clang libclang-dev
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 -- --default-host x86_64-unknown-linux-gnu --default-toolchain 1.77.2 --profile default -y > /dev/null 2> /dev/null
source $HOME/.cargo/env
rustup target add wasm32-wasi
- name: Run Rust linter
run: |
source $HOME/.cargo/env
CLIPPY_OUT=${TMPDIR:-/tmp}/cargo-clippy-log.out
cargo clippy --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 it."
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: |
git clone https://github.com/rust-lang/rust.git -b beta
cd rust
git apply ../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
rustup component add rustfmt clippy
- name: Checkout sources
uses: actions/checkout@v3
- name: Build native
run: |
source $HOME/.cargo/env
export CC="${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot"
cargo +stage2 build --release
run: cargo build --release
- 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: wash
path: ./target/wasm32-wasi/release/wash.wasm
run: CC=${WASI_SDK_PATH}/bin/clang cargo build --target wasm32-wasi --release
- name: Lint native
run: cargo clippy --quiet
- name: Lint wasi
run: cargo clippy --target wasm32-wasi --quiet
- name: Run Rust formater
run: cargo fmt --check
29 changes: 0 additions & 29 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 7f849df

Please sign in to comment.