| name: dev-short-tests | |
| # Faster tests: mostly build tests, along with some other | |
| # misc tests | |
| concurrency: | |
| group: fast-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| pull_request: | |
| branches: [ dev, release, actionsTest ] | |
| permissions: read-all | |
| jobs: | |
| linux-kernel: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: linux kernel, library + build + test | |
| run: make -C contrib/linux-kernel test CFLAGS="-Werror -Wunused-const-variable -Wunused-but-set-variable" | |
| benchmarking: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: make benchmarking | |
| run: make benchmarking | |
| check-32bit: # designed to catch https://github.com/facebook/zstd/issues/2428 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: make check on 32-bit | |
| run: | | |
| sudo apt update | |
| APT_PACKAGES="gcc-multilib" make apt-install | |
| CFLAGS="-m32 -O1 -fstack-protector" make check V=1 | |
| CFLAGS="-m32 -O1 -fstack-protector" make V=1 -C tests test-cli-tests | |
| build-c89: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: ensure zstd can be built with c89/c90 compilers (+ long long support + variadic macros) | |
| run: | | |
| make c89build V=1 | |
| build-zstd-dll: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: build zstd bin against a dynamic lib (debuglevel for more dependencies) | |
| run: | | |
| make -C lib lib-mt-release | |
| DEBUGLEVEL=2 make -C programs zstd-dll | |
| gcc-7-libzstd: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: gcc-7 + libzstdmt compilation | |
| # See https://askubuntu.com/a/1428822 | |
| run: | | |
| echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe" | sudo tee -a /etc/apt/sources.list | |
| sudo apt-get -qqq update | |
| sudo apt-get -yq --no-install-suggests --no-install-recommends install libc6-dev-i386 gcc-multilib gcc-7 gcc-7-multilib | |
| CC=gcc-7 CFLAGS=-Werror make -j all | |
| make clean | |
| LDFLAGS=-Wl,--no-undefined make -C lib libzstd-mt | |
| # candidate test (for discussion) : underlink test | |
| # LDFLAGS=-Wl,--no-undefined : will make the linker fail if dll is underlinked | |
| cpp-gnu90-c99-compatibility: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: C++, gnu90 and c99 compatibility | |
| run: | | |
| make cxxtest | |
| make clean | |
| make gnu90build | |
| make clean | |
| make c99build | |
| make clean | |
| make travis-install # just ensures `make install` works | |
| mingw-cross-compilation: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: mingw cross-compilation | |
| run: | | |
| # sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix; (doesn't work) | |
| sudo apt-get -qqq update | |
| sudo apt-get install gcc-mingw-w64 | |
| CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CFLAGS="-Werror -O1" make zstd | |
| armbuild: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: ARM Build Test | |
| run: | | |
| sudo apt-get -qqq update | |
| make arminstall | |
| make armbuild | |
| bourne-shell: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Bourne shell compatibility (shellcheck) | |
| run: | | |
| wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz | |
| tar -xf shellcheck-v0.7.1.linux.x86_64.tar.xz | |
| shellcheck-v0.7.1/shellcheck --shell=sh --severity=warning --exclude=SC2010 tests/playTests.sh | |
| zlib-wrapper: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: install valgrind | |
| run: | | |
| sudo apt-get -qqq update | |
| make valgrindinstall V=1 | |
| - name: zlib wrapper test | |
| run: make -C zlibWrapper test V=1 | |
| - name: zlib wrapper test under valgrind | |
| run: make -C zlibWrapper test-valgrind V=1 | |
| lz4-threadpool-libs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: LZ4, thread pool, and libs build testslib wrapper test | |
| run: | | |
| make -C tests test-lz4 | |
| make check < /dev/null | tee # mess with lz4 console detection | |
| make clean | |
| make -C tests test-pool | |
| make clean | |
| bash tests/libzstd_builds.sh | |
| gcc-make-all-avx2: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Make all, with AVX2 | |
| run: | | |
| sudo apt-get -qqq update | |
| make libc6install | |
| CFLAGS="-Werror -mavx2" make -j all | |
| gcc-make-all-32bit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Make all, 32bit mode | |
| run: | | |
| sudo apt-get -qqq update | |
| make libc6install | |
| CFLAGS="-Werror -m32" make -j all32 | |
| gcc-make-all-32bit-avx2: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Make all, 32bit + AVX2 mode | |
| run: | | |
| sudo apt-get -qqq update | |
| make libc6install | |
| CPPFLAGS="-DSTATIC_BMI2=1" CFLAGS="-Werror -m32 -mavx2 -mbmi2" make -j all32 | |
| gcc-8-make: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: gcc-8 build | |
| # See https://askubuntu.com/a/1428822 | |
| run: | | |
| echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe" | sudo tee -a /etc/apt/sources.list | |
| sudo apt-get -qqq update | |
| sudo apt-get -yq --no-install-suggests --no-install-recommends install libc6-dev-i386 gcc-multilib gcc-8 gcc-8-multilib | |
| CC=gcc-8 CFLAGS="-Werror" make -j all | |
| make-external-compressors: | |
| strategy: | |
| matrix: | |
| include: | |
| - name: "no external compressors" | |
| flags: "HAVE_ZLIB=0 HAVE_LZ4=0 HAVE_LZMA=0" | |
| - name: "only zlib" | |
| flags: "HAVE_ZLIB=1 HAVE_LZ4=0 HAVE_LZMA=0" | |
| - name: "only lz4" | |
| flags: "HAVE_ZLIB=0 HAVE_LZ4=1 HAVE_LZMA=0" | |
| - name: "only lzma" | |
| flags: "HAVE_ZLIB=0 HAVE_LZ4=0 HAVE_LZMA=1" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Build with ${{matrix.name}} | |
| run: | | |
| sudo apt install liblzma-dev | |
| ${{matrix.flags}} make zstd | |
| implicit-fall-through: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: -Wimplicit-fallthrough build | |
| run: | | |
| make clean | |
| CC=gcc MOREFLAGS="-Werror -Wimplicit-fallthrough=2 -O0" make -C lib -j libzstd.a ZSTD_LEGACY_SUPPORT=0 | |
| make clean | |
| CC=clang MOREFLAGS="-Werror -Wimplicit-fallthrough -O0" make -C lib -j libzstd.a ZSTD_LEGACY_SUPPORT=0 | |
| meson-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Install packages | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install build-essential python3-pip ninja-build liblz4-dev liblzma-dev | |
| pip install --pre meson | |
| - name: Build with Meson | |
| run: | | |
| meson setup \ | |
| --buildtype=debugoptimized \ | |
| -Db_lundef=false \ | |
| -Dauto_features=enabled \ | |
| -Dbin_programs=true \ | |
| -Dbin_tests=true \ | |
| -Dbin_contrib=true \ | |
| -Ddefault_library=both \ | |
| -Dlegacy_level=1 \ | |
| build/meson mesonBuild | |
| ninja -C mesonBuild/ | |
| meson test -C mesonBuild/ --print-errorlogs | |
| meson install -C mesonBuild --destdir staging/ | |
| meson-mingw-cross-compilation: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Install packages | |
| run: | | |
| sudo apt-get -qqq update | |
| sudo apt-get -y install build-essential python3-pip ninja-build {gcc,g++}-mingw-w64-x86-64 | |
| pip install --pre meson | |
| - name: Build with Meson | |
| run: | | |
| cat > cross.ini <<EOF | |
| [binaries] | |
| ar = 'x86_64-w64-mingw32-ar' | |
| c = 'x86_64-w64-mingw32-gcc' | |
| cpp = 'x86_64-w64-mingw32-g++' | |
| ld = 'x86_64-w64-mingw32-ld' | |
| objcopy = 'x86_64-w64-mingw32-objcopy' | |
| objdump = 'x86_64-w64-mingw32-objdump' | |
| strip = 'x86_64-w64-mingw32-strip' | |
| windres = 'x86_64-w64-mingw32-windres' | |
| [host_machine] | |
| system = 'windows' | |
| endian = 'little' | |
| cpu_family = 'x86_64' | |
| cpu = 'x86_64' | |
| EOF | |
| # pzstd doesn't build; skip -Dbin_contrib=true | |
| meson setup \ | |
| --buildtype=debugoptimized \ | |
| --cross-file=cross.ini \ | |
| -Db_lundef=false \ | |
| -Dbin_programs=true \ | |
| -Dbin_tests=true \ | |
| -Ddefault_library=both \ | |
| build/meson builddir | |
| ninja -C builddir/ | |
| if grep -- -pthread builddir/meson-private/libzstd.pc; then | |
| echo "Error: found stray pthread dependency" | |
| exit 1 | |
| fi | |
| meson-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Install packages | |
| run: pip install --pre meson | |
| - name: Configure with Meson | |
| run: | | |
| meson setup --vsenv build/meson/ builddir -Dbin_tests=true -Dbin_programs=true -Dbin_contrib=true | |
| - name: Build with Meson | |
| run: | | |
| meson compile -C builddir/ | |
| - name: Test with Meson | |
| run: | | |
| meson test -C builddir/ --print-errorlogs | |
| - name: Install with Meson | |
| run: | | |
| meson install -C builddir --destdir staging/ | |
| msbuild-visual-studio: | |
| strategy: | |
| fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed. | |
| matrix: | |
| include: [ | |
| { name: "VS 2022 x64 Debug", platform: x64, configuration: Debug, toolset: v143, runner: "windows-2022", arch: "" }, | |
| { name: "VS 2022 Win32 Debug", platform: Win32, configuration: Debug, toolset: v143, runner: "windows-2022", arch: "" }, | |
| { name: "VS 2022 x64 Release", platform: x64, configuration: Release, toolset: v143, runner: "windows-2022", arch: ""}, | |
| { name: "VS 2022 Win32 Release", platform: Win32, configuration: Release, toolset: v143, runner: "windows-2022", arch: ""}, | |
| { name: "VS 2025 x64 Debug", platform: x64, configuration: Debug, toolset: v143, runner: "windows-2025", arch: ""}, | |
| { name: "VS 2022 x64 Release AVX2", platform: x64, configuration: Release, toolset: v143, runner: "windows-2022", arch: "AdvancedVectorExtensions2" }, | |
| ] | |
| runs-on: ${{matrix.runner}} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Add MSBuild to PATH | |
| uses: microsoft/setup-msbuild@30375c66a4eea26614e0d39710365f22f8b0af57 # tag=v3.0.0 | |
| - name: Build ${{matrix.name}} | |
| working-directory: ${{env.GITHUB_WORKSPACE}} | |
| # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference | |
| if: ${{ matrix.arch == '' }} | |
| run: > | |
| msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=${{matrix.toolset}} | |
| /t:Clean,Build /p:Platform=${{matrix.platform}} /p:Configuration=${{matrix.configuration}} /warnaserror | |
| - name: Build ${{matrix.name}} | |
| working-directory: ${{env.GITHUB_WORKSPACE}} | |
| # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference | |
| if: ${{ matrix.arch != '' }} | |
| run: > | |
| msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=${{matrix.toolset}} | |
| /t:Clean,Build /p:Platform=${{matrix.platform}} /p:Configuration=${{matrix.configuration}} /warnaserror | |
| /p:InstructionSet=${{matrix.arch}} | |
| # This tests that we don't accidentally grow the size too much, | |
| # for example when a size reduction option stops working (#3066). | |
| # If the size grows intentionally, you can raise these numbers. | |
| # But we do need to think about binary size, since it is a concern. | |
| # Each limit is the size measured with GCC 15.2 on 2026-11-12, plus about 30%, rounded up. | |
| # -march=x86-64 makes the size independent of the compiler's default target: | |
| # GCC 15 on ubuntu-26.04 runners targets x86-64-v3, which makes libzstd about 20% larger. | |
| # When a limit is exceeded, check whether the growth comes from the code or the compiler, | |
| # then measure again (check_size.py prints the sizes) and reset all limits with this rule. | |
| libzstd-size: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: libzstd size test | |
| run: | | |
| make clean && make -j -C lib libzstd MOREFLAGS=-march=x86-64 && ./tests/check_size.py lib/libzstd.so 1200000 | |
| make clean && make -j -C lib libzstd MOREFLAGS=-march=x86-64 ZSTD_LIB_COMPRESSION=0 ZSTD_LIB_DICTBUILDER=0 && ./tests/check_size.py lib/libzstd.so 260000 | |
| make clean && make -j -C lib libzstd MOREFLAGS=-march=x86-64 ZSTD_LIB_MINIFY=1 && ./tests/check_size.py lib/libzstd.so 390000 | |
| make clean && make -j -C lib libzstd MOREFLAGS=-march=x86-64 ZSTD_LIB_MINIFY=1 ZSTD_LIB_COMPRESSION=0 ZSTD_LIB_DICTBUILDER=0 && ./tests/check_size.py lib/libzstd.so 100000 | |
| minimal-decompressor-macros: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: minimal decompressor macros | |
| run: | | |
| make clean && make -j all ZSTD_LIB_MINIFY=1 MOREFLAGS="-Werror" | |
| make clean && make check ZSTD_LIB_MINIFY=1 MOREFLAGS="-Werror" | |
| make clean && make -j all MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X1 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT" | |
| make clean && make check MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X1 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT" | |
| make clean && make -j all MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X2 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG" | |
| make clean && make check MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X2 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG" | |
| make clean && make -j all MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS" | |
| make clean && make check MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS" | |
| make clean && make check ZSTD_LIB_EXCLUDE_COMPRESSORS_DFAST_AND_UP=1 MOREFLAGS="-Werror" | |
| make clean && make check ZSTD_LIB_EXCLUDE_COMPRESSORS_GREEDY_AND_UP=1 MOREFLAGS="-Werror" | |
| # -march=x86-64 starts from a target without BMI2: | |
| # GCC on ubuntu-26.04 runners targets x86-64-v3, which enables BMI2 by default. | |
| dynamic-bmi2: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: dynamic bmi2 tests | |
| run: | | |
| make clean && make -j check MOREFLAGS="-O0 -Werror -march=x86-64 -mbmi2" | |
| make clean && make -j check MOREFLAGS="-O0 -Werror -march=x86-64 -DDYNAMIC_BMI2=1" | |
| make clean && make -j check MOREFLAGS="-O0 -Werror -march=x86-64 -DDYNAMIC_BMI2=1 -mbmi2" | |
| make clean && make -j check MOREFLAGS="-O0 -Werror -march=x86-64 -DDYNAMIC_BMI2=0" | |
| make clean && make -j check MOREFLAGS="-O0 -Werror -march=x86-64 -DDYNAMIC_BMI2=0 -mbmi2" | |
| test-variants: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: make all variants & validate | |
| run: | | |
| make -j -C programs allVariants MOREFLAGS=-O0 | |
| ./tests/test-variants.sh | |
| qemu-consistency: | |
| name: QEMU ${{ matrix.name }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed. | |
| matrix: | |
| include: [ | |
| { name: ARM, xcc_pkg: gcc-arm-linux-gnueabi, xcc: arm-linux-gnueabi-gcc, xemu: qemu-arm }, | |
| { name: ARM64, xcc_pkg: gcc-aarch64-linux-gnu, xcc: aarch64-linux-gnu-gcc, xemu: qemu-aarch64 }, | |
| { name: PPC, xcc_pkg: gcc-powerpc-linux-gnu, xcc: powerpc-linux-gnu-gcc, xemu: qemu-ppc }, | |
| { name: PPC64LE, xcc_pkg: gcc-powerpc64le-linux-gnu, xcc: powerpc64le-linux-gnu-gcc, xemu: qemu-ppc64le }, | |
| { name: S390X, xcc_pkg: gcc-s390x-linux-gnu, xcc: s390x-linux-gnu-gcc, xemu: qemu-s390x }, | |
| # ubuntu-26.04 has no MIPS cross compiler: MIPS builds in a Debian container | |
| { name: MIPS, xcc_pkg: "", xcc: mips-linux-gnu-gcc, xemu: qemu-mips }, | |
| { name: RISC-V, xcc_pkg: gcc-riscv64-linux-gnu, xcc: riscv64-linux-gnu-gcc, xemu: qemu-riscv64 }, | |
| { name: M68K, xcc_pkg: gcc-m68k-linux-gnu, xcc: m68k-linux-gnu-gcc, xemu: qemu-m68k }, | |
| { name: SPARC, xcc_pkg: gcc-sparc64-linux-gnu, xcc: sparc64-linux-gnu-gcc, xemu: qemu-sparc64 }, | |
| ] | |
| env: # Set environment variables | |
| XCC: ${{ matrix.xcc }} | |
| XEMU: ${{ matrix.xemu }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: apt update & install | |
| run: | | |
| sudo apt-get update | |
| # qemu-user-binfmt: the tests run the cross-compiled datagen directly | |
| sudo apt-get install gcc-multilib g++-multilib qemu-user qemu-user-binfmt | |
| sudo apt-get install ${{ matrix.xcc_pkg }} | |
| # load the binfmt handlers of qemu-user-binfmt, and check the one of this target | |
| sudo systemctl restart systemd-binfmt | |
| cat /proc/sys/fs/binfmt_misc/$XEMU | |
| - name: Environment info | |
| if: ${{ matrix.name != 'MIPS' }} | |
| run: | | |
| echo && which $XCC | |
| echo && $XCC --version | |
| echo && $XCC -v # Show built-in specs | |
| echo && which $XEMU | |
| echo && $XEMU --version | |
| - name: ARM | |
| if: ${{ matrix.name == 'ARM' }} | |
| run: | | |
| LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check | |
| - name: ARM64 | |
| if: ${{ matrix.name == 'ARM64' }} | |
| run: | | |
| make clean | |
| LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make -j check | |
| LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make -j -C tests test-cli-tests | |
| CFLAGS="-O3 -march=armv8.2-a+sve2" LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make -j check | |
| CFLAGS="-O3 -march=armv8.2-a+sve2" LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make -j -C tests test-cli-tests | |
| # unit tests only (-i0): they check the SVE2 histogram directly | |
| CFLAGS="-O3 -march=armv8.2-a+sve2" LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make -j -C tests test-fuzzer FUZZERTEST=-i0 | |
| # This test is only compatible with standard libraries that support BTI (Branch Target Identification). | |
| # Unfortunately, the standard library provided on Ubuntu 24.04 does not have this feature enabled. | |
| # make clean | |
| # LDFLAGS="-static -z force-bti" MOREFLAGS="-mbranch-protection=standard" CC=$XCC QEMU_SYS=$XEMU make check V=1 | |
| - name: PPC | |
| if: ${{ matrix.name == 'PPC' }} | |
| run: | | |
| LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check | |
| - name: PPC64LE | |
| if: ${{ matrix.name == 'PPC64LE' }} | |
| run: | | |
| LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check | |
| - name: S390X | |
| if: ${{ matrix.name == 'S390X' }} | |
| run: | | |
| LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check | |
| - name: MIPS | |
| if: ${{ matrix.name == 'MIPS' }} | |
| run: | | |
| docker run --rm -v "$PWD":/zstd -w /zstd -e XCC -e XEMU debian:13 sh -c ' | |
| apt-get -qq update && apt-get -qq install -y file make gcc-mips-linux-gnu qemu-user >/dev/null && | |
| $XCC --version && $XEMU --version && | |
| LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check' | |
| - name: RISC-V | |
| if: ${{ matrix.name == 'RISC-V' }} | |
| run: | | |
| LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check | |
| CFLAGS="-march=rv64gcv -O3" LDFLAGS="-static -DMEM_FORCE_MEMORY_ACCESS=0" CC=$XCC QEMU_SYS="$XEMU -cpu max,vlen=128" make clean check | |
| CFLAGS="-march=rv64gcv -O3" LDFLAGS="-static -DMEM_FORCE_MEMORY_ACCESS=0" CC=$XCC QEMU_SYS="$XEMU -cpu max,vlen=256" make clean check | |
| CFLAGS="-march=rv64gcv -O3" LDFLAGS="-static -DMEM_FORCE_MEMORY_ACCESS=0" CC=$XCC QEMU_SYS="$XEMU -cpu max,vlen=512" make clean check | |
| - name: M68K | |
| if: ${{ matrix.name == 'M68K' }} | |
| run: | | |
| LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check | |
| - name: SPARC | |
| if: ${{ matrix.name == 'SPARC' }} | |
| run: | | |
| LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check | |
| mingw-short-test: | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed. | |
| matrix: | |
| include: [ | |
| { compiler: gcc, msystem: MINGW32, cflags: "-Werror"}, | |
| { compiler: gcc, msystem: MINGW64, cflags: "-Werror"}, | |
| { compiler: clang, msystem: MINGW64, cflags: "--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion -Wno-unused-command-line-argument"}, | |
| ] | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # tag=v2.32.0 | |
| with: | |
| msystem: ${{ matrix.msystem }} | |
| install: make diffutils | |
| update: true | |
| # Based on https://ariya.io/2020/07/on-github-actions-with-msys2 | |
| - name: install mingw gcc i686 | |
| if: ${{ (matrix.msystem == 'MINGW32') && (matrix.compiler == 'gcc') }} | |
| run: pacman --noconfirm -S mingw-w64-i686-gcc | |
| - name: install mingw gcc x86_64 | |
| if: ${{ (matrix.msystem == 'MINGW64') && (matrix.compiler == 'gcc') }} | |
| run: pacman --noconfirm -S mingw-w64-x86_64-gcc | |
| - name: install mingw clang i686 | |
| if: ${{ (matrix.msystem == 'MINGW32') && (matrix.compiler == 'clang') }} | |
| run: pacman --noconfirm -S mingw-w64-i686-clang | |
| - name: install mingw clang x86_64 | |
| if: ${{ (matrix.msystem == 'MINGW64') && (matrix.compiler == 'clang') }} | |
| run: pacman --noconfirm -S mingw-w64-x86_64-clang | |
| - name: run mingw tests | |
| run: | | |
| make -v | |
| export CC=${{ matrix.compiler }} | |
| $CC --version | |
| CFLAGS="${{ matrix.cflags }}" make -j allzstd | |
| echo "Testing $CC ${{ matrix.msystem }}" | |
| make clean | |
| MSYS="" make check | |
| visual-runtime-tests: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| platform: [x64, Win32] | |
| configuration: [Release] | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Add MSBuild to PATH | |
| uses: microsoft/setup-msbuild@30375c66a4eea26614e0d39710365f22f8b0af57 # tag=v3.0.0 | |
| - name: Build | |
| working-directory: ${{env.GITHUB_WORKSPACE}} | |
| # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference | |
| run: | | |
| msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v142 /t:Clean,Build /p:Platform=${{matrix.platform}} /p:Configuration=${{matrix.configuration}} | |
| COPY build\VS2010\bin\${{matrix.platform}}_${{matrix.configuration}}\*.exe tests\ | |
| - name: Run tests | |
| # bash stops at the first failing command. pwsh, the default shell, doesn't, | |
| # and the step only reported the exit code of its last command. | |
| shell: bash | |
| working-directory: tests | |
| env: | |
| ZSTD_BIN: ./zstd.exe | |
| DATAGEN_BIN: ./datagen.exe | |
| run: | | |
| sh -e playTests.sh | |
| ./fuzzer.exe -T2m | |
| # Following instructions at: https://github.com/marketplace/actions/install-cygwin-action | |
| cygwin-tests: | |
| runs-on: windows-latest | |
| steps: | |
| - run: git config --global core.autocrlf input | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - uses: cygwin/cygwin-install-action@3f0a3f9f988f7e96b8c18098ae05eaec175f5b52 # tag=v6 | |
| with: | |
| platform: x86_64 | |
| packages: >- | |
| autoconf, | |
| automake, | |
| gcc-g++, | |
| make, | |
| mingw64-x86_64-gcc-g++, | |
| patch, | |
| perl | |
| - name: cygwin tests | |
| shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}' | |
| run: >- | |
| export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32 && | |
| export CFLAGS="-Werror -O1" && | |
| ls && | |
| make -j allzstd && | |
| make -C tests fuzzer && | |
| ./tests/fuzzer.exe -v -T1m | |
| - name: cygwin install test | |
| shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}' | |
| run: >- | |
| make -j && | |
| make install | |
| pkg-config: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: debian:testing | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Install dependencies | |
| run: | | |
| apt -y update | |
| apt -y install --no-install-recommends gcc libc6-dev make pkg-config | |
| - name: Build and install | |
| run: make -C lib install | |
| - name: Test pkg-config | |
| run: | | |
| cc -Wall -Wextra -Wpedantic -Werror -o simple examples/simple_compression.c $(pkg-config --cflags --libs libzstd) | |
| ./simple LICENSE | |
| versions-compatibility: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Versions Compatibility Test | |
| run: | | |
| make -C tests versionsTest | |
| clangbuild: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: make clangbuild | |
| run: | | |
| make clangbuild | |
| gcc-pgo: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Build PGO Zstd with GCC | |
| env: | |
| CC: gcc | |
| run: | | |
| make -C programs zstd-pgo | |
| ./programs/zstd -b | |
| clang-pgo: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Build PGO Zstd with Clang | |
| env: | |
| CC: clang | |
| run: | | |
| sudo apt install -y llvm | |
| llvm-profdata --version | |
| make -C programs zstd-pgo | |
| ./programs/zstd -b | |
| musl-build: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Install musl-tools | |
| run: | | |
| sudo apt install -y musl-tools | |
| - name: Compile with musl-gcc and test-zstd | |
| run: | | |
| CC=musl-gcc CFLAGS="-Werror -O3" CPPFLAGS=-DZDICT_QSORT=ZDICT_QSORT_C90 make -j -C tests test-zstd V=1 | |
| intel-cet-compatibility: | |
| runs-on: ubuntu-latest | |
| env: | |
| # Intel retires the per-release id in the downloadmirror path whenever a new | |
| # SDE ships, and the old URL then starts answering 403. That has broken this | |
| # job twice (#3884 -> #3893, and again for 9.33.0). When it happens again, | |
| # get the current link from Intel's *stable* product page and update these | |
| # three values together: | |
| # https://www.intel.com/content/www/us/en/download/684897/intel-software-development-emulator.html | |
| SDE_URL: https://downloadmirror.intel.com/924984/sde-external-10.13.1-2026-07-28-lin.tar.xz | |
| SDE_SHA256: 94e97d623fec54385686e1e7ba65ebc9941748c05ee451423948334892bf2b50 | |
| SDE_DIR: sde-external-10.13.1-2026-07-28-lin | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: Build Zstd | |
| run: | | |
| make -j zstd V=1 | |
| readelf -n zstd | |
| - name: Get Intel SDE | |
| run: | | |
| # -f so that a retired URL fails here, with the http status, instead of | |
| # saving the error page and failing later as "tar: unrecognized format". | |
| curl -fsSL -o sde.tar.xz "$SDE_URL" | |
| echo "$SDE_SHA256 sde.tar.xz" | sha256sum -c - | |
| tar xJf sde.tar.xz | |
| - name: Configure Permissions | |
| run: | | |
| echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope | |
| - name: Run Under SDE | |
| run: | | |
| # sde64, not sde: the latter is a 32-bit i386 launcher, and needs i386 | |
| # runtime libs that a 64-bit runner has no reason to carry. | |
| # -tgl: emulate a CET-capable chip (Tiger Lake). Without it, SDE checks | |
| # instructions against the host's cpuid, and fails on hosts without CET | |
| # (e.g. AMD runners) at the first endbr64, in the dynamic loader. | |
| "$SDE_DIR/sde64" -tgl -cet -cet-raise 0 -cet-endbr-exe -cet-stderr -cet-abort -- ./zstd -b3 | |
| icx: | |
| # install instructions: https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-linux/2025-0/apt-005.html | |
| name: icx-check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: install icx | |
| run: | | |
| # download the key to system keyring | |
| wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | |
| | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null | |
| # add signed entry to apt sources and configure the APT client to use Intel repository: | |
| echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list | |
| sudo apt-get update | |
| sudo apt-get install -y intel-basekit intel-hpckit | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # tag=v7.0.1 | |
| - name: make check | |
| run: | | |
| source /opt/intel/oneapi/setvars.sh | |
| make CC=icx check | |
| make CC=icx -C tests test-cli-tests |