git subrepo pull (merge) --force deps/libchdr
[pcsx_rearmed.git] / deps / libchdr / deps / zstd-1.5.6 / .github / workflows / dev-short-tests.yml
1 name: dev-short-tests
2 # Faster tests: mostly build tests, along with some other
3 # misc tests
4
5 concurrency:
6   group: fast-${{ github.ref }}
7   cancel-in-progress: true
8
9 on:
10   pull_request:
11     branches: [ dev, release, actionsTest ]
12
13 permissions: read-all
14
15 jobs:
16   linux-kernel:
17     runs-on: ubuntu-latest
18     steps:
19     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
20     - name: linux kernel, library + build + test
21       run: make -C contrib/linux-kernel test CFLAGS="-Werror -Wunused-const-variable -Wunused-but-set-variable"
22
23   benchmarking:
24     runs-on: ubuntu-latest
25     steps:
26     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
27     - name: make benchmarking
28       run: make benchmarking
29
30   check-32bit: # designed to catch https://github.com/facebook/zstd/issues/2428
31     runs-on: ubuntu-latest
32     steps:
33     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
34     - name: make check on 32-bit
35       run: |
36         sudo apt update
37         APT_PACKAGES="gcc-multilib" make apt-install
38         CFLAGS="-m32 -O1 -fstack-protector" make check V=1
39
40   check-x32:
41     runs-on: ubuntu-20.04  # ubuntu-latest == ubuntu-22.04 have issues currently with x32
42     steps:
43     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
44     - name: make check on x32 ABI # https://en.wikipedia.org/wiki/X32_ABI
45       env:
46         CHECK_CONSTRAINED_MEM: true
47       run: |
48         sudo apt update
49         APT_PACKAGES="gcc-multilib" make apt-install
50         CFLAGS="-mx32 -O1 -fstack-protector" make check V=1
51
52   build-c89:
53     runs-on: ubuntu-latest
54     steps:
55     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
56     - name: ensure zstd can be build with c89/c90 compilers (+ long long support + variadic macros)
57       run: |
58         make c89build V=1
59
60   build-zstd-dll:
61     runs-on: ubuntu-latest
62     steps:
63     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
64     - name: build zstd bin against a dynamic lib (debuglevel for more dependencies)
65       run: |
66         make -C lib lib-mt-release
67         DEBUGLEVEL=2 make -C programs zstd-dll
68
69   gcc-7-libzstd:
70     runs-on: ubuntu-latest
71     steps:
72     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
73     - name: gcc-7 + libzstdmt compilation
74       # See https://askubuntu.com/a/1428822
75       run: |
76         echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe" | sudo tee -a /etc/apt/sources.list
77         sudo apt-get -qqq update
78         make gcc7install
79         CC=gcc-7 CFLAGS=-Werror make -j all
80         make clean
81         LDFLAGS=-Wl,--no-undefined make -C lib libzstd-mt
82
83     # candidate test (for discussion) : underlink test
84     # LDFLAGS=-Wl,--no-undefined : will make the linker fail if dll is underlinked
85
86   cmake-build-and-test-check:
87     runs-on: ubuntu-latest
88     steps:
89     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
90     - name: cmake build and test
91       run: |
92         FUZZERTEST=-T1mn ZSTREAM_TESTTIME=-T1mn make cmakebuild V=1
93
94   cpp-gnu90-c99-compatibility:
95     runs-on: ubuntu-latest
96     steps:
97     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
98     - name: C++, gnu90 and c99 compatibility
99       run: |
100         make cxxtest
101         make clean
102         make gnu90build
103         make clean
104         make c99build
105         make clean
106         make travis-install   # just ensures `make install` works
107
108   mingw-cross-compilation:
109     runs-on: ubuntu-latest
110     steps:
111     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
112     - name: mingw cross-compilation
113       run: |
114         # sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix; (doesn't work)
115         sudo apt-get -qqq update
116         sudo apt-get install gcc-mingw-w64
117         CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ CFLAGS="-Werror -O1" make zstd
118
119   armbuild:
120     runs-on: ubuntu-latest
121     steps:
122     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
123     - name: ARM Build Test
124       run: |
125         sudo apt-get -qqq update
126         make arminstall
127         make armbuild
128
129   bourne-shell:
130     runs-on: ubuntu-latest
131     steps:
132     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
133     - name: Bourne shell compatibility (shellcheck)
134       run: |
135         wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz
136         tar -xf shellcheck-v0.7.1.linux.x86_64.tar.xz
137         shellcheck-v0.7.1/shellcheck --shell=sh --severity=warning --exclude=SC2010 tests/playTests.sh
138
139   zlib-wrapper:
140     runs-on: ubuntu-latest
141     steps:
142     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
143     - name: zlib wrapper test
144       run: |
145         sudo apt-get -qqq update
146         make valgrindinstall
147         make -C zlibWrapper test
148         make -C zlibWrapper test-valgrind
149
150   lz4-threadpool-libs:
151     runs-on: ubuntu-latest
152     steps:
153     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
154     - name: LZ4, thread pool, and libs build testslib wrapper test
155       run: |
156         make lz4install
157         make -C tests test-lz4
158         make check < /dev/null | tee   # mess with lz4 console detection
159         make clean
160         make -C tests test-pool
161         make clean
162         bash tests/libzstd_builds.sh
163
164   gcc-make-tests-32bit:
165     runs-on: ubuntu-latest
166     steps:
167     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
168     - name: Make all, 32bit mode
169       run: |
170         sudo apt-get -qqq update
171         make libc6install
172         CFLAGS="-Werror -m32" make -j all32
173
174   gcc-8-make:
175     runs-on: ubuntu-latest
176     steps:
177       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
178       - name: gcc-8 build
179         # See https://askubuntu.com/a/1428822
180         run: |
181           echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe" | sudo tee -a /etc/apt/sources.list
182           sudo apt-get -qqq update
183           make gcc8install
184           CC=gcc-8 CFLAGS="-Werror" make -j all
185
186   make-external-compressors:
187     strategy:
188       matrix:
189         include:
190           - name: "no external compressors"
191             flags: "HAVE_ZLIB=0 HAVE_LZ4=0 HAVE_LZMA=0"
192           - name: "only zlib"
193             flags: "HAVE_ZLIB=1 HAVE_LZ4=0 HAVE_LZMA=0"
194           - name: "only lz4"
195             flags: "HAVE_ZLIB=0 HAVE_LZ4=1 HAVE_LZMA=0"
196           - name: "only lzma"
197             flags: "HAVE_ZLIB=0 HAVE_LZ4=0 HAVE_LZMA=1"
198     runs-on: ubuntu-latest
199     steps:
200       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
201       - name: Build with ${{matrix.name}}
202         run: ${{matrix.flags}} make zstd
203
204
205   implicit-fall-through:
206     runs-on: ubuntu-latest
207     steps:
208       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
209       - name: -Wimplicit-fallthrough build
210         run: |
211           make clean
212           CC=gcc MOREFLAGS="-Werror -Wimplicit-fallthrough=2 -O0" make -C lib -j libzstd.a ZSTD_LEGACY_SUPPORT=0
213           make clean
214           CC=clang MOREFLAGS="-Werror -Wimplicit-fallthrough -O0" make -C lib -j libzstd.a ZSTD_LEGACY_SUPPORT=0
215
216   meson-linux:
217     runs-on: ubuntu-latest
218     steps:
219       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
220       - name: Install packages
221         run: |
222           sudo apt-get update
223           sudo apt-get -y install build-essential python3-pip ninja-build liblz4-dev
224           pip install --pre meson
225       - name: Build with Meson
226         run: |
227           meson setup \
228             --buildtype=debugoptimized \
229             -Db_lundef=false \
230             -Dauto_features=enabled \
231             -Dbin_programs=true \
232             -Dbin_tests=true \
233             -Dbin_contrib=true \
234             -Ddefault_library=both \
235             build/meson builddir
236           ninja -C builddir/
237           meson test -C builddir/ --print-errorlogs
238           meson install -C builddir --destdir staging/
239
240   meson-windows:
241     runs-on: windows-latest
242     steps:
243       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
244       - name: Install packages
245         run: pip install --pre meson
246       - name: Configure with Meson
247         run: |
248           meson setup --vsenv build/meson/ builddir -Dbin_tests=true -Dbin_programs=true -Dbin_contrib=true
249       - name: Build with Meson
250         run: |
251           meson compile -C builddir/
252       - name: Test with Meson
253         run: |
254           meson test -C builddir/ --print-errorlogs
255       - name: Install with Meson
256         run: |
257           meson install -C builddir --destdir staging/
258
259   cmake-visual-2022:
260     strategy:
261       matrix:
262         include:
263           - generator: "Visual Studio 17 2022"
264             flags: "-A x64"
265           - generator: "Visual Studio 17 2022"
266             flags: "-A Win32"
267           - generator: "MinGW Makefiles"
268           - generator: "Visual Studio 17 2022"
269             flags: "-T ClangCL"
270     runs-on: windows-2022
271     steps:
272     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
273     - name: Add MSBuild to PATH
274       uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # tag=v2.0.0
275     - name: Build & Test
276       working-directory: ${{env.GITHUB_WORKSPACE}}
277       run: |
278         cd build\cmake
279         mkdir build
280         cd build
281         cmake.exe -G "${{matrix.generator}}" ${{matrix.flags}} -DCMAKE_BUILD_TYPE=Debug -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZSTREAM_FLAGS=-T30s -DZSTD_FUZZER_FLAGS=-T30s -DZSTD_FULLBENCH_FLAGS=-i0 ..
282         cmake.exe --build .
283         ctest.exe -V -C Debug
284
285   msbuild-visual-studio:
286     strategy:
287       fail-fast: false  # 'false' means Don't stop matrix workflows even if some matrix failed.
288       matrix:
289         include: [
290           { name: "VS 2022 x64 Debug", platform: x64, configuration: Debug, toolset: v143, runner: "windows-2022", arch: "" },
291           { name: "VS 2022 Win32 Debug", platform: Win32, configuration: Debug, toolset: v143, runner: "windows-2022", arch: "" },
292           { name: "VS 2022 x64 Release", platform: x64, configuration: Release, toolset: v143, runner: "windows-2022", arch: ""},
293           { name: "VS 2022 Win32 Release", platform: Win32, configuration: Release, toolset: v143, runner: "windows-2022", arch: ""},
294           { name: "VS 2019 x64 Release", platform: Win32, configuration: Release, toolset: v142, runner: "windows-2019", arch: ""},
295           { name: "VS 2019 Win32 Release", platform: x64, configuration: Release, toolset: v142, runner: "windows-2019", arch: ""},
296           { name: "VS 2022 x64 Release AVX2", platform: x64, configuration: Release, toolset: v143, runner: "windows-2022", arch: "AdvancedVectorExtensions2" },
297         ]
298     runs-on: ${{matrix.runner}}
299     steps:
300     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
301     - name: Add MSBuild to PATH
302       uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # tag=v2.0.0
303     - name: Build ${{matrix.name}}
304       working-directory: ${{env.GITHUB_WORKSPACE}}
305       # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
306       if: ${{ matrix.arch == '' }}
307       run: >
308         msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=${{matrix.toolset}}
309         /t:Clean,Build /p:Platform=${{matrix.platform}} /p:Configuration=${{matrix.configuration}} /warnaserror
310     - name: Build ${{matrix.name}}
311       working-directory: ${{env.GITHUB_WORKSPACE}}
312       # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
313       if: ${{ matrix.arch != '' }}
314       run: >
315         msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=${{matrix.toolset}}
316         /t:Clean,Build /p:Platform=${{matrix.platform}} /p:Configuration=${{matrix.configuration}} /warnaserror
317         /p:InstructionSet=${{matrix.arch}}
318
319   # This tests that we don't accidentally grow the size too much.
320   # If the size grows intentionally, you can raise these numbers.
321   # But we do need to think about binary size, since it is a concern.
322   libzstd-size:
323     runs-on: ubuntu-latest
324     steps:
325     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
326     - name: libzstd size test
327       run: |
328         make clean && make -j -C lib libzstd && ./tests/check_size.py lib/libzstd.so 1100000
329         make clean && make -j -C lib libzstd ZSTD_LIB_COMPRESSION=0 ZSTD_LIB_DICTBUILDER=0 && ./tests/check_size.py lib/libzstd.so 400000
330         make clean && make -j -C lib libzstd ZSTD_LIB_MINIFY=1 && ./tests/check_size.py lib/libzstd.so 300000
331         make clean && make -j -C lib libzstd ZSTD_LIB_MINIFY=1 ZSTD_LIB_COMPRESSION=0 ZSTD_LIB_DICTBUILDER=0 && ./tests/check_size.py lib/libzstd.so 80000
332
333   minimal-decompressor-macros:
334     runs-on: ubuntu-latest
335     steps:
336     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
337     - name: minimal decompressor macros
338       run: |
339         make clean && make -j all ZSTD_LIB_MINIFY=1 MOREFLAGS="-Werror"
340         make clean && make check ZSTD_LIB_MINIFY=1 MOREFLAGS="-Werror"
341         make clean && make -j all MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X1 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT"
342         make clean && make check MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X1 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT"
343         make clean && make -j all MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X2 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG"
344         make clean && make check MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X2 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG"
345         make clean && make -j all MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS"
346         make clean && make check MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS"
347         make clean && make check ZSTD_LIB_EXCLUDE_COMPRESSORS_DFAST_AND_UP=1 MOREFLAGS="-Werror"
348         make clean && make check ZSTD_LIB_EXCLUDE_COMPRESSORS_GREEDY_AND_UP=1 MOREFLAGS="-Werror"
349
350   dynamic-bmi2:
351     runs-on: ubuntu-latest
352     steps:
353     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
354     - name: dynamic bmi2 tests
355       run: |
356         make clean && make -j check MOREFLAGS="-O0 -Werror -mbmi2"
357         make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=1"
358         make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=1 -mbmi2"
359         make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=0"
360         make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=0 -mbmi2"
361
362   test-variants:
363     runs-on: ubuntu-latest
364     steps:
365     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
366     - name: make all variants & validate
367       run: |
368         make -j -C programs allVariants MOREFLAGS=-O0
369         ./tests/test-variants.sh
370
371   qemu-consistency:
372     name: QEMU ${{ matrix.name }}
373     runs-on: ubuntu-20.04
374     strategy:
375       fail-fast: false  # 'false' means Don't stop matrix workflows even if some matrix failed.
376       matrix:
377         include: [
378           { name: ARM,      xcc_pkg: gcc-arm-linux-gnueabi,     xcc: arm-linux-gnueabi-gcc,     xemu_pkg: qemu-system-arm,    xemu: qemu-arm-static     },
379           { name: ARM64,    xcc_pkg: gcc-aarch64-linux-gnu,     xcc: aarch64-linux-gnu-gcc,     xemu_pkg: qemu-system-arm,    xemu: qemu-aarch64-static },
380           { name: PPC,      xcc_pkg: gcc-powerpc-linux-gnu,     xcc: powerpc-linux-gnu-gcc,     xemu_pkg: qemu-system-ppc,    xemu: qemu-ppc-static     },
381           { name: PPC64LE,  xcc_pkg: gcc-powerpc64le-linux-gnu, xcc: powerpc64le-linux-gnu-gcc, xemu_pkg: qemu-system-ppc,    xemu: qemu-ppc64le-static },
382           { name: S390X,    xcc_pkg: gcc-s390x-linux-gnu,       xcc: s390x-linux-gnu-gcc,       xemu_pkg: qemu-system-s390x,  xemu: qemu-s390x-static   },
383           { name: MIPS,     xcc_pkg: gcc-mips-linux-gnu,        xcc: mips-linux-gnu-gcc,        xemu_pkg: qemu-system-mips,   xemu: qemu-mips-static    },
384           { name: RISC-V,   xcc_pkg: gcc-riscv64-linux-gnu,     xcc: riscv64-linux-gnu-gcc,     xemu_pkg: qemu-system-riscv64,xemu: qemu-riscv64-static },
385           { name: M68K,     xcc_pkg: gcc-m68k-linux-gnu,        xcc: m68k-linux-gnu-gcc,        xemu_pkg: qemu-system-m68k,   xemu: qemu-m68k-static    },
386           { name: SPARC,    xcc_pkg: gcc-sparc64-linux-gnu,     xcc: sparc64-linux-gnu-gcc,     xemu_pkg: qemu-system-sparc,  xemu: qemu-sparc64-static },
387         ]
388     env:                        # Set environment variables
389       XCC: ${{ matrix.xcc }}
390       XEMU: ${{ matrix.xemu }}
391     steps:
392     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
393     - name: apt update & install
394       run: |
395         sudo apt-get update
396         sudo apt-get install gcc-multilib g++-multilib qemu-utils qemu-user-static
397         sudo apt-get install ${{ matrix.xcc_pkg }} ${{ matrix.xemu_pkg }}
398     - name: Environment info
399       run: |
400         echo && which $XCC
401         echo && $XCC --version
402         echo && $XCC -v  # Show built-in specs
403         echo && which $XEMU
404         echo && $XEMU --version
405     - name: ARM
406       if: ${{ matrix.name == 'ARM' }}
407       run: |
408         LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check
409     - name: ARM64
410       if: ${{ matrix.name == 'ARM64' }}
411       run: |
412         LDFLAGS="-static -z force-bti" MOREFLAGS="-mbranch-protection=standard" CC=$XCC QEMU_SYS=$XEMU make clean check
413         LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check
414     - name: PPC
415       if: ${{ matrix.name == 'PPC' }}
416       run: |
417         LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check
418     - name: PPC64LE
419       if: ${{ matrix.name == 'PPC64LE' }}
420       run: |
421         LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check
422     - name: S390X
423       if: ${{ matrix.name == 'S390X' }}
424       run: |
425         LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check
426     - name: MIPS
427       if: ${{ matrix.name == 'MIPS' }}
428       run: |
429         LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check
430     - name: RISC-V
431       if: ${{ matrix.name == 'RISC-V' }}
432       run: |
433         LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check
434     - name: M68K
435       if: ${{ matrix.name == 'M68K' }}
436       run: |
437         LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check
438     - name: SPARC
439       if: ${{ matrix.name == 'SPARC' }}
440       run: |
441         LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check
442
443   mingw-short-test:
444     runs-on: windows-latest
445     strategy:
446       fail-fast: false  # 'false' means Don't stop matrix workflows even if some matrix failed.
447       matrix:
448         include: [
449           { compiler: gcc, msystem: MINGW32, cflags: "-Werror"},
450           { compiler: gcc, msystem: MINGW64, cflags: "-Werror"},
451           { compiler: clang, msystem: MINGW64, cflags: "--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion -Wno-unused-command-line-argument"},
452         ]
453     defaults:
454       run:
455         shell: msys2 {0}
456     steps:
457     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
458     - uses: msys2/setup-msys2@cc11e9188b693c2b100158c3322424c4cc1dadea # tag=v2.22.0
459       with:
460         msystem: ${{ matrix.msystem }}
461         install: make diffutils
462         update: true
463     # Based on https://ariya.io/2020/07/on-github-actions-with-msys2
464     - name: install mingw gcc i686
465       if: ${{ (matrix.msystem == 'MINGW32') && (matrix.compiler == 'gcc') }}
466       run: pacman --noconfirm -S mingw-w64-i686-gcc
467     - name: install mingw gcc x86_64
468       if: ${{ (matrix.msystem == 'MINGW64') && (matrix.compiler == 'gcc') }}
469       run: pacman --noconfirm -S mingw-w64-x86_64-gcc
470     - name: install mingw clang i686
471       if: ${{ (matrix.msystem == 'MINGW32') && (matrix.compiler == 'clang') }}
472       run: pacman --noconfirm -S mingw-w64-i686-clang
473     - name: install mingw clang x86_64
474       if: ${{ (matrix.msystem == 'MINGW64') && (matrix.compiler == 'clang') }}
475       run: pacman --noconfirm -S mingw-w64-x86_64-clang
476     - name: run mingw tests
477       run: |
478         make -v
479         export CC=${{ matrix.compiler }}
480         $CC --version
481         CFLAGS="${{ matrix.cflags }}" make -j allzstd
482         echo "Testing $CC ${{ matrix.msystem }}"
483         make clean
484         MSYS="" make check
485
486   visual-runtime-tests:
487     runs-on: windows-latest
488     strategy:
489       matrix:
490         platform: [x64, Win32]
491         configuration: [Release]
492     steps:
493     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
494     - name: Add MSBuild to PATH
495       uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # tag=v2.0.0
496     - name: Build and run tests
497       working-directory: ${{env.GITHUB_WORKSPACE}}
498       env:
499         ZSTD_BIN: ./zstd.exe
500         DATAGEN_BIN: ./datagen.exe
501       # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
502       run: |
503         msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v142 /t:Clean,Build /p:Platform=${{matrix.platform}} /p:Configuration=${{matrix.configuration}}
504         COPY build\VS2010\bin\${{matrix.platform}}_${{matrix.configuration}}\*.exe tests\
505         CD tests
506         sh -e playTests.sh
507         .\fuzzer.exe -T2m
508
509   # Following instructions at: https://github.com/marketplace/actions/install-cygwin-action
510   cygwin-tests:
511     runs-on: windows-latest
512     steps:
513     - run: git config --global core.autocrlf input
514     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
515     - uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # tag=master
516       with:
517         platform: x86_64
518         packages: >-
519           autoconf,
520           automake,
521           gcc-g++,
522           make,
523           mingw64-x86_64-gcc-g++,
524           patch,
525           perl
526     - name: cygwin tests
527       shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
528       run: >-
529         export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32 &&
530         export CFLAGS="-Werror -O1" &&
531         ls &&
532         make -j allzstd &&
533         make -C tests fuzzer &&
534         ./tests/fuzzer.exe -v -T1m
535
536   pkg-config:
537     runs-on: ubuntu-latest
538     container:
539       image: debian:testing
540     steps:
541       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
542       - name: Install dependencies
543         run: |
544           apt -y update
545           apt -y install --no-install-recommends gcc libc6-dev make pkg-config
546       - name: Build and install
547         run: make -C lib install
548       - name: Test pkg-config
549         run: |
550           cc -Wall -Wextra -Wpedantic -Werror -o simple examples/simple_compression.c $(pkg-config --cflags --libs libzstd)
551           ./simple LICENSE
552
553   versions-compatibility:
554     runs-on: ubuntu-latest
555     steps:
556     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
557     - name: Versions Compatibility Test
558       run: |
559         make -C tests versionsTest
560
561   clangbuild:
562     runs-on: ubuntu-latest
563     steps:
564     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
565     - name: make clangbuild
566       run: |
567         make clangbuild
568
569   clang-pgo:
570     runs-on: ubuntu-latest
571     steps:
572     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
573     - name: Build PGO Zstd with Clang
574       env:
575         CC: clang-14
576         LLVM_PROFDATA: llvm-profdata-14
577       run: |
578         make -C programs zstd-pgo
579         ./programs/zstd -b
580
581   gcc-pgo:
582     runs-on: ubuntu-latest
583     steps:
584     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
585     - name: Build PGO Zstd with GCC
586       env:
587         CC: gcc
588       run: |
589         make -C programs zstd-pgo
590         ./programs/zstd -b
591
592   intel-cet-compatibility:
593     runs-on: ubuntu-latest
594     steps:
595     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
596     - name: Build Zstd
597       run: |
598         make -j zstd V=1
599         readelf -n zstd
600     - name: Get Intel SDE
601       run: |
602         curl -LO https://downloadmirror.intel.com/813591/sde-external-9.33.0-2024-01-07-lin.tar.xz
603         tar xJvf sde-external-9.33.0-2024-01-07-lin.tar.xz
604     - name: Configure Permissions
605       run: |
606         echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
607     - name: Run Under SDE
608       run: |
609         sde-external-9.33.0-2024-01-07-lin/sde -cet -cet-raise 0 -cet-endbr-exe -cet-stderr -cet-abort -- ./zstd -b3
610
611
612 # Failing tests, for reference
613
614 # icc tests are currently failing on Github Actions, likely to issues during installation stage
615 #
616 #  icc:
617 #    name: icc-check
618 #    runs-on: ubuntu-latest
619 #    steps:
620 #    - name: install icc
621 #      run: |
622 #        export DEBIAN_FRONTEND=noninteractive
623 #        sudo apt-get -qqq update
624 #        sudo apt-get install -y wget build-essential pkg-config cmake ca-certificates gnupg
625 #        sudo wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
626 #        sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
627 #        sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
628 #        sudo apt-get update
629 #        sudo apt-get install -y intel-basekit intel-hpckit
630 #    - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
631 #    - name: make check
632 #      run: |
633 #        make CC=/opt/intel/oneapi/compiler/latest/linux/bin/intel64/icc check