14 if: github.ref == 'refs/heads/master'
15 uses: ./.github/workflows/stockfish_binaries.yml
17 name: ${{ matrix.config.name }}
18 runs-on: ${{ matrix.config.os }}
20 COMPILER: ${{ matrix.config.compiler }}
21 COMP: ${{ matrix.config.comp }}
26 # set the variable for the required tests:
27 # run_expensive_tests: true
28 # run_32bit_tests: true
29 # run_64bit_tests: true
30 # run_armv8_tests: true
31 # run_armv7_tests: true
33 name: "Ubuntu 20.04 GCC",
37 run_expensive_tests: true,
38 run_32bit_tests: true,
39 run_64bit_tests: true,
43 name: "Ubuntu 20.04 Clang",
47 run_32bit_tests: true,
48 run_64bit_tests: true,
52 name: "Ubuntu 20.04 NDK armv8",
54 compiler: aarch64-linux-android21-clang++,
56 run_armv8_tests: false,
60 name: "Ubuntu 20.04 NDK armv7",
62 compiler: armv7a-linux-androideabi21-clang++,
64 run_armv7_tests: false,
68 name: "MacOS 12 Apple Clang",
72 run_64bit_tests: true,
76 name: "MacOS 12 GCC 11",
80 run_64bit_tests: true,
84 name: "Windows 2022 Mingw-w64 GCC x86_64",
88 run_64bit_tests: true,
90 msys_env: 'x86_64-gcc',
94 name: "Windows 2022 Mingw-w64 GCC i686",
98 run_32bit_tests: true,
100 msys_env: 'i686-gcc',
104 name: "Windows 2022 Mingw-w64 Clang x86_64",
108 run_64bit_tests: true,
110 msys_env: 'clang-x86_64-clang',
116 working-directory: src
117 shell: ${{ matrix.config.shell }}
119 - uses: actions/checkout@v3
123 - name: Download required linux packages
124 if: runner.os == 'Linux'
127 sudo apt install expect valgrind g++-multilib qemu-user
129 - name: Setup msys and install required packages
130 if: runner.os == 'Windows'
131 uses: msys2/setup-msys2@v2
133 msystem: ${{matrix.config.msys_sys}}
134 install: mingw-w64-${{matrix.config.msys_env}} make git expect
136 - name: Download the used network from the fishtest framework
140 - name: Extract the bench number from the commit history
142 git log HEAD | grep "\b[Bb]ench[ :]\+[0-9]\{7\}" | head -n 1 | sed "s/[^0-9]*\([0-9]*\).*/\1/g" > git_sig
143 [ -s git_sig ] && echo "benchref=$(cat git_sig)" >> $GITHUB_ENV && echo "Reference bench:" $(cat git_sig) || echo "No bench found"
145 - name: Check compiler
147 export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin
150 - name: Test help target
156 - name: Test debug x86-32 build
157 if: ${{ matrix.config.run_32bit_tests }}
159 export CXXFLAGS="-Werror -D_GLIBCXX_DEBUG"
161 make -j2 ARCH=x86-32 optimize=no debug=yes build
162 ../tests/signature.sh $benchref
164 - name: Test x86-32 build
165 if: ${{ matrix.config.run_32bit_tests }}
168 make -j2 ARCH=x86-32 build
169 ../tests/signature.sh $benchref
171 - name: Test x86-32-sse41-popcnt build
172 if: ${{ matrix.config.run_32bit_tests }}
175 make -j2 ARCH=x86-32-sse41-popcnt build
176 ../tests/signature.sh $benchref
178 - name: Test x86-32-sse2 build
179 if: ${{ matrix.config.run_32bit_tests }}
182 make -j2 ARCH=x86-32-sse2 build
183 ../tests/signature.sh $benchref
185 - name: Test general-32 build
186 if: ${{ matrix.config.run_32bit_tests }}
189 make -j2 ARCH=general-32 build
190 ../tests/signature.sh $benchref
194 - name: Test debug x86-64-modern build
195 if: ${{ matrix.config.run_64bit_tests }}
197 export CXXFLAGS="-Werror -D_GLIBCXX_DEBUG"
199 make -j2 ARCH=x86-64-modern optimize=no debug=yes build
200 ../tests/signature.sh $benchref
202 - name: Test x86-64-modern build
203 if: ${{ matrix.config.run_64bit_tests }}
206 make -j2 ARCH=x86-64-modern build
207 ../tests/signature.sh $benchref
209 - name: Test x86-64-ssse3 build
210 if: ${{ matrix.config.run_64bit_tests }}
213 make -j2 ARCH=x86-64-ssse3 build
214 ../tests/signature.sh $benchref
216 - name: Test x86-64-sse3-popcnt build
217 if: ${{ matrix.config.run_64bit_tests }}
220 make -j2 ARCH=x86-64-sse3-popcnt build
221 ../tests/signature.sh $benchref
223 - name: Test x86-64 build
224 if: ${{ matrix.config.run_64bit_tests }}
227 make -j2 ARCH=x86-64 build
228 ../tests/signature.sh $benchref
230 - name: Test general-64 build
231 if: matrix.config.run_64bit_tests
234 make -j2 ARCH=general-64 build
235 ../tests/signature.sh $benchref
237 # x86-64 with newer extensions tests
239 - name: Compile x86-64-avx2 build
240 if: ${{ matrix.config.run_64bit_tests }}
243 make -j2 ARCH=x86-64-avx2 build
245 - name: Compile x86-64-bmi2 build
246 if: ${{ matrix.config.run_64bit_tests }}
249 make -j2 ARCH=x86-64-bmi2 build
251 - name: Compile x86-64-avx512 build
252 if: ${{ matrix.config.run_64bit_tests }}
255 make -j2 ARCH=x86-64-avx512 build
257 - name: Compile x86-64-vnni512 build
258 if: ${{ matrix.config.run_64bit_tests }}
261 make -j2 ARCH=x86-64-vnni512 build
263 - name: Compile x86-64-vnni256 build
264 if: ${{ matrix.config.run_64bit_tests }}
267 make -j2 ARCH=x86-64-vnni256 build
271 - name: Test armv8 build
272 if: ${{ matrix.config.run_armv8_tests }}
274 ANDROID_ROOT=/usr/local/lib/android
275 ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
276 SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
277 echo "y" | $SDKMANAGER "ndk;21.4.7075529"
278 ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle
279 ln -sfn $ANDROID_SDK_ROOT/ndk/21.4.7075529 $ANDROID_NDK_ROOT
280 export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
281 export LDFLAGS="-static -Wno-unused-command-line-argument"
283 make -j2 ARCH=armv8 build
284 ../tests/signature.sh $benchref
288 - name: Test armv7 build
289 if: ${{ matrix.config.run_armv7_tests }}
291 ANDROID_ROOT=/usr/local/lib/android
292 ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
293 SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
294 echo "y" | $SDKMANAGER "ndk;21.4.7075529"
295 ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle
296 ln -sfn $ANDROID_SDK_ROOT/ndk/21.4.7075529 $ANDROID_NDK_ROOT
297 export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
298 export LDFLAGS="-static -Wno-unused-command-line-argument"
300 make -j2 ARCH=armv7 build
301 ../tests/signature.sh $benchref
303 - name: Test armv7-neon build
304 if: ${{ matrix.config.run_armv7_tests }}
306 ANDROID_ROOT=/usr/local/lib/android
307 ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
308 SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
309 echo "y" | $SDKMANAGER "ndk;21.4.7075529"
310 ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle
311 ln -sfn $ANDROID_SDK_ROOT/ndk/21.4.7075529 $ANDROID_NDK_ROOT
312 export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
313 export LDFLAGS="-static -Wno-unused-command-line-argument"
315 make -j2 ARCH=armv7-neon build
316 ../tests/signature.sh $benchref
320 - name: Check perft and search reproducibility
321 if: ${{ matrix.config.run_64bit_tests }}
324 make -j2 ARCH=x86-64-modern build
326 ../tests/reprosearch.sh
330 - name: Run under valgrind
331 if: ${{ matrix.config.run_expensive_tests }}
333 export CXXFLAGS="-O1 -fno-inline"
335 make -j2 ARCH=x86-64-modern debug=yes optimize=no build > /dev/null
336 ../tests/instrumented.sh --valgrind
337 ../tests/instrumented.sh --valgrind-thread
339 - name: Run with UB sanitizer
340 if: ${{ matrix.config.run_expensive_tests }}
342 export CXXFLAGS="-O1 -fno-inline"
344 make -j2 ARCH=x86-64-modern sanitize=undefined optimize=no debug=yes build > /dev/null
345 ../tests/instrumented.sh --sanitizer-undefined
347 - name: Run with thread sanitizer
348 if: ${{ matrix.config.run_expensive_tests }}
350 export CXXFLAGS="-O1 -fno-inline"
352 make -j2 ARCH=x86-64-modern sanitize=thread optimize=no debug=yes build > /dev/null
353 ../tests/instrumented.sh --sanitizer-thread