Skip to content

Enable Miri tests for more aarch64 tests #186

Enable Miri tests for more aarch64 tests

Enable Miri tests for more aarch64 tests #186

Workflow file for this run

name: Rust CI
on:
push:
branches: master
pull_request:
branches: master
schedule:
- cron: "0 0 1 * *" # monthly
workflow_dispatch: # allow manual triggering of the action
# Cancel running jobs if branch is pushed to again
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
RUSTFLAGS: "-Dwarnings"
RUSTDOCFLAGS: "-Dwarnings"
jobs:
build-x86:
name: Build and test crate
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows]
toolchain: ["1.88", nightly, beta, stable]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: rust-docs
- name: Cache Cargo Dependencies (ubuntu nightly)
# Share cache with Miri job
if: ${{ (matrix.os == 'ubuntu') && (matrix.toolchain == 'nightly') }}
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: "linux-nightly"
- name: Cache Cargo Dependencies
if: ${{ !((matrix.os == 'ubuntu') && (matrix.toolchain == 'nightly')) }}
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
# Default build, no features
- name: Build library
run: cargo build -v --lib --no-default-features
- name: Test library
run: cargo test --no-default-features --lib
- name: Doc tests
run: cargo test --no-default-features --doc
- name: Build docs
run: cargo doc --no-deps --no-default-features
# AVX intrinsics testing
- name: Test library (avx feature)
run: cargo test --no-default-features --lib --features _avx_test
# Check if `avx512vbmi2` target feature is supported
- name: Check supported native target features (AVX-512 feature)
if: ${{ (matrix.os == 'ubuntu') }}
id: avx512_check
run: |
rustc --print=cfg -Ctarget-cpu=native
if rustc --print=cfg -Ctarget-cpu=native | grep -l 'avx512vbmi2'; then
echo "PRESENT=yes" >> $GITHUB_OUTPUT
else
echo "PRESENT=no" >> $GITHUB_OUTPUT
fi
# AVX-512 feature tests, AVX-512 was stabilized in 1.89
- name: Test library (AVX-512 feature)
if: ${{ (matrix.toolchain != '1.88') && (matrix.os == 'ubuntu') && (steps.avx512_check.PRESENT == 'yes') }}
run: cargo test --no-default-features --lib --features avx512
- name: Doc tests (AVX-512 feature)
if: ${{ (matrix.toolchain != '1.88') && (matrix.os == 'ubuntu') && (steps.avx512_check.PRESENT == 'yes') }}
run: cargo test --no-default-features --doc --features avx512
- name: Build docs (AVX-512 feature)
if: ${{ (matrix.toolchain != '1.88') && (matrix.os == 'ubuntu') && (steps.avx512_check.PRESENT == 'yes') }}
run: cargo doc --no-deps --no-default-features --features avx512
# Nightly feature tests
- name: Test library (nightly feature)
if: ${{ (matrix.toolchain == 'nightly') }}
run: cargo test --no-default-features --lib --features nightly
- name: Doc tests (nightly feature)
if: ${{ (matrix.toolchain == 'nightly') }}
run: cargo test --no-default-features --doc --features nightly
- name: Build docs (nightly feature)
if: ${{ (matrix.toolchain == 'nightly') }}
run: cargo doc --no-deps --no-default-features --features nightly
build-aarch64:
name: Build and test crate
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-24.04-arm, windows-11-arm]
toolchain: ["1.88", nightly, beta, stable]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: rust-docs
targets: aarch64-apple-darwin
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
# Default build, no features
- name: Build library
run: cargo build -v --lib --no-default-features
- name: Test library
run: cargo test --no-default-features --lib
- name: Doc tests
run: cargo test --no-default-features --doc
- name: Build docs
run: cargo doc --no-deps --no-default-features
# Nightly feature tests
- name: Test library (nightly feature)
if: ${{ matrix.toolchain == 'nightly' }}
run: cargo test --no-default-features --lib --features nightly
- name: Doc tests (nightly feature)
if: ${{ matrix.toolchain == 'nightly' }}
run: cargo test --no-default-features --doc --features nightly
- name: Build docs (nightly feature)
if: ${{ matrix.toolchain == 'nightly' }}
run: cargo doc --no-deps --no-default-features --features nightly
build-wasm32:
name: Build and test crate/docs
runs-on: ubuntu-latest
env:
# Installed later on ..
CARGO_TARGET_WASM32_WASIP1_RUNNER: "./wasmtime --dir .::"
strategy:
fail-fast: false
matrix:
toolchain: [1.88, nightly, beta, stable]
target: ["wasm32-wasip1"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
target: wasm32-wasip1
components: rust-docs
- run: >
curl -L https://github.com/bytecodealliance/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | tar x --xz -f - --strip-components 1 "wasmtime-dev-x86_64-linux/wasmtime"
- name: "Enable simd128 target feature"
env:
RUSTFLAGS: "-Dwarnings -Ctarget-feature=+simd128"
run: |
echo "RUSTFLAGS=${{ env.RUSTFLAGS }}" >> $GITHUB_ENV
- name: Build library
run: cargo build -v --lib --no-default-features --target ${{ matrix.target }}
- name: Test library
run: cargo test --no-default-features --lib --target ${{ matrix.target }}
- name: Doc tests
run: cargo test --no-default-features --doc --target ${{ matrix.target }}
- name: Build docs
run: cargo doc --no-deps --no-default-features --target ${{ matrix.target }}
# Nightly feature tests
- name: Test library (nightly feature)
if: ${{ matrix.toolchain == 'nightly' }}
run: cargo test --no-default-features --lib --features nightly --target ${{ matrix.target }}
- name: Doc tests (nightly feature)
if: ${{ matrix.toolchain == 'nightly' }}
run: cargo test --no-default-features --doc --features nightly --target ${{ matrix.target }}
- name: Build docs (nightly)
if: ${{ matrix.toolchain == 'nightly' }}
run: cargo doc --no-deps --no-default-features --features nightly --target ${{ matrix.target }}
clippy-rustfmt:
name: Clippy and rustfmt
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: clippy
run: cargo clippy
continue-on-error: true
- name: rustfmt
run: cargo fmt -- --check
continue-on-error: false
codegen-x86:
name: x86_64 assembly codegen tests
runs-on: ${{ matrix.os }}-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ubuntu]
toolchain: [nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Cache LLVM build/bin/ directory
id: cache-llvm
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/llvmbuild/bin/
key: ${{ runner.os }}-llvm-20
- name: Download LLVM and build FileCheck
# FileCheck doesn't exist because the cache wasn't hit, rebuild it
if: ${{ hashFiles('llvmbuild/bin/FileCheck') == '' }}
run: |
# Prepare build environment
sudo apt -y update
sudo apt -y install build-essential cmake xz-utils lsb-release wget software-properties-common
sudo apt -y autoremove
# Download LLVM source
wget https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-20.1.8.tar.gz
tar -xf llvmorg-20.1.8.tar.gz
# Configure the target and build folder, FileCheck requires enabling -DLLVM_INSTALL_UTILS=ON
mkdir llvmbuild
cmake -S ${{ github.workspace }}/llvm-project-llvmorg-20.1.8/llvm/ -B ${{ github.workspace }}/llvmbuild/ -DCMAKE_BUILD_TYPE=Release -DLLVM_INSTALL_UTILS=ON
cmake --build ${{ github.workspace }}/llvmbuild/ --target FileCheck
- name: Store FileCheck path in ENV variable
run: echo "FILECHECK=${{ github.workspace }}/llvmbuild/bin/FileCheck" >> $GITHUB_ENV
- name: Run assembly tests
run: cargo test --features _assembly_x86
# FIXME: workaround until the codegen tests are sorted
continue-on-error: true
miri:
name: Miri
runs-on: ubuntu-latest
needs: [build-x86, build-aarch64]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: miri, rust-src
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: "linux-nightly"
- name: Set up Miri
run: |
rustup override set nightly
cargo miri setup
- name: Test with Miri, Linux 64-bit x86_64 target
run: RUSTFLAGS="-Dwarnings -Ctarget-feature=+avx,+avx512f,+avx512vl,+avx512bw" cargo miri test --features _avx_test,avx512 --target x86_64-unknown-linux-gnu
- name: Test with Miri, Linux 32-bit x86 target
run: RUSTFLAGS="-Dwarnings -Ctarget-feature=+avx,+avx512f,+avx512vl,+avx512bw" cargo miri test --features _avx_test,avx512 --target i686-unknown-linux-gnu
- name: Test with Miri, Linux 64-bit aarch64 target
run: RUSTFLAGS="-Dwarnings" cargo miri test --features nightly --all-features --target aarch64-unknown-linux-gnu
# FIXME: missing wasm32 target when support is available