| 1 |
name: tests |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- "*" |
| 7 |
# not on tags |
| 8 |
pull_request: |
| 9 |
|
| 10 |
env: |
| 11 |
BLAKE3_CI: "1" |
| 12 |
RUSTFLAGS: "-D warnings" |
| 13 |
RUST_BACKTRACE: "1" |
| 14 |
|
| 15 |
jobs: |
| 16 |
library_tests: |
| 17 |
name: ${{ matrix.target.name }} ${{ matrix.channel }} |
| 18 |
runs-on: ${{ matrix.target.os }} |
| 19 |
strategy: |
| 20 |
fail-fast: false |
| 21 |
matrix: |
| 22 |
target: [ |
| 23 |
{ "os": "ubuntu-latest", "toolchain": "x86_64-unknown-linux-gnu", "name": "Linux GNU" }, |
| 24 |
{ "os": "ubuntu-24.04-arm", "toolchain": "aarch64-unknown-linux-gnu", "name": "Linux GNU (arm64)" }, |
| 25 |
{ "os": "macOS-latest", "toolchain": "aarch64-apple-darwin", "name": "macOS" }, |
| 26 |
{ "os": "windows-latest", "toolchain": "x86_64-pc-windows-msvc", "name": "Windows MSVC" }, |
| 27 |
{ "os": "windows-latest", "toolchain": "x86_64-pc-windows-gnu", "name": "Windows GNU" } |
| 28 |
] |
| 29 |
channel: ["stable", "beta", "nightly"] |
| 30 |
|
| 31 |
steps: |
| 32 |
- uses: actions/checkout@v4 |
| 33 |
- uses: dtolnay/rust-toolchain@master |
| 34 |
with: |
| 35 |
toolchain: ${{ format('{0}-{1}', matrix.channel, matrix.target.toolchain) }} |
| 36 |
# Print the compiler version, for debugging. |
| 37 |
- name: print compiler version |
| 38 |
run: cargo run --quiet |
| 39 |
working-directory: ./tools/compiler_version |
| 40 |
# Print out instruction set support, for debugging. |
| 41 |
- name: print instruction set support |
| 42 |
run: cargo run --quiet |
| 43 |
working-directory: ./tools/instruction_set_support |
| 44 |
# Default tests plus Rayon and trait implementations. |
| 45 |
- run: cargo test --features=rayon,traits-preview,serde,zeroize |
| 46 |
# Same but with only one thread in the Rayon pool. This can find deadlocks. |
| 47 |
- name: "again with RAYON_NUM_THREADS=1" |
| 48 |
run: cargo test --features=rayon,traits-preview,serde,zeroize |
| 49 |
env: |
| 50 |
RAYON_NUM_THREADS: 1 |
| 51 |
# The mmap feature by itself (update_mmap_rayon is omitted). |
| 52 |
- run: cargo test --features=mmap |
| 53 |
# All public features put together. |
| 54 |
- run: cargo test --features=mmap,rayon,traits-preview,serde,zeroize |
| 55 |
# no_std tests. |
| 56 |
- run: cargo test --no-default-features |
| 57 |
- name: Make sure enabling LTO via CFLAGS doesn't break the build. |
| 58 |
run: cargo build --tests --features prefer_intrinsics |
| 59 |
if: matrix.target.toolchain != 'x86_64-pc-windows-msvc' |
| 60 |
env: |
| 61 |
CFLAGS: -flto |
| 62 |
|
| 63 |
# A matrix of different test settings: |
| 64 |
# - debug vs release |
| 65 |
# - assembly vs Rust+C intrinsics vs pure Rust intrinsics |
| 66 |
# - different levels of SIMD support |
| 67 |
# |
| 68 |
# Full SIMD support. |
| 69 |
- run: cargo test --features= |
| 70 |
- run: cargo test --features=prefer_intrinsics |
| 71 |
- run: cargo test --features=pure |
| 72 |
- run: cargo test --features= --release |
| 73 |
- run: cargo test --features=prefer_intrinsics --release |
| 74 |
- run: cargo test --features=pure --release |
| 75 |
# No AVX-512. |
| 76 |
- run: cargo test --features=no_avx512 |
| 77 |
- run: cargo test --features=no_avx512,prefer_intrinsics |
| 78 |
- run: cargo test --features=no_avx512,pure |
| 79 |
- run: cargo test --features=no_avx512 --release |
| 80 |
- run: cargo test --features=no_avx512,prefer_intrinsics --release |
| 81 |
- run: cargo test --features=no_avx512,pure --release |
| 82 |
# No AVX2. |
| 83 |
- run: cargo test --features=no_avx512,no_avx2 |
| 84 |
- run: cargo test --features=no_avx512,no_avx2,prefer_intrinsics |
| 85 |
- run: cargo test --features=no_avx512,no_avx2,pure |
| 86 |
- run: cargo test --features=no_avx512,no_avx2 --release |
| 87 |
- run: cargo test --features=no_avx512,no_avx2,prefer_intrinsics --release |
| 88 |
- run: cargo test --features=no_avx512,no_avx2,pure --release |
| 89 |
# No SSE4.1 |
| 90 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41 |
| 91 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41,prefer_intrinsics |
| 92 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41,pure |
| 93 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41 --release |
| 94 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41,prefer_intrinsics --release |
| 95 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41,pure --release |
| 96 |
# No SSE2 |
| 97 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2 |
| 98 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2,prefer_intrinsics |
| 99 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2,pure |
| 100 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2 --release |
| 101 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2,prefer_intrinsics --release |
| 102 |
- run: cargo test --features=no_avx512,no_avx2,no_sse41,no_sse2,pure --release |
| 103 |
|
| 104 |
# Test benchmarks. RUSTC_BOOTSTRAP=1 lets this run on non-nightly toolchains. |
| 105 |
- run: cargo test --benches --features=rayon |
| 106 |
env: |
| 107 |
RUSTC_BOOTSTRAP: 1 |
| 108 |
# Test vectors. |
| 109 |
- name: test vectors |
| 110 |
run: cargo test |
| 111 |
working-directory: ./test_vectors |
| 112 |
- name: test vectors intrinsics |
| 113 |
run: cargo test --features=prefer_intrinsics |
| 114 |
working-directory: ./test_vectors |
| 115 |
- name: test vectors pure |
| 116 |
run: cargo test --features=pure |
| 117 |
working-directory: ./test_vectors |
| 118 |
# Test C code. |
| 119 |
- name: cargo test C bindings assembly |
| 120 |
run: cargo test |
| 121 |
working-directory: ./c/blake3_c_rust_bindings |
| 122 |
- name: cargo test C bindings intrinsics |
| 123 |
run: cargo test --features=prefer_intrinsics |
| 124 |
working-directory: ./c/blake3_c_rust_bindings |
| 125 |
- name: cargo test C bindings no AVX-512 |
| 126 |
run: cargo test |
| 127 |
working-directory: ./c/blake3_c_rust_bindings |
| 128 |
env: |
| 129 |
CFLAGS: -DBLAKE3_NO_AVX512 |
| 130 |
- name: cargo test C bindings no AVX2 |
| 131 |
run: cargo test |
| 132 |
working-directory: ./c/blake3_c_rust_bindings |
| 133 |
env: |
| 134 |
CFLAGS: -DBLAKE3_NO_AVX512 -DBLAKE3_NO_AVX2 |
| 135 |
- name: cargo test C bindings no SSE41 |
| 136 |
run: cargo test |
| 137 |
working-directory: ./c/blake3_c_rust_bindings |
| 138 |
env: |
| 139 |
CFLAGS: -DBLAKE3_NO_AVX512 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_SSE41 |
| 140 |
- name: cargo test C bindings no SSE2 |
| 141 |
run: cargo test |
| 142 |
working-directory: ./c/blake3_c_rust_bindings |
| 143 |
env: |
| 144 |
CFLAGS: -DBLAKE3_NO_AVX512 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_SSE2 |
| 145 |
# Reference impl doc test. |
| 146 |
- name: reference impl doc test |
| 147 |
run: cargo test |
| 148 |
working-directory: ./reference_impl |
| 149 |
|
| 150 |
msrv_build: |
| 151 |
name: MSRV build ${{ matrix.os }} |
| 152 |
runs-on: ${{ matrix.os }} |
| 153 |
strategy: |
| 154 |
fail-fast: false |
| 155 |
matrix: |
| 156 |
os: ["ubuntu-latest", "macOS-latest", "windows-latest"] |
| 157 |
steps: |
| 158 |
- uses: actions/checkout@v4 |
| 159 |
# The current MSRV. This crate doesn't have an official MSRV policy, |
| 160 |
# but in practice we'll probably do what libc does: |
| 161 |
# https://github.com/rust-lang/libs-team/issues/72. |
| 162 |
# This test target is here so that we notice if we accidentally bump |
| 163 |
# the MSRV, but it's not a promise that we won't bump it. |
| 164 |
- uses: dtolnay/[email protected] |
| 165 |
- run: cargo build --features=mmap,rayon,traits-preview,serde,zeroize |
| 166 |
|
| 167 |
b3sum_tests: |
| 168 |
name: b3sum ${{ matrix.target.name }} ${{ matrix.channel }} |
| 169 |
runs-on: ${{ matrix.target.os }} |
| 170 |
strategy: |
| 171 |
fail-fast: false |
| 172 |
matrix: |
| 173 |
target: [ |
| 174 |
{ "os": "ubuntu-latest", "toolchain": "x86_64-unknown-linux-gnu", "name": "Linux GNU" }, |
| 175 |
{ "os": "ubuntu-24.04-arm", "toolchain": "aarch64-unknown-linux-gnu", "name": "Linux GNU (arm64)" }, |
| 176 |
{ "os": "macOS-latest", "toolchain": "aarch64-apple-darwin", "name": "macOS" }, |
| 177 |
{ "os": "windows-latest", "toolchain": "x86_64-pc-windows-msvc", "name": "Windows MSVC" }, |
| 178 |
{ "os": "windows-latest", "toolchain": "x86_64-pc-windows-gnu", "name": "Windows GNU" } |
| 179 |
] |
| 180 |
channel: ["stable", "beta", "nightly"] |
| 181 |
|
| 182 |
steps: |
| 183 |
- uses: actions/checkout@v4 |
| 184 |
- uses: dtolnay/rust-toolchain@master |
| 185 |
with: |
| 186 |
toolchain: ${{ format('{0}-{1}', matrix.channel, matrix.target.toolchain) }} |
| 187 |
# Test b3sum. |
| 188 |
- name: test b3sum |
| 189 |
run: cargo test |
| 190 |
working-directory: ./b3sum |
| 191 |
- name: test b3sum --no-default-features |
| 192 |
run: cargo test --no-default-features |
| 193 |
working-directory: ./b3sum |
| 194 |
- name: Make sure enabling LTO via CFLAGS doesn't break the build. |
| 195 |
run: cargo build --features prefer_intrinsics |
| 196 |
if: matrix.target.toolchain != 'x86_64-pc-windows-msvc' |
| 197 |
env: |
| 198 |
CFLAGS: -flto |
| 199 |
working-directory: ./b3sum |
| 200 |
|
| 201 |
cross_tests: |
| 202 |
name: cross ${{ matrix.arch }} |
| 203 |
runs-on: ubuntu-latest |
| 204 |
strategy: |
| 205 |
fail-fast: false |
| 206 |
matrix: |
| 207 |
arch: |
| 208 |
- i586-unknown-linux-musl |
| 209 |
- i686-unknown-linux-musl |
| 210 |
- armv7-unknown-linux-gnueabihf |
| 211 |
- aarch64-unknown-linux-gnu |
| 212 |
# Big-endian targets. See https://twitter.com/burntsushi5/status/1695483429997945092. |
| 213 |
- powerpc64-unknown-linux-gnu |
| 214 |
- s390x-unknown-linux-gnu |
| 215 |
|
| 216 |
steps: |
| 217 |
- uses: actions/checkout@v4 |
| 218 |
- uses: dtolnay/rust-toolchain@stable |
| 219 |
- run: cargo install cross |
| 220 |
# Test the portable implementation on everything. |
| 221 |
- run: cross test --target ${{ matrix.arch }} |
| 222 |
# Test building for ancient i386 processors without guaranteed SSE2 support. |
| 223 |
- run: cross rustc --target ${{ matrix.arch }} -- -C target-cpu=i386 |
| 224 |
if: startsWith(matrix.arch, 'i586-') |
| 225 |
# Test the NEON implementation on ARM targets. |
| 226 |
- run: cross test --target ${{ matrix.arch }} --features=neon |
| 227 |
if: startsWith(matrix.arch, 'armv7-') || startsWith(matrix.arch, 'aarch64-') |
| 228 |
# NEON is enabled by default on aarch64, disabling it through the no_neon feature. |
| 229 |
- run: cross test --target ${{ matrix.arch }} --features=no_neon |
| 230 |
if: startsWith(matrix.arch, 'aarch64-') |
| 231 |
# Test vectors. Note that this uses a hacky script due to path dependency limitations. |
| 232 |
- run: ./test_vectors/cross_test.sh --target ${{ matrix.arch }} |
| 233 |
# C code. Same issue with the hacky script. |
| 234 |
- run: ./c/blake3_c_rust_bindings/cross_test.sh --target ${{ matrix.arch }} |
| 235 |
- run: ./c/blake3_c_rust_bindings/cross_test.sh --target ${{ matrix.arch }} --features=neon |
| 236 |
if: startsWith(matrix.arch, 'armv7-') || startsWith(matrix.arch, 'aarch64-') |
| 237 |
|
| 238 |
wasm_tests: |
| 239 |
name: WASM tests |
| 240 |
runs-on: ubuntu-latest |
| 241 |
steps: |
| 242 |
- uses: actions/checkout@v4 |
| 243 |
- uses: dtolnay/rust-toolchain@stable |
| 244 |
with: |
| 245 |
targets: wasm32-wasip1 |
| 246 |
- name: install Wasmtime |
| 247 |
run: | |
| 248 |
curl https://wasmtime.dev/install.sh -sSf | bash |
| 249 |
echo PATH: $PATH |
| 250 |
mkdir -p ~/.local/bin |
| 251 |
ln -s ~/.wasmtime/bin/wasmtime ~/.local/bin/wasmtime |
| 252 |
- run: cargo test --target wasm32-wasip1 |
| 253 |
- run: cargo test --target wasm32-wasip1 --no-default-features |
| 254 |
- run: cargo test --target wasm32-wasip1 --features wasm32_simd |
| 255 |
- run: cargo test --target wasm32-wasip1 --no-default-features --features wasm32_simd |
| 256 |
- run: cargo test --target wasm32-wasip1 --benches --features=wasm32_simd |
| 257 |
env: |
| 258 |
RUSTC_BOOTSTRAP: 1 |
| 259 |
- name: test vectors w/o SIMD |
| 260 |
run: cargo test --target wasm32-wasip1 |
| 261 |
working-directory: ./test_vectors |
| 262 |
- name: test vectors w/ SIMD |
| 263 |
run: cargo test --target wasm32-wasip1 --features wasm32_simd |
| 264 |
working-directory: ./test_vectors |
| 265 |
|
| 266 |
cargo_xwin_test: |
| 267 |
name: cargo xwin test |
| 268 |
runs-on: ubuntu-latest |
| 269 |
steps: |
| 270 |
- uses: actions/checkout@v4 |
| 271 |
- run: docker run -v $(pwd):/io -w /io messense/cargo-xwin cargo xwin test --target x86_64-pc-windows-msvc --features=mmap,rayon,traits-preview,serde,zeroize |
| 272 |
|
| 273 |
# Currently only on x86. |
| 274 |
cmake_c_tests: |
| 275 |
name: CMake C tests SIMD=${{ matrix.simd }} TBB=${{ matrix.use_tbb }} |
| 276 |
runs-on: ubuntu-latest |
| 277 |
strategy: |
| 278 |
fail-fast: false |
| 279 |
matrix: |
| 280 |
use_tbb: ["OFF", "ON"] |
| 281 |
simd: ["x86-intrinsics", "amd64-asm"] |
| 282 |
steps: |
| 283 |
- uses: actions/checkout@v4 |
| 284 |
- run: | |
| 285 |
sudo apt-get update |
| 286 |
sudo apt-get install ninja-build libtbb-dev libtbb12 |
| 287 |
# Test the intrinsics-based and assembly-based implementations. |
| 288 |
- run: | |
| 289 |
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_SIMD_TYPE=${{ matrix.simd }}" |
| 290 |
cmake --build c/build --target test |
| 291 |
cat c/build/Testing/Temporary/LastTest.log |
| 292 |
- run: | |
| 293 |
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_SIMD_TYPE=${{ matrix.simd }}" -DBLAKE3_NO_SSE2=1 |
| 294 |
cmake --build c/build --target test |
| 295 |
cat c/build/Testing/Temporary/LastTest.log |
| 296 |
- run: | |
| 297 |
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_SIMD_TYPE=${{ matrix.simd }}" -DBLAKE3_NO_SSE2=1 -DBLAKE3_NO_SSE41=1 |
| 298 |
cmake --build c/build --target test |
| 299 |
cat c/build/Testing/Temporary/LastTest.log |
| 300 |
- run: | |
| 301 |
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_SIMD_TYPE=${{ matrix.simd }}" "-DBLAKE3_NO_SSE2=1" "-DBLAKE3_NO_SSE41=1" "-DBLAKE3_NO_AVX2=1" |
| 302 |
cmake --build c/build --target test |
| 303 |
cat c/build/Testing/Temporary/LastTest.log |
| 304 |
- run: | |
| 305 |
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_SIMD_TYPE=${{ matrix.simd }}" "-DBLAKE3_NO_SSE2=1" "-DBLAKE3_NO_SSE41=1" "-DBLAKE3_NO_AVX2=1" "-DBLAKE3_NO_AVX512=1" |
| 306 |
cmake --build c/build --target test |
| 307 |
cat c/build/Testing/Temporary/LastTest.log |
| 308 |
# Test with TBB disabled/enabled. |
| 309 |
- run: | |
| 310 |
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON "-DBLAKE3_USE_TBB=${{ matrix.use_tbb }}" |
| 311 |
cmake --build c/build --target test |
| 312 |
cat c/build/Testing/Temporary/LastTest.log |
| 313 |
# Build the example with TBB disabled/enabled. |
| 314 |
- run: | |
| 315 |
cmake --fresh -S c -B c/build -G Ninja -DBLAKE3_TESTING=ON -DBLAKE3_TESTING_CI=ON -DBLAKE3_EXAMPLES=ON "-DBLAKE3_USE_TBB=${{ matrix.use_tbb }}" |
| 316 |
cmake --build c/build --target blake3-example |
| 317 |
|
| 318 |
# Currently only on x86. |
| 319 |
pkg_config_c_tests: |
| 320 |
name: pkg-config C tests TBB=${{ matrix.use_tbb }} BUILD_SHARED_LIBS=${{ matrix.shared_libs }} STDLIB=${{ matrix.stdlib }} |
| 321 |
runs-on: ubuntu-latest |
| 322 |
strategy: |
| 323 |
fail-fast: false |
| 324 |
matrix: |
| 325 |
use_tbb: ["OFF", "ON"] |
| 326 |
shared_libs: ["OFF", "ON"] |
| 327 |
stdlib: ["libc++", "libstdc++"] |
| 328 |
steps: |
| 329 |
- uses: actions/checkout@v4 |
| 330 |
- name: update packages |
| 331 |
run: | |
| 332 |
sudo apt-get update |
| 333 |
sudo apt-get install ninja-build libtbb-dev libtbb12 |
| 334 |
${{ matrix.stdlib != 'libc++' || 'sudo apt-get install libc++-dev libc++abi-dev' }} |
| 335 |
- name: configure cmake |
| 336 |
run: | |
| 337 |
export CXXFLAGS=${{ matrix.stdlib == 'libc++' && '-stdlib=libc++' || '' }} |
| 338 |
export CC=${{ matrix.stdlib == 'libc++' && 'clang' || 'gcc' }} |
| 339 |
export CXX=${{ matrix.stdlib == 'libc++' && 'clang++' || 'g++' }} |
| 340 |
cmake --fresh -S c -B c/build -G Ninja -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/target "-DBLAKE3_USE_TBB=${{ matrix.use_tbb }}" "-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }}" -DCMAKE_VERBOSE_MAKEFILE=1 |
| 341 |
- run: cmake --build c/build --target install |
| 342 |
- run: mkdir -p ${{ github.workspace }}/target/bin |
| 343 |
- run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/target/lib/pkgconfig" >> $GITHUB_ENV |
| 344 |
- run: gcc -O3 -o ${{ github.workspace }}/target/bin/blake3-example c/example.c $(pkg-config --cflags --libs libblake3) |
| 345 |
- if: matrix.use_tbb == 'ON' |
| 346 |
run: gcc -O3 -o ${{ github.workspace }}/target/bin/blake3-example-tbb c/example_tbb.c $(pkg-config --cflags --libs libblake3) |
| 347 |
|
| 348 |
# Note that this jobs builds AArch64 binaries from an x86_64 host. |
| 349 |
build_apple_silicon: |
| 350 |
name: build for Apple Silicon |
| 351 |
runs-on: macOS-latest |
| 352 |
strategy: |
| 353 |
fail-fast: false |
| 354 |
steps: |
| 355 |
- uses: actions/checkout@v4 |
| 356 |
- uses: dtolnay/rust-toolchain@stable |
| 357 |
with: |
| 358 |
targets: aarch64-apple-darwin |
| 359 |
- name: build blake3 |
| 360 |
run: cargo build --target aarch64-apple-darwin |
| 361 |
- name: build b3sum |
| 362 |
run: cargo build --target aarch64-apple-darwin |
| 363 |
working-directory: ./b3sum |
| 364 |
|
| 365 |
build_tinycc: |
| 366 |
name: build with the Tiny C Compiler |
| 367 |
runs-on: ubuntu-latest |
| 368 |
steps: |
| 369 |
- uses: actions/checkout@v4 |
| 370 |
- name: install TCC |
| 371 |
run: sudo apt-get install -y tcc |
| 372 |
- name: compile |
| 373 |
run: > |
| 374 |
tcc -shared -O3 -o libblake3.so \ |
| 375 |
-DBLAKE3_NO_SSE2 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_AVX512 \ |
| 376 |
blake3.c blake3_dispatch.c blake3_portable.c |
| 377 |
working-directory: ./c |
| 378 |
|
| 379 |
# See https://github.com/BLAKE3-team/BLAKE3/issues/271 for why we test this. |
| 380 |
# Note that this isn't guaranteed to execute on an AVX-512-supporting server, |
| 381 |
# but hopefully at least some of the time it will. |
| 382 |
gcc54: |
| 383 |
name: "compile and test with GCC 5.4" |
| 384 |
runs-on: ubuntu-latest |
| 385 |
steps: |
| 386 |
- uses: actions/checkout@v4 |
| 387 |
- uses: addnab/docker-run-action@v3 |
| 388 |
with: |
| 389 |
image: gcc:5.4 |
| 390 |
options: -v ${{ github.workspace }}:/work |
| 391 |
run: | |
| 392 |
cat /proc/cpuinfo |
| 393 |
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal |
| 394 |
cd /work |
| 395 |
~/.cargo/bin/cargo test --features prefer_intrinsics |
| 396 |
|
| 397 |
# CMake build test (Library only). |
| 398 |
cmake_current_build: |
| 399 |
name: CMake ${{ matrix.os }} CC=${{ matrix.toolchain.cc }} CXX=${{ matrix.toolchain.cxx }} TBB=${{ matrix.use_tbb }} |
| 400 |
runs-on: ${{ matrix.os }} |
| 401 |
strategy: |
| 402 |
fail-fast: false |
| 403 |
matrix: |
| 404 |
cmakeVersion: [latest] |
| 405 |
ninjaVersion: [latest] |
| 406 |
os: [ubuntu-latest, macOS-latest, windows-latest] |
| 407 |
toolchain: [ |
| 408 |
{ cc: cl, cxx: cl }, |
| 409 |
{ cc: clang, cxx: clang++ }, |
| 410 |
{ cc: clang-cl, cxx: clang-cl }, |
| 411 |
{ cc: gcc, cxx: g++ }, |
| 412 |
] |
| 413 |
use_tbb: [OFF, ON] |
| 414 |
exclude: |
| 415 |
- os: macOS-latest |
| 416 |
toolchain: { cc: cl, cxx: cl } |
| 417 |
- os: macOS-latest |
| 418 |
toolchain: { cc: clang-cl, cxx: clang-cl } |
| 419 |
- os: ubuntu-latest |
| 420 |
toolchain: { cc: cl, cxx: cl } |
| 421 |
- os: ubuntu-latest |
| 422 |
toolchain: { cc: clang-cl, cxx: clang-cl } |
| 423 |
- os: windows-latest |
| 424 |
toolchain: { cc: clang, cxx: clang++ } |
| 425 |
use_tbb: ON |
| 426 |
- os: windows-latest |
| 427 |
toolchain: { cc: gcc, cxx: g++ } |
| 428 |
use_tbb: ON |
| 429 |
steps: |
| 430 |
- uses: actions/checkout@v4 |
| 431 |
- uses: lukka/get-cmake@5f6e04f5267c8133f1273bf2103583fc72c46b17 |
| 432 |
with: |
| 433 |
cmakeVersion: ${{ matrix.cmakeVersion }} |
| 434 |
ninjaVersion: ${{ matrix.ninjaVersion }} |
| 435 |
- if: matrix.os == 'macOS-latest' |
| 436 |
name: Install dependencies on macOS |
| 437 |
run: | |
| 438 |
brew update |
| 439 |
brew install tbb |
| 440 |
- if: matrix.os == 'ubuntu-latest' |
| 441 |
name: Install dependencies on Linux |
| 442 |
run: | |
| 443 |
sudo apt-get update |
| 444 |
sudo apt-get install libtbb-dev libtbb12 |
| 445 |
- name: CMake generation, build, install |
| 446 |
run: | |
| 447 |
${{ matrix.os != 'windows-latest' || '$vs_install_path = & "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath; & "$vs_install_path/Common7/Tools/Launch-VsDevShell.ps1" -Arch amd64 -SkipAutomaticLocation' }} |
| 448 |
cmake -S c -B c/build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/target -DCMAKE_C_COMPILER=${{ matrix.toolchain.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.toolchain.cxx }} -DBLAKE3_USE_TBB=${{ matrix.use_tbb }} -DBLAKE3_FETCH_TBB=${{ matrix.os == 'windows-latest' && 'YES' || 'NO' }} -DBLAKE3_EXAMPLES=ON |
| 449 |
cmake --build c/build --target install |
| 450 |
|
| 451 |
cmake_3-9_build: |
| 452 |
name: CMake 3.9.6 ubuntu-latest |
| 453 |
runs-on: ubuntu-latest |
| 454 |
steps: |
| 455 |
- uses: actions/checkout@v4 |
| 456 |
- uses: lukka/get-cmake@5f6e04f5267c8133f1273bf2103583fc72c46b17 |
| 457 |
with: |
| 458 |
cmakeVersion: 3.9.6 |
| 459 |
- name: Create build directory |
| 460 |
run: mkdir c/build |
| 461 |
- name: CMake generation |
| 462 |
run: cmake .. -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/target |
| 463 |
working-directory: c/build |
| 464 |
- name: CMake build / install |
| 465 |
run: make install |
| 466 |
working-directory: c/build |
| 467 |
|
| 468 |
miri_smoketest: |
| 469 |
name: Miri smoketest |
| 470 |
runs-on: ubuntu-latest |
| 471 |
steps: |
| 472 |
- uses: actions/checkout@v4 |
| 473 |
- uses: dtolnay/rust-toolchain@nightly |
| 474 |
with: |
| 475 |
components: miri |
| 476 |
# Currently the test search "miri" only matches "test_miri_smoketest", but |
| 477 |
# we might add more. If this accidentally picks up anything incompatible or |
| 478 |
# slow, we can narrow it. |
| 479 |
- run: cargo miri test miri |
| 480 |
|
| 481 |
tbb_rust_bindings_tests: |
| 482 |
name: TBB test bindings ${{ matrix.os }} |
| 483 |
runs-on: ${{ matrix.os }} |
| 484 |
strategy: |
| 485 |
fail-fast: false |
| 486 |
matrix: |
| 487 |
os: ["ubuntu-latest", "macOS-latest"] |
| 488 |
steps: |
| 489 |
- uses: actions/checkout@v4 |
| 490 |
- uses: dtolnay/rust-toolchain@stable |
| 491 |
- name: install TBB |
| 492 |
if: matrix.os == 'ubuntu-latest' |
| 493 |
run: | |
| 494 |
sudo apt-get update |
| 495 |
sudo apt-get install libtbb-dev libtbb12 |
| 496 |
- name: install TBB |
| 497 |
if: matrix.os == 'macOS-latest' |
| 498 |
run: | |
| 499 |
brew install tbb |
| 500 |
echo "CXXFLAGS=-I$(brew --prefix)/include $CPPFLAGS" >> $GITHUB_ENV |
| 501 |
echo "RUSTFLAGS=-L$(brew --prefix)/lib $RUSTFLAGS" >> $GITHUB_ENV |
| 502 |
- name: cargo test C bindings with TBB |
| 503 |
run: cargo test --features=tbb |
| 504 |
working-directory: ./c/blake3_c_rust_bindings |