6 name: ${{ matrix.config.name }}
7 runs-on: ${{ matrix.config.os }}
9 COMPILER: ${{ matrix.config.compiler }}
10 COMP: ${{ matrix.config.comp }}
15 - name: Ubuntu 20.04 GCC
22 - name: Ubuntu 20.04 Clang
29 - name: Android NDK aarch64
31 compiler: aarch64-linux-android21-clang++
35 - name: Android NDK arm
37 compiler: armv7a-linux-androideabi21-clang++
41 - name: Linux GCC riscv64
45 run_riscv64_tests: true
46 base_image: 'riscv64/alpine:edge'
47 platform: linux/riscv64
49 - name: Linux GCC ppc64
54 base_image: 'ppc64le/alpine:latest'
55 platform: linux/ppc64le
57 - name: MacOS 13 Apple Clang
63 - name: MacOS 13 GCC 11
69 - name: Windows 2022 Mingw-w64 GCC x86_64
77 - name: Windows 2022 Mingw-w64 GCC i686
85 - name: Windows 2022 Mingw-w64 Clang x86_64
91 msys_env: clang-x86_64-clang
95 working-directory: src
96 shell: ${{ matrix.config.shell }}
98 - uses: actions/checkout@v4
102 - name: Download required linux packages
103 if: runner.os == 'Linux'
106 sudo apt install expect valgrind g++-multilib qemu-user-static
109 if: runner.os == 'Linux'
111 if [ $COMP == ndk ]; then
113 ANDROID_ROOT=/usr/local/lib/android
114 ANDROID_SDK_ROOT=$ANDROID_ROOT/sdk
115 SDKMANAGER=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager
116 echo "y" | $SDKMANAGER "ndk;$NDKV"
117 ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/$NDKV
118 ANDROID_NDK_BIN=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin
119 echo "ANDROID_NDK_BIN=$ANDROID_NDK_BIN" >> $GITHUB_ENV
123 if: matrix.config.base_image
124 uses: docker/setup-qemu-action@v3
126 - name: Set up Docker Buildx
127 if: matrix.config.base_image
128 uses: docker/setup-buildx-action@v3
130 - name: Build Docker container
131 if: matrix.config.base_image
133 docker buildx build --load -t sf_builder - << EOF
134 FROM ${{ matrix.config.base_image }}
136 RUN apk update && apk add make g++
137 CMD ["sh", "script.sh"]
140 - name: Download required macOS packages
141 if: runner.os == 'macOS'
142 run: brew install coreutils
144 - name: Setup msys and install required packages
145 if: runner.os == 'Windows'
146 uses: msys2/setup-msys2@v2
148 msystem: ${{ matrix.config.msys_sys }}
149 install: mingw-w64-${{ matrix.config.msys_env }} make git expect
151 - name: Download the used network from the fishtest framework
154 - name: Extract the bench number from the commit history
156 for hash in $(git rev-list -100 HEAD); do
157 benchref=$(git show -s $hash | tac | grep -m 1 -o -x '[[:space:]]*\b[Bb]ench[ :]\+[1-9][0-9]\{5,7\}\b[[:space:]]*' | sed 's/[^0-9]//g') && break || true
159 [[ -n "$benchref" ]] && echo "benchref=$benchref" >> $GITHUB_ENV && echo "From commit: $hash" && echo "Reference bench: $benchref" || echo "No bench found"
161 - name: Check compiler
163 if [ -z "${{ matrix.config.base_image }}" ]; then
164 if [ $COMP == ndk ]; then
165 export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
169 echo "$COMPILER -v" > script.sh
170 docker run --rm --platform ${{ matrix.config.platform }} -v ${{ github.workspace }}/src:/app sf_builder
173 - name: Test help target
181 - name: Test debug x86-32 build
182 if: matrix.config.run_32bit_tests
184 export CXXFLAGS="-Werror -D_GLIBCXX_DEBUG"
186 make -j2 ARCH=x86-32 optimize=no debug=yes build
187 ../tests/signature.sh $benchref
189 - name: Test x86-32 build
190 if: matrix.config.run_32bit_tests
193 make -j2 ARCH=x86-32 build
194 ../tests/signature.sh $benchref
196 - name: Test x86-32-sse41-popcnt build
197 if: matrix.config.run_32bit_tests
200 make -j2 ARCH=x86-32-sse41-popcnt build
201 ../tests/signature.sh $benchref
203 - name: Test x86-32-sse2 build
204 if: matrix.config.run_32bit_tests
207 make -j2 ARCH=x86-32-sse2 build
208 ../tests/signature.sh $benchref
210 - name: Test general-32 build
211 if: matrix.config.run_32bit_tests
214 make -j2 ARCH=general-32 build
215 ../tests/signature.sh $benchref
219 - name: Test debug x86-64-avx2 build
220 if: matrix.config.run_64bit_tests
222 export CXXFLAGS="-Werror -D_GLIBCXX_DEBUG"
224 make -j2 ARCH=x86-64-avx2 optimize=no debug=yes build
225 ../tests/signature.sh $benchref
227 - name: Test x86-64-bmi2 build
228 if: matrix.config.run_64bit_tests
231 make -j2 ARCH=x86-64-bmi2 build
232 ../tests/signature.sh $benchref
234 - name: Test x86-64-avx2 build
235 if: matrix.config.run_64bit_tests
238 make -j2 ARCH=x86-64-avx2 build
239 ../tests/signature.sh $benchref
241 # Test a deprecated arch
242 - name: Test x86-64-modern build
243 if: matrix.config.run_64bit_tests
246 make -j2 ARCH=x86-64-modern build
247 ../tests/signature.sh $benchref
249 - name: Test x86-64-sse41-popcnt build
250 if: matrix.config.run_64bit_tests
253 make -j2 ARCH=x86-64-sse41-popcnt build
254 ../tests/signature.sh $benchref
256 - name: Test x86-64-ssse3 build
257 if: matrix.config.run_64bit_tests
260 make -j2 ARCH=x86-64-ssse3 build
261 ../tests/signature.sh $benchref
263 - name: Test x86-64-sse3-popcnt build
264 if: matrix.config.run_64bit_tests
267 make -j2 ARCH=x86-64-sse3-popcnt build
268 ../tests/signature.sh $benchref
270 - name: Test x86-64 build
271 if: matrix.config.run_64bit_tests
274 make -j2 ARCH=x86-64 build
275 ../tests/signature.sh $benchref
277 - name: Test general-64 build
278 if: matrix.config.run_64bit_tests
281 make -j2 ARCH=general-64 build
282 ../tests/signature.sh $benchref
286 - name: Test armv8 build
287 if: matrix.config.run_armv8_tests
289 export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
290 export LDFLAGS="-static -Wno-unused-command-line-argument"
292 make -j2 ARCH=armv8 build
293 ../tests/signature.sh $benchref
295 - name: Test armv8-dotprod build
296 if: matrix.config.run_armv8_tests
298 export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
299 export LDFLAGS="-static -Wno-unused-command-line-argument"
301 make -j2 ARCH=armv8-dotprod build
302 ../tests/signature.sh $benchref
306 - name: Test armv7 build
307 if: matrix.config.run_armv7_tests
309 export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
310 export LDFLAGS="-static -Wno-unused-command-line-argument"
312 make -j2 ARCH=armv7 build
313 ../tests/signature.sh $benchref
315 - name: Test armv7-neon build
316 if: matrix.config.run_armv7_tests
318 export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
319 export LDFLAGS="-static -Wno-unused-command-line-argument"
321 make -j2 ARCH=armv7-neon build
322 ../tests/signature.sh $benchref
326 - name: Test riscv64 build
327 if: matrix.config.run_riscv64_tests
329 echo "export LDFLAGS='-static' && make clean && make -j2 ARCH=riscv64 build" > script.sh
330 docker run --rm --platform ${{ matrix.config.platform }} -v ${{ github.workspace }}/src:/app sf_builder
331 ../tests/signature.sh $benchref
335 - name: Test ppc64 build
336 if: matrix.config.run_ppc64_tests
338 echo "export LDFLAGS='-static' && make clean && make -j2 ARCH=ppc-64 build" > script.sh
339 docker run --rm --platform ${{ matrix.config.platform }} -v ${{ github.workspace }}/src:/app sf_builder
340 ../tests/signature.sh $benchref
344 - name: Check perft and search reproducibility
345 if: matrix.config.run_64bit_tests
348 make -j2 ARCH=x86-64-avx2 build
350 ../tests/reprosearch.sh