Add min rust version check #192
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: Rust | ||
env: | ||
min_rust_version: "1.64.0" | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '.github/workflows/rust.yml' | ||
- 'src/**/*.rs' | ||
- 'tests/**/*.rs' | ||
- 'Cargo.toml' | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
branches: | ||
- '**' | ||
paths: | ||
- '.github/workflows/rust.yml' | ||
- 'src/**/*.rs' | ||
- 'tests/**/*' | ||
- 'Cargo.toml' | ||
jobs: | ||
min-rust-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust Unix | ||
run: | | ||
if rustup --version >/dev/null 2>&1; then | ||
rustup install ${{ env.min_rust_version }} | ||
rustup default ${{ env.min_rust_version }} | ||
else | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain ${{ env.min_rust_version }} | ||
echo ::add-path::$HOME/.cargo/bin | ||
fi | ||
- name: Rust version | ||
run: | | ||
cargo --version | ||
rustc --version | ||
- name: Check | ||
run: | | ||
cargo check --features xxh32,const_xxh32,xxh64,const_xxh64,xxh3,const_xxh3 | ||
full-test: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.draft == false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust Unix | ||
run: | | ||
if rustup --version >/dev/null 2>&1; then | ||
rustup update | ||
else | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
fi | ||
#- name: Install Miri | ||
# run: | | ||
# rustup toolchain install nightly | ||
# rustup +nightly component add miri | ||
- name: Install Valgrind | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y valgrind | ||
- name: Rust version | ||
run: | | ||
cargo --version | ||
rustc --version | ||
- name: Check build | ||
run: cargo check --features xxh32,const_xxh32,xxh64,const_xxh64,xxh3,const_xxh3 | ||
- name: Test | ||
run: cargo test --features xxh32,const_xxh32,xxh64,const_xxh64,xxh3,const_xxh3 | ||
- name: Valgrind Test | ||
env: | ||
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: "valgrind --leak-check=full --error-exitcode=1" | ||
run: cargo test --release --features xxh32,const_xxh32,xxh64,const_xxh64,xxh3,const_xxh3 | ||
- name: Valgrind Test(No SSE2) | ||
env: | ||
RUSTFLAGS: "-Ctarget-feature=-sse2" | ||
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: "valgrind --leak-check=full --error-exitcode=1" | ||
run: cargo test --release --features xxh32,const_xxh32,xxh64,const_xxh64,xxh3,const_xxh3 | ||
#- name: Miri Test(No SSE2) | ||
# env: | ||
# RUSTFLAGS: "-Ctarget-feature=-sse2" | ||
# MIRIFLAGS: "-Zmiri-tag-raw-pointers" | ||
# run: | | ||
# cargo +nightly miri test --features xxh32,const_xxh32,xxh64,const_xxh64,xxh3,const_xxh3 | ||
# cargo +nightly miri test --release --features xxh32,const_xxh32,xxh64,const_xxh64,xxh3,const_xxh3 | ||
wasm-platform-test: | ||
needs: full-test, min-rust-check | ||
runs-on: ubuntu-latest | ||
container: ghcr.io/webassembly/wasi-sdk | ||
if: github.event.pull_request.draft == false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install system packages | ||
run: apt-get update && apt-get install -y curl xz-utils | ||
- name: Install Rust Unix | ||
run: | | ||
if rustup --version >/dev/null 2>&1; then | ||
rustup update | ||
else | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
fi | ||
- name: Install Wasi runtime | ||
run: | | ||
curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v17.0.1/wasmtime-v17.0.1-x86_64-linux.tar.xz > wasmtime.tar.xz | ||
mkdir $HOME/wasmtime | ||
tar -xf wasmtime.tar.xz -C $HOME/wasmtime --strip-components 1 | ||
echo "$HOME/wasmtime/" >> $GITHUB_PATH | ||
cargo install cargo-wasi | ||
- name: Test simd128 | ||
env: | ||
RUSTFLAGS: "-Ctarget-feature=+simd128" | ||
run: cargo wasi test --test assert_correctness --features xxh32,const_xxh32,xxh64,const_xxh64,xxh3,const_xxh3 -- --nocapture | ||
cross-platform-test: | ||
needs: full-test | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.draft == false | ||
strategy: | ||
matrix: | ||
target: [ | ||
"arm-unknown-linux-musleabi", | ||
"i586-unknown-linux-musl", | ||
"powerpc-unknown-linux-gnu", | ||
"aarch64-unknown-linux-musl", | ||
#"mips-unknown-linux-musl", | ||
#"mips64-unknown-linux-gnuabi64" | ||
] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust Unix | ||
run: | | ||
if rustup --version >/dev/null 2>&1; then | ||
rustup update | ||
else | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
fi | ||
- name: Install Cross | ||
run: | | ||
curl -L https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz | tar xfz - | ||
cp cross $HOME/.cargo/bin | ||
- name: Test ${{ matrix.target }} | ||
run: cross test --features xxh32,const_xxh32,xxh64,const_xxh64,xxh3,const_xxh3 --release --target ${{ matrix.target }} |