| 1 |
# Known critical issues: |
| 2 |
# - AVX512 related tests are incomplete. Because default environment of |
| 3 |
# GitHub Actions doesn't guarantee to support AVX512. |
| 4 |
# As of May 2021, they're using Xeon E5-2673 (which doesn't support |
| 5 |
# AVX512) and Xeon Platinum 8171M (which supports AVX512). |
| 6 |
# See also https://github.com/actions/runner/issues/1069 |
| 7 |
# |
| 8 |
# In this CI script, it always run `make default` which compiles xxHash |
| 9 |
# with AVX512 intrinsics. But if test runner doesn't support AVX512, |
| 10 |
# it doesn't run `make check` which tests runtime error/consistency. |
| 11 |
# It means that this test stochastically detects a failure in AVX512 |
| 12 |
# code path. |
| 13 |
# |
| 14 |
# Known issues: |
| 15 |
# - This test script ignores exit code of cppcheck which can see under |
| 16 |
# Job:Linux x64 misc tests > cppcheck in the GitHub Actions report. |
| 17 |
# Because xxHash project doesn't 100% follow their recommendation. |
| 18 |
# Also sometimes it reports false positives. |
| 19 |
# |
| 20 |
# - GitHub Actions doesn't support Visual Studio 2015 and 2013. |
| 21 |
# https://github.com/actions/virtual-environments/issues/387 |
| 22 |
# |
| 23 |
# - Setup procedure for msys2 environment is painfully slow. It takes |
| 24 |
# 3..5 minutes. |
| 25 |
# |
| 26 |
# Notes: |
| 27 |
# - You can investigate various information at the right pane of GitHub |
| 28 |
# Actions report page. |
| 29 |
# |
| 30 |
# | Item | Section in the right pane | |
| 31 |
# | ------------------------- | ------------------------------------- | |
| 32 |
# | OS, VM | Set up job | |
| 33 |
# | git repo, commit hash | Run actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
| 34 |
# | gcc, tools | Environment info | |
| 35 |
# |
| 36 |
# - To fail earlier, order of tests in the same job are roughly sorted by |
| 37 |
# elapsed time. |
| 38 |
# |
| 39 |
# Todos: |
| 40 |
# - [ ] Linux: Add native ARM runner. |
| 41 |
# - [ ] Linux: Add native ARM64 runner. |
| 42 |
# - [ ] Linux: Add native PPC64LE runner. |
| 43 |
# - [ ] Linux: Add native S390X runner. |
| 44 |
# - [ ] Windows: Add VS2013. |
| 45 |
# - [ ] Windows: Add VS2015. |
| 46 |
# - [ ] Windows: Add clang for msys2. |
| 47 |
# - [ ] Windows: Add native or emulated ARM runner. |
| 48 |
# - [ ] Windows: Add native or emulated ARM64 runner. |
| 49 |
|
| 50 |
|
| 51 |
# Name of the workflow is also displayed as a SVG badge |
| 52 |
name: xxHash CI tests |
| 53 |
|
| 54 |
on: [push, pull_request] |
| 55 |
|
| 56 |
concurrency: |
| 57 |
group: fast-${{ github.ref }} |
| 58 |
cancel-in-progress: true |
| 59 |
|
| 60 |
permissions: |
| 61 |
contents: read |
| 62 |
|
| 63 |
jobs: |
| 64 |
xxhash-c-compilers: |
| 65 |
name: CC=${{ matrix.cc }}, ${{ matrix.os }} |
| 66 |
strategy: |
| 67 |
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix entry fails. |
| 68 |
matrix: |
| 69 |
include: [ |
| 70 |
# You can access the following values via ${{ matrix.??? }} |
| 71 |
# |
| 72 |
# pkgs : apt-get package names. It can include multiple package names which are delimited by space. |
| 73 |
# cc : C compiler executable. |
| 74 |
# cxx : C++ compiler executable for `make ctocpptest`. |
| 75 |
# os : GitHub Actions YAML workflow label. See https://github.com/actions/virtual-environments#available-environments |
| 76 |
|
| 77 |
# cc |
| 78 |
{ pkgs: '', cc: cc, cxx: c++, os: ubuntu-latest, }, |
| 79 |
|
| 80 |
# gcc |
| 81 |
{ pkgs: '', cc: gcc, cxx: g++, os: ubuntu-latest, }, |
| 82 |
# { pkgs: 'gcc-13 g++-13 lib32gcc-13-dev', cc: gcc-13, cxx: g++-13, os: ubuntu-22.04, }, # currently failing |
| 83 |
{ pkgs: 'gcc-12 g++-12 lib32gcc-12-dev', cc: gcc-12, cxx: g++-12, os: ubuntu-22.04, }, |
| 84 |
{ pkgs: 'gcc-11 g++-11 lib32gcc-11-dev', cc: gcc-11, cxx: g++-11, os: ubuntu-22.04, }, |
| 85 |
{ pkgs: 'gcc-10 g++-10 lib32gcc-10-dev', cc: gcc-10, cxx: g++-10, os: ubuntu-22.04, }, |
| 86 |
{ pkgs: 'gcc-9 g++-9 lib32gcc-9-dev', cc: gcc-9, cxx: g++-9, os: ubuntu-22.04, }, |
| 87 |
{ pkgs: 'gcc-8 g++-8 lib32gcc-8-dev', cc: gcc-8, cxx: g++-8, os: ubuntu-20.04, }, |
| 88 |
{ pkgs: 'gcc-7 g++-7 lib32gcc-7-dev', cc: gcc-7, cxx: g++-7, os: ubuntu-20.04, }, |
| 89 |
|
| 90 |
# clang |
| 91 |
{ pkgs: '', cc: clang, cxx: clang++, os: ubuntu-latest, }, |
| 92 |
{ pkgs: 'clang-15', cc: clang-15, cxx: clang++-15, os: ubuntu-22.04, }, |
| 93 |
{ pkgs: 'clang-14', cc: clang-14, cxx: clang++-14, os: ubuntu-22.04, }, |
| 94 |
{ pkgs: 'clang-13', cc: clang-13, cxx: clang++-13, os: ubuntu-22.04, }, |
| 95 |
{ pkgs: 'clang-12', cc: clang-12, cxx: clang++-12, os: ubuntu-22.04, }, |
| 96 |
{ pkgs: 'clang-11', cc: clang-11, cxx: clang++-11, os: ubuntu-22.04, }, |
| 97 |
{ pkgs: 'clang-10', cc: clang-10, cxx: clang++-10, os: ubuntu-20.04, }, |
| 98 |
{ pkgs: 'clang-9', cc: clang-9, cxx: clang++-9, os: ubuntu-20.04, }, |
| 99 |
{ pkgs: 'clang-8', cc: clang-8, cxx: clang++-8, os: ubuntu-20.04, }, |
| 100 |
{ pkgs: 'clang-7', cc: clang-7, cxx: clang++-7, os: ubuntu-20.04, }, |
| 101 |
{ pkgs: 'clang-6.0', cc: clang-6.0, cxx: clang++-6.0, os: ubuntu-20.04, }, |
| 102 |
] |
| 103 |
|
| 104 |
runs-on: ${{ matrix.os }} |
| 105 |
env: # Set environment variables |
| 106 |
# We globally set CC and CXX to improve compatibility with .travis.yml |
| 107 |
CC: ${{ matrix.cc }} |
| 108 |
CXX: ${{ matrix.cxx }} |
| 109 |
steps: |
| 110 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 111 |
|
| 112 |
- name: apt-get install |
| 113 |
run: | |
| 114 |
sudo apt-get update |
| 115 |
sudo apt-get install gcc-multilib |
| 116 |
sudo apt-get install ${{ matrix.pkgs }} |
| 117 |
|
| 118 |
- name: Environment info |
| 119 |
run: | |
| 120 |
echo && type $CC && which $CC && $CC --version |
| 121 |
echo && type $CXX && which $CXX && $CXX --version |
| 122 |
echo && type make && make -v |
| 123 |
echo && cat /proc/cpuinfo || echo /proc/cpuinfo is not present |
| 124 |
|
| 125 |
- name: C90 + no-long-long compliance |
| 126 |
if: always() |
| 127 |
run: | |
| 128 |
CFLAGS="-std=c90 -pedantic -Wno-long-long -Werror" make clean xxhsum |
| 129 |
|
| 130 |
- name: C90 + XXH_NO_LONG_LONG |
| 131 |
if: always() |
| 132 |
run: | |
| 133 |
# strict c90, with no long long support; resulting in no XXH64_* symbol |
| 134 |
make clean c90test |
| 135 |
|
| 136 |
- name: dispatch |
| 137 |
if: always() |
| 138 |
run: | |
| 139 |
# removing sign conversion warnings due to a bug in gcc-5's definition of some AVX512 intrinsics |
| 140 |
CFLAGS="-Werror" MOREFLAGS="-Wno-sign-conversion" make clean dispatch |
| 141 |
|
| 142 |
- name: DISPATCH=1 |
| 143 |
if: always() |
| 144 |
run: | |
| 145 |
CFLAGS="-Wall -Wextra -Werror" make DISPATCH=1 clean default |
| 146 |
|
| 147 |
- name: XXH_SIZE_OPT == 2 |
| 148 |
if: always() |
| 149 |
run: | |
| 150 |
CFLAGS="-Os -DXXH_SIZE_OPT=2 -Wall -Wextra -Werror" make clean xxhsum |
| 151 |
|
| 152 |
- name: noxxh3test |
| 153 |
if: always() |
| 154 |
run: | |
| 155 |
# check library can be compiled with XXH_NO_XXH3, resulting in no XXH3_* symbol |
| 156 |
make clean noxxh3test |
| 157 |
|
| 158 |
- name: nostreamtest |
| 159 |
if: always() |
| 160 |
run: | |
| 161 |
# check library can be compiled with XXH_NO_STREAM, resulting in no streaming symbols |
| 162 |
make clean noxxh3test |
| 163 |
|
| 164 |
- name: make avx512f |
| 165 |
run: | |
| 166 |
CFLAGS="-O1 -mavx512f -Werror" make clean default |
| 167 |
|
| 168 |
- name: test-all |
| 169 |
if: always() |
| 170 |
run: | |
| 171 |
make clean test-all |
| 172 |
|
| 173 |
|
| 174 |
ubuntu-consistency: |
| 175 |
name: Linux x64 check results consistency |
| 176 |
runs-on: ubuntu-latest |
| 177 |
steps: |
| 178 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 179 |
|
| 180 |
- name: Environment info |
| 181 |
run: | |
| 182 |
echo && gcc --version |
| 183 |
echo && make -v |
| 184 |
echo && cat /proc/cpuinfo || echo /proc/cpuinfo is not present |
| 185 |
|
| 186 |
- name: Scalar code path |
| 187 |
run: | |
| 188 |
CPPFLAGS=-DXXH_VECTOR=XXH_SCALAR make clean check |
| 189 |
|
| 190 |
- name: SSE2 code path |
| 191 |
run: | |
| 192 |
CPPFLAGS=-DXXH_VECTOR=XXH_SSE2 make clean check |
| 193 |
|
| 194 |
- name: AVX2 code path |
| 195 |
run: | |
| 196 |
CPPFLAGS="-mavx2 -DXXH_VECTOR=XXH_AVX2" make clean check |
| 197 |
|
| 198 |
# As for AVX512, see "Known critical issues" at the top of this file |
| 199 |
- name: AVX512 code path |
| 200 |
run: | |
| 201 |
# Run "make check" if /proc/cpuinfo has flags for avx512. |
| 202 |
grep -q "^flags.*\bavx512\b" /proc/cpuinfo && CPPFLAGS="-mavx512f -DXXH_VECTOR=XXH_AVX512" make clean check || (echo This test runner does not support AVX512. && $(exit 0)) |
| 203 |
|
| 204 |
- name: reroll code path (#240) |
| 205 |
run: | |
| 206 |
CPPFLAGS=-DXXH_REROLL=1 make clean check |
| 207 |
|
| 208 |
- name: tests/bench |
| 209 |
run: | |
| 210 |
make -C tests/bench |
| 211 |
|
| 212 |
|
| 213 |
ubuntu-wasm: |
| 214 |
name: Ubuntu Node ${{ matrix.node-version }} WebAssembly/asm.js tests |
| 215 |
runs-on: ubuntu-latest |
| 216 |
strategy: |
| 217 |
matrix: |
| 218 |
node-version: [16.x, 17.x, 18.x] |
| 219 |
|
| 220 |
env: |
| 221 |
EM_VERSION: 3.1.33 # TODO: more emsdk versions |
| 222 |
EM_CACHE_FOLDER: emsdk-cache-${{ matrix.node-version }} |
| 223 |
CC: emcc |
| 224 |
|
| 225 |
steps: |
| 226 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 227 |
|
| 228 |
- name: Setup cache |
| 229 |
id: cache-system-libraries |
| 230 |
uses: actions/cache@v4 |
| 231 |
with: |
| 232 |
path: ${{env.EM_CACHE_FOLDER}} |
| 233 |
key: em${{env.EM_VERSION}}-node${{ matrix.node-version }}-${{ runner.os }} |
| 234 |
|
| 235 |
- name: Setup emsdk |
| 236 |
uses: mymindstorm/setup-emsdk@v14 |
| 237 |
with: |
| 238 |
version: ${{env.EM_VERSION}} |
| 239 |
actions-cache-folder: ${{env.EM_CACHE_FOLDER}} |
| 240 |
|
| 241 |
- name: Use Node.js ${{ matrix.node-version }} |
| 242 |
uses: actions/setup-node@v4 |
| 243 |
with: |
| 244 |
node-version: ${{ matrix.node-version }} |
| 245 |
|
| 246 |
- name: Environment info |
| 247 |
run: | |
| 248 |
echo && node -p '`node version: ${process.versions.node}, v8 version: ${process.versions.v8}`' |
| 249 |
echo && emcc --version |
| 250 |
echo && make -v |
| 251 |
echo && cat /proc/cpuinfo || echo /proc/cpuinfo is not present |
| 252 |
|
| 253 |
- name: Scalar code path |
| 254 |
run: | |
| 255 |
CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" RUN_ENV="node" NODE_JS=1 make clean check |
| 256 |
|
| 257 |
- name: SIMD128 (via NEON SIMDe) code path (XXH_VECTOR=XXH_NEON) |
| 258 |
run: | |
| 259 |
CPPFLAGS="-DXXH_VECTOR=XXH_NEON -msimd128" RUN_ENV="node" NODE_JS=1 make clean check |
| 260 |
|
| 261 |
- name: Scalar asm.js (-sWASM=0) |
| 262 |
run: | |
| 263 |
CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" RUN_ENV="node" NODE_JS=1 LDFLAGS="-sWASM=0" make clean check |
| 264 |
|
| 265 |
|
| 266 |
ubuntu-misc: |
| 267 |
name: Linux x64 misc tests |
| 268 |
runs-on: ubuntu-latest |
| 269 |
steps: |
| 270 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 271 |
|
| 272 |
- name: apt-get install |
| 273 |
run: | |
| 274 |
sudo apt-get update |
| 275 |
sudo apt-get install valgrind cppcheck |
| 276 |
|
| 277 |
- name: Environment info |
| 278 |
run: | |
| 279 |
echo && gcc --version |
| 280 |
echo && clang --version |
| 281 |
echo && valgrind --version |
| 282 |
echo && cppcheck --version |
| 283 |
echo && make -v |
| 284 |
echo && cat /proc/cpuinfo || echo /proc/cpuinfo is not present |
| 285 |
|
| 286 |
- name: cppcheck |
| 287 |
run: | |
| 288 |
# This test script ignores exit code of cppcheck. See knowin issues |
| 289 |
# at the top of this file. |
| 290 |
make clean cppcheck || echo There are some cppcheck reports |
| 291 |
|
| 292 |
- name: test-mem (valgrind) |
| 293 |
run: | |
| 294 |
make clean test-mem |
| 295 |
|
| 296 |
- name: usan |
| 297 |
run: | |
| 298 |
make clean usan |
| 299 |
|
| 300 |
- name: Lint Unicode in root-dir, cli/, tests/, tests/bench/, tests/collisions/. |
| 301 |
run: | |
| 302 |
make lint-unicode |
| 303 |
|
| 304 |
- name: test-filename-escape |
| 305 |
# See also issue #695 - https://github.com/Cyan4973/xxHash/issues/695 |
| 306 |
run: | |
| 307 |
make clean test-filename-escape |
| 308 |
|
| 309 |
- name: test-cli-comment-line |
| 310 |
run: | |
| 311 |
make clean test-cli-comment-line |
| 312 |
|
| 313 |
ubuntu-cmake-unofficial: |
| 314 |
name: Linux x64 cmake unofficial build test |
| 315 |
runs-on: ubuntu-latest |
| 316 |
steps: |
| 317 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 318 |
|
| 319 |
- name: Environment info |
| 320 |
run: | |
| 321 |
echo && gcc --version |
| 322 |
echo && cmake --version |
| 323 |
echo && make -v |
| 324 |
echo && cat /proc/cpuinfo || echo /proc/cpuinfo is not present |
| 325 |
|
| 326 |
- name: cmake |
| 327 |
run: | |
| 328 |
cd cmake_unofficial |
| 329 |
cmake -Bbuild |
| 330 |
cd build |
| 331 |
CFLAGS=-Werror make |
| 332 |
mkdir -p test_install_dir |
| 333 |
DESTDIR=test_install_dir cmake --install . |
| 334 |
|
| 335 |
- name: cmake pkgconfig generation |
| 336 |
run: | |
| 337 |
cd cmake_unofficial |
| 338 |
pwd |
| 339 |
ls |
| 340 |
rm -rf build |
| 341 |
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_INCLUDEDIR=/usr/include -DCMAKE_INSTALL_LIBDIR=/usr/lib |
| 342 |
echo "checking content of libxxhash.pc" |
| 343 |
cat build/libxxhash.pc | grep "libdir=/usr/lib" |
| 344 |
cat build/libxxhash.pc | grep "includedir=/usr/include" |
| 345 |
|
| 346 |
- name: cmake minimum version v3.10 test |
| 347 |
run: | |
| 348 |
mkdir -p cmake_bins |
| 349 |
cd cmake_bins |
| 350 |
wget https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.tar.gz |
| 351 |
tar xzf cmake-3.10.0-Linux-x86_64.tar.gz |
| 352 |
cd ../cmake_unofficial |
| 353 |
rm -rf build |
| 354 |
pwd |
| 355 |
ls |
| 356 |
mkdir -p build |
| 357 |
cd build |
| 358 |
../../cmake_bins/cmake-3.10.0-Linux-x86_64/bin/cmake --version |
| 359 |
../../cmake_bins/cmake-3.10.0-Linux-x86_64/bin/cmake .. |
| 360 |
../../cmake_bins/cmake-3.10.0-Linux-x86_64/bin/cmake --build . |
| 361 |
mkdir -p test_install_dir |
| 362 |
DESTDIR=test_install_dir ../../cmake_bins/cmake-3.10.0-Linux-x86_64/bin/cmake --install . |
| 363 |
rm -rf * |
| 364 |
../../cmake_bins/cmake-3.10.0-Linux-x86_64/bin/cmake -DCMAKE_BUILD_TYPE=Debug .. |
| 365 |
../../cmake_bins/cmake-3.10.0-Linux-x86_64/bin/cmake --build . |
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
# Linux, { ARM, ARM64, PPC64LE, PPC64, S390X } |
| 370 |
# All tests are using QEMU and gcc cross compiler. |
| 371 |
|
| 372 |
qemu-consistency: |
| 373 |
name: QEMU ${{ matrix.name }} |
| 374 |
runs-on: ${{ matrix.os }} |
| 375 |
strategy: |
| 376 |
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed. |
| 377 |
matrix: |
| 378 |
include: [ |
| 379 |
{ name: 'ARM', xcc_pkg: gcc-arm-linux-gnueabi, xcc: arm-linux-gnueabi-gcc, xemu_pkg: qemu-system-arm, xemu: qemu-arm-static, os: ubuntu-latest, }, |
| 380 |
{ name: 'AARCH64', xcc_pkg: gcc-aarch64-linux-gnu, xcc: aarch64-linux-gnu-gcc, xemu_pkg: qemu-system-arm, xemu: qemu-aarch64-static, os: ubuntu-latest, }, |
| 381 |
{ name: 'PPC64LE', xcc_pkg: gcc-powerpc64le-linux-gnu, xcc: powerpc64le-linux-gnu-gcc, xemu_pkg: qemu-system-ppc, xemu: qemu-ppc64le-static, os: ubuntu-latest, }, |
| 382 |
{ name: 'PPC64', xcc_pkg: gcc-powerpc64-linux-gnu, xcc: powerpc64-linux-gnu-gcc, xemu_pkg: qemu-system-ppc, xemu: qemu-ppc64-static, os: ubuntu-latest, }, |
| 383 |
{ name: 'S390X', xcc_pkg: gcc-s390x-linux-gnu, xcc: s390x-linux-gnu-gcc, xemu_pkg: qemu-system-s390x, xemu: qemu-s390x-static, os: ubuntu-latest, }, |
| 384 |
{ name: 'MIPS', xcc_pkg: gcc-mips-linux-gnu, xcc: mips-linux-gnu-gcc, xemu_pkg: qemu-system-mips, xemu: qemu-mips-static, os: ubuntu-latest, }, |
| 385 |
{ name: 'M68K', xcc_pkg: gcc-m68k-linux-gnu, xcc: m68k-linux-gnu-gcc, xemu_pkg: qemu-system-m68k, xemu: qemu-m68k-static, os: ubuntu-latest, }, |
| 386 |
{ name: 'RISC-V', xcc_pkg: gcc-riscv64-linux-gnu, xcc: riscv64-linux-gnu-gcc, xemu_pkg: qemu-system-riscv64,xemu: qemu-riscv64-static, os: ubuntu-latest, }, |
| 387 |
# SPARC64 qemu emulation seems broken on Ubuntu-22 |
| 388 |
{ name: 'SPARC', xcc_pkg: gcc-sparc64-linux-gnu, xcc: sparc64-linux-gnu-gcc, xemu_pkg: qemu-system-sparc, xemu: qemu-sparc64-static, os: ubuntu-20.04, }, |
| 389 |
{ name: 'LoongArch', xcc_pkg: gcc-14-loongarch64-linux-gnu, xcc: loongarch64-linux-gnu-gcc-14, xemu_pkg: qemu-system-loongarch64, xemu: qemu-loongarch64-static, os: ubuntu-24.04, }, |
| 390 |
|
| 391 |
{ name: 'ARM, gcc-10', xcc_pkg: gcc-10-arm-linux-gnueabi, xcc: arm-linux-gnueabi-gcc-10, xemu_pkg: qemu-system-arm, xemu: qemu-arm-static, os: ubuntu-20.04, }, |
| 392 |
{ name: 'AARCH64, gcc-10', xcc_pkg: gcc-10-aarch64-linux-gnu, xcc: aarch64-linux-gnu-gcc-10, xemu_pkg: qemu-system-arm, xemu: qemu-aarch64-static, os: ubuntu-20.04, }, |
| 393 |
{ name: 'PPC64LE, gcc-10', xcc_pkg: gcc-10-powerpc64le-linux-gnu, xcc: powerpc64le-linux-gnu-gcc-10, xemu_pkg: qemu-system-ppc, xemu: qemu-ppc64le-static, os: ubuntu-20.04, }, |
| 394 |
{ name: 'PPC64, gcc-10', xcc_pkg: gcc-10-powerpc64-linux-gnu, xcc: powerpc64-linux-gnu-gcc-10, xemu_pkg: qemu-system-ppc, xemu: qemu-ppc64-static, os: ubuntu-20.04, }, |
| 395 |
{ name: 'S390X, gcc-10', xcc_pkg: gcc-10-s390x-linux-gnu, xcc: s390x-linux-gnu-gcc-10, xemu_pkg: qemu-system-s390x, xemu: qemu-s390x-static, os: ubuntu-20.04, }, |
| 396 |
{ name: 'MIPS, gcc-10', xcc_pkg: gcc-10-mips-linux-gnu, xcc: mips-linux-gnu-gcc-10, xemu_pkg: qemu-system-mips, xemu: qemu-mips-static, os: ubuntu-20.04, }, |
| 397 |
|
| 398 |
{ name: 'ARM, gcc-9', xcc_pkg: gcc-9-arm-linux-gnueabi, xcc: arm-linux-gnueabi-gcc-9, xemu_pkg: qemu-system-arm, xemu: qemu-arm-static, os: ubuntu-20.04, }, |
| 399 |
# SVE tests require at least gcc-10.1 |
| 400 |
# { name: 'AARCH64, gcc-9', xcc_pkg: gcc-9-aarch64-linux-gnu, xcc: aarch64-linux-gnu-gcc-9, xemu_pkg: qemu-system-arm, xemu: qemu-aarch64-static, os: ubuntu-20.04, }, |
| 401 |
{ name: 'PPC64LE, gcc-9', xcc_pkg: gcc-9-powerpc64le-linux-gnu, xcc: powerpc64le-linux-gnu-gcc-9, xemu_pkg: qemu-system-ppc, xemu: qemu-ppc64le-static, os: ubuntu-20.04, }, |
| 402 |
{ name: 'PPC64, gcc-9', xcc_pkg: gcc-9-powerpc64-linux-gnu, xcc: powerpc64-linux-gnu-gcc-9, xemu_pkg: qemu-system-ppc, xemu: qemu-ppc64-static, os: ubuntu-20.04, }, |
| 403 |
{ name: 'S390X, gcc-9', xcc_pkg: gcc-9-s390x-linux-gnu, xcc: s390x-linux-gnu-gcc-9, xemu_pkg: qemu-system-s390x, xemu: qemu-s390x-static, os: ubuntu-20.04, }, |
| 404 |
{ name: 'MIPS, gcc-9', xcc_pkg: gcc-9-mips-linux-gnu, xcc: mips-linux-gnu-gcc-9, xemu_pkg: qemu-system-mips, xemu: qemu-mips-static, os: ubuntu-20.04, }, |
| 405 |
|
| 406 |
{ name: 'ARM, gcc-8', xcc_pkg: gcc-8-arm-linux-gnueabi, xcc: arm-linux-gnueabi-gcc-8, xemu_pkg: qemu-system-arm, xemu: qemu-arm-static, os: ubuntu-20.04, }, |
| 407 |
# aarch64-linux-gnu-gcc-8 linker has an issue for LDFLAGS="-static" |
| 408 |
# { name: 'AARCH64, gcc-8', xcc_pkg: gcc-8-aarch64-linux-gnu, xcc: aarch64-linux-gnu-gcc-8, xemu_pkg: qemu-system-arm, xemu: qemu-aarch64-static, os: ubuntu-20.04, }, |
| 409 |
{ name: 'PPC64LE, gcc-8', xcc_pkg: gcc-8-powerpc64le-linux-gnu, xcc: powerpc64le-linux-gnu-gcc-8, xemu_pkg: qemu-system-ppc, xemu: qemu-ppc64le-static, os: ubuntu-20.04, }, |
| 410 |
{ name: 'PPC64, gcc-8', xcc_pkg: gcc-8-powerpc64-linux-gnu, xcc: powerpc64-linux-gnu-gcc-8, xemu_pkg: qemu-system-ppc, xemu: qemu-ppc64-static, os: ubuntu-20.04, }, |
| 411 |
{ name: 'S390X, gcc-8', xcc_pkg: gcc-8-s390x-linux-gnu, xcc: s390x-linux-gnu-gcc-8, xemu_pkg: qemu-system-s390x, xemu: qemu-s390x-static, os: ubuntu-20.04, }, |
| 412 |
# ubuntu-20.04 fails to retrieve gcc-8-mips-linux-gnu for some reason. |
| 413 |
# { name: 'MIPS, gcc-8', xcc_pkg: gcc-8-mips-linux-gnu, xcc: mips-linux-gnu-gcc-8, xemu_pkg: qemu-system-mips, xemu: qemu-mips-static, os: ubuntu-20.04, }, |
| 414 |
] |
| 415 |
env: # Set environment variables |
| 416 |
XCC: ${{ matrix.xcc }} |
| 417 |
XEMU: ${{ matrix.xemu }} |
| 418 |
MOREFLAGS: -Werror |
| 419 |
steps: |
| 420 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 421 |
- name: apt update & install (1) |
| 422 |
run: | |
| 423 |
sudo apt-get update |
| 424 |
sudo apt-get install gcc-multilib g++-multilib qemu-utils qemu-user-static |
| 425 |
|
| 426 |
- name: Environment info (1) |
| 427 |
run: | |
| 428 |
echo && apt-cache search "^gcc-" | grep "linux" | sort |
| 429 |
|
| 430 |
- name: apt update & install (2) |
| 431 |
run: | |
| 432 |
sudo apt-get install ${{ matrix.xcc_pkg }} ${{ matrix.xemu_pkg }} |
| 433 |
|
| 434 |
- name: Environment info (2) |
| 435 |
run: | |
| 436 |
echo && which $XCC |
| 437 |
echo && $XCC --version |
| 438 |
echo && $XCC -v # Show built-in specs |
| 439 |
echo && which $XEMU |
| 440 |
echo && $XEMU --version |
| 441 |
|
| 442 |
- name: ARM (XXH_VECTOR=[ scalar, NEON ]) |
| 443 |
if: ${{ startsWith(matrix.name, 'ARM') }} |
| 444 |
run: | |
| 445 |
CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check |
| 446 |
CPPFLAGS="-DXXH_VECTOR=XXH_NEON" CFLAGS="-O3 -march=armv7-a -fPIC -mfloat-abi=softfp -mfpu=neon-vfpv4" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check |
| 447 |
make -C tests clean |
| 448 |
CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make -C tests sanity_test_vectors.h test_sanity |
| 449 |
|
| 450 |
- name: AARCH64 (XXH_VECTOR=[ scalar, NEON, SVE ]) |
| 451 |
if: ${{ startsWith(matrix.name, 'AARCH64') }} |
| 452 |
run: | |
| 453 |
CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check |
| 454 |
CPPFLAGS="-DXXH_VECTOR=XXH_NEON" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check |
| 455 |
CPPFLAGS="-DXXH_VECTOR=XXH_SVE" LDFLAGS="-static" CC="$XCC -march=armv8.2-a+sve" RUN_ENV="$XEMU -cpu max,sve128=on,sve256=off,sve512=off,sve1024=off,sve2048=off" make clean check |
| 456 |
CPPFLAGS="-DXXH_VECTOR=XXH_SVE" LDFLAGS="-static" CC="$XCC -march=armv8.2-a+sve" RUN_ENV="$XEMU -cpu max,sve128=on,sve256=on,sve512=off,sve1024=off,sve2048=off" make clean check |
| 457 |
CPPFLAGS="-DXXH_VECTOR=XXH_SVE" LDFLAGS="-static" CC="$XCC -march=armv8.2-a+sve" RUN_ENV="$XEMU -cpu max,sve128=on,sve256=on,sve512=on,sve1024=off,sve2048=off" make clean check |
| 458 |
CPPFLAGS="-DXXH_VECTOR=XXH_SVE" LDFLAGS="-static" CC="$XCC -march=armv8.2-a+sve" RUN_ENV="$XEMU -cpu max,sve128=on,sve256=on,sve512=on,sve1024=on,sve2048=off" make clean check |
| 459 |
CPPFLAGS="-DXXH_VECTOR=XXH_SVE" LDFLAGS="-static" CC="$XCC -march=armv8.2-a+sve" RUN_ENV="$XEMU -cpu max,sve128=on,sve256=on,sve512=on,sve1024=on,sve2048=on" make clean check |
| 460 |
|
| 461 |
- name: PPC64(LE) (XXH_VECTOR=[ scalar, VSX ]) |
| 462 |
if: ${{ startsWith(matrix.name, 'PPC64') }} |
| 463 |
run: | |
| 464 |
CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check |
| 465 |
CPPFLAGS="-DXXH_VECTOR=XXH_VSX" CFLAGS="-O3 -maltivec -mvsx -mpower8-vector -mcpu=power8" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check |
| 466 |
|
| 467 |
- name: S390X (XXH_VECTOR=[ scalar, VSX ]) |
| 468 |
if: ${{ startsWith(matrix.name, 'S390X') }} |
| 469 |
run: | |
| 470 |
CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check |
| 471 |
CPPFLAGS=-DXXH_VECTOR=XXH_VSX CFLAGS="-O3 -march=arch11 -mzvector" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check |
| 472 |
|
| 473 |
- name: MIPS-M68K-RISCV-SPARC (XXH_VECTOR=[ scalar ]) |
| 474 |
if: ${{ startsWith(matrix.name, 'MIPS') || startsWith(matrix.name, 'M68K') || startsWith(matrix.name, 'RISC-V') || startsWith(matrix.name, 'SPARC') }} |
| 475 |
run: | |
| 476 |
make clean; LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make check |
| 477 |
|
| 478 |
- name: LoongArch (XXH_VECTOR=[ scalar, LSX ]) |
| 479 |
if: ${{ startsWith(matrix.name, 'LoongArch') }} |
| 480 |
run: | |
| 481 |
CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check |
| 482 |
CPPFLAGS=-DXXH_VECTOR=XXH_LSX CFLAGS="-O3 -march=la464 -mlsx" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check |
| 483 |
|
| 484 |
# macOS |
| 485 |
|
| 486 |
macos-general: |
| 487 |
name: ${{ matrix.system.os }} |
| 488 |
runs-on: ${{ matrix.system.os }} |
| 489 |
strategy: |
| 490 |
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed. |
| 491 |
matrix: |
| 492 |
system: [ |
| 493 |
{ os: macos-13 }, |
| 494 |
{ os: macos-14 }, |
| 495 |
{ os: macos-15 }, |
| 496 |
{ os: macos-latest }, |
| 497 |
] |
| 498 |
steps: |
| 499 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 500 |
|
| 501 |
- name: Environment info |
| 502 |
run: | |
| 503 |
echo && clang --version |
| 504 |
echo && sysctl -a | grep machdep.cpu # cpuinfo |
| 505 |
|
| 506 |
- name: make |
| 507 |
run: | |
| 508 |
CFLAGS="-Werror" make clean default |
| 509 |
|
| 510 |
- name: make test |
| 511 |
run: | |
| 512 |
# test scenario where "stdout" is not the console |
| 513 |
make clean test MOREFLAGS='-Werror' | tee |
| 514 |
|
| 515 |
|
| 516 |
# Windows, { VC++2022, VC++2019 } x { x64, Win32, ARM, ARM64 } |
| 517 |
# |
| 518 |
# - Default shell for Windows environment is PowerShell Core. |
| 519 |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell |
| 520 |
# |
| 521 |
# - "windows-2022" uses Visual Studio 2022. |
| 522 |
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md#visual-studio-enterprise-2022 |
| 523 |
# |
| 524 |
# - "windows-2019" uses Visual Studio 2019. |
| 525 |
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019 |
| 526 |
|
| 527 |
windows-visualc-general: |
| 528 |
name: ${{ matrix.system.vc }}, ${{ matrix.arch }} |
| 529 |
runs-on: ${{ matrix.system.os }} # Runs-on foreach value of strategy.matrix.system.os |
| 530 |
strategy: |
| 531 |
fail-fast: false # 'false' means: Don't stop matrix workflows even if some matrix failed. |
| 532 |
matrix: |
| 533 |
system: [ |
| 534 |
{ os: windows-2022, vc: "VC++ 2022", clangcl: 'true', }, |
| 535 |
{ os: windows-2019, vc: "VC++ 2019", clangcl: 'true', }, |
| 536 |
] |
| 537 |
arch: [ x64, Win32, ARM64 ] |
| 538 |
|
| 539 |
steps: |
| 540 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 541 |
|
| 542 |
- name: Build ${{ matrix.system.os }}, ${{ matrix.arch }} |
| 543 |
run: | |
| 544 |
cd cmake_unofficial |
| 545 |
mkdir build |
| 546 |
cd build |
| 547 |
cmake .. -DCMAKE_BUILD_TYPE=Release -A ${{ matrix.arch }} -DCMAKE_C_FLAGS="/W4 /WX" |
| 548 |
cmake --build . --config Release |
| 549 |
|
| 550 |
- name: Test |
| 551 |
# Run benchmark for testing only if target arch is x64 or Win32. |
| 552 |
if: ${{ matrix.arch == 'x64' || matrix.arch == 'Win32' }} |
| 553 |
run: | |
| 554 |
.\cmake_unofficial\build\Release\xxhsum.exe -bi1 |
| 555 |
|
| 556 |
- name: Build ${{ matrix.system.os }}, ${{ matrix.arch }}, with DISPATCH |
| 557 |
# DISPATCH only if target arch is x64 or Win32. |
| 558 |
if: ${{ ( matrix.arch == 'x64' || matrix.arch == 'Win32' ) }} |
| 559 |
run: | |
| 560 |
cd cmake_unofficial |
| 561 |
mkdir build-visual-dispatch |
| 562 |
cd build-visual-dispatch |
| 563 |
cmake .. -DCMAKE_BUILD_TYPE=Release -DDISPATCH=ON -A x64 -DCMAKE_C_FLAGS="/W4 /WX" |
| 564 |
cmake --build . --config Release |
| 565 |
|
| 566 |
- name: Runtime Test (DISPATCH) |
| 567 |
# Run benchmark for testing only if target arch is x64 or Win32. |
| 568 |
if: ${{ ( matrix.arch == 'x64' || matrix.arch == 'Win32' ) }} |
| 569 |
run: | |
| 570 |
.\cmake_unofficial\build-visual-dispatch\Release\xxhsum.exe -V | grep autoVec |
| 571 |
.\cmake_unofficial\build-visual-dispatch\Release\xxhsum.exe -bi1 |
| 572 |
|
| 573 |
|
| 574 |
- name: Build ${{ matrix.system.os }}, clang-cl, ${{ matrix.arch }} |
| 575 |
if: ${{ matrix.system.clangcl == 'true' }} |
| 576 |
run: | |
| 577 |
cd cmake_unofficial |
| 578 |
mkdir build-clang-cl |
| 579 |
cd build-clang-cl |
| 580 |
cmake .. -DCMAKE_BUILD_TYPE=Release -A x64 -DCMAKE_GENERATOR_TOOLSET=ClangCL |
| 581 |
cmake --build . --config Release |
| 582 |
|
| 583 |
- name: Test (clang-cl) |
| 584 |
# Run benchmark for testing only if target arch is x64 or Win32. |
| 585 |
if: ${{ matrix.system.clangcl == 'true' && ( matrix.arch == 'x64' || matrix.arch == 'Win32' ) }} |
| 586 |
run: | |
| 587 |
.\cmake_unofficial\build-clang-cl\Release\xxhsum.exe -bi1 |
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
# Windows, { mingw64, mingw32 } |
| 592 |
# |
| 593 |
# - Shell for msys2 is sh (msys2). defaults.run.shell is for this setting. |
| 594 |
# |
| 595 |
# https://github.com/msys2/MINGW-packages/blob/master/.github/workflows/main.yml |
| 596 |
# https://github.com/actions/starter-workflows/issues/95 |
| 597 |
|
| 598 |
windows-msys2-general: |
| 599 |
name: Windows ${{ matrix.msystem }} |
| 600 |
runs-on: windows-latest |
| 601 |
strategy: |
| 602 |
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed. |
| 603 |
matrix: |
| 604 |
include: [ |
| 605 |
{ msystem: mingw64, toolchain: mingw-w64-x86_64-toolchain }, |
| 606 |
{ msystem: mingw32, toolchain: mingw-w64-i686-toolchain }, |
| 607 |
] |
| 608 |
defaults: |
| 609 |
run: |
| 610 |
shell: msys2 {0} |
| 611 |
steps: |
| 612 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 613 |
- uses: msys2/setup-msys2@7efe20baefed56359985e327d329042cde2434ff # v2 |
| 614 |
with: |
| 615 |
msystem: MSYS |
| 616 |
install: mingw-w64-i686-make ${{ matrix.toolchain }} |
| 617 |
update: true |
| 618 |
|
| 619 |
- name: Update |
| 620 |
run: | |
| 621 |
pacman --noconfirm -Suuy |
| 622 |
pacman --noconfirm -Suu |
| 623 |
|
| 624 |
- name: mingw64 |
| 625 |
if: ${{ matrix.msystem == 'mingw64' }} |
| 626 |
run: | |
| 627 |
PATH=/mingw64/bin:$PATH /mingw32/bin/mingw32-make clean test gcc-og-test MOREFLAGS=-Werror |
| 628 |
PATH=/mingw64/bin:$PATH /mingw32/bin/mingw32-make -C tests/bench |
| 629 |
# Abort if result of "file ./xxhsum.exe" doesn't contain 'x86-64'. |
| 630 |
# Expected output is "./xxhsum.exe: PE32+ executable (console) x86-64, for MS Windows" |
| 631 |
file ./xxhsum.exe |
| 632 |
file ./xxhsum.exe | grep -q 'x86-64' || $(exit 1) |
| 633 |
./xxhsum.exe --version |
| 634 |
|
| 635 |
- name: mingw32 |
| 636 |
if: ${{ matrix.msystem == 'mingw32' }} |
| 637 |
run: | |
| 638 |
PATH=/mingw32/bin:$PATH /mingw32/bin/mingw32-make.exe clean test MOREFLAGS=-Werror |
| 639 |
PATH=/mingw32/bin:$PATH /mingw32/bin/mingw32-make.exe -C tests/bench |
| 640 |
# Abort if result of "file ./xxhsum.exe" doesn't contain '80386'. |
| 641 |
# Expected output is "./xxhsum.exe: PE32 executable (console) Intel i386, for MS Windows" |
| 642 |
file ./xxhsum.exe |
| 643 |
file ./xxhsum.exe | grep -q '386' || $(exit 1) |
| 644 |
./xxhsum.exe --version |