]> git.sesse.net Git - stockfish/blob - .github/workflows/stockfish.yml
Generalize the feature transform to use vec_t macros
[stockfish] / .github / workflows / stockfish.yml
1 name: Stockfish
2 on:
3   push:
4     branches:
5       - master
6       - tools
7       - github_ci
8       - github_ci_armv7
9   pull_request:
10     branches:
11       - master
12       - tools
13 jobs:
14   Stockfish:
15     name: ${{ matrix.config.name }}
16     runs-on: ${{ matrix.config.os }}
17     env:
18       COMPILER: ${{ matrix.config.compiler }}
19       COMP: ${{ matrix.config.comp }}
20       CXXFLAGS: "-Werror"
21     strategy:
22       matrix:
23         config:
24           # set the variable for the required tests:
25           # run_expensive_tests: true
26           # run_32bit_tests: true
27           # run_64bit_tests: true
28           # run_armv8_tests: true
29           # run_armv7_tests: true
30           - {
31               name: "Ubuntu 20.04 GCC",
32               os: ubuntu-20.04,
33               compiler: g++,
34               comp: gcc,
35               run_expensive_tests: true,
36               run_32bit_tests: true,
37               run_64bit_tests: true,
38               shell: 'bash {0}'
39             }
40           - {
41               name: "Ubuntu 20.04 Clang",
42               os: ubuntu-20.04,
43               compiler: clang++,
44               comp: clang,
45               run_32bit_tests: true,
46               run_64bit_tests: true,
47               shell: 'bash {0}'
48             }
49           - {
50               name: "Ubuntu 20.04 NDK armv8",
51               os: ubuntu-20.04,
52               compiler: aarch64-linux-android21-clang++,
53               comp: ndk,
54               run_armv8_tests: true,
55               shell: 'bash {0}'
56             }
57           - {
58               name: "Ubuntu 20.04 NDK armv7",
59               os: ubuntu-20.04,
60               compiler: armv7a-linux-androideabi21-clang++,
61               comp: ndk,
62               run_armv7_tests: true,
63               shell: 'bash {0}'
64             }
65           - {
66               name: "MacOS 10.15 Apple Clang",
67               os: macos-10.15,
68               compiler: clang++,
69               comp: clang,
70               run_64bit_tests: true,
71               shell: 'bash {0}'
72             }
73           - {
74               name: "MacOS 10.15 GCC 10",
75               os: macos-10.15,
76               compiler: g++-10,
77               comp: gcc,
78               run_64bit_tests: true,
79               shell: 'bash {0}'
80             }
81           - {
82               name: "Windows 2022 Mingw-w64 GCC x86_64",
83               os: windows-2022,
84               compiler: g++,
85               comp: mingw,
86               run_64bit_tests: true,
87               msys_sys: 'mingw64',
88               msys_env: 'x86_64-gcc',
89               shell: 'msys2 {0}'
90             }
91           - {
92               name: "Windows 2022 Mingw-w64 GCC i686",
93               os: windows-2022,
94               compiler: g++,
95               comp: mingw,
96               run_32bit_tests: true,
97               msys_sys: 'mingw32',
98               msys_env: 'i686-gcc',
99               shell: 'msys2 {0}'
100             }
101           - {
102               name: "Windows 2022 Mingw-w64 Clang x86_64",
103               os: windows-2022,
104               compiler: clang++,
105               comp: clang,
106               run_64bit_tests: true,
107               msys_sys: 'clang64',
108               msys_env: 'clang-x86_64-clang',
109               shell: 'msys2 {0}'
110             }
111
112     defaults:
113       run:
114         working-directory: src
115         shell: ${{ matrix.config.shell }}
116     steps:
117       - uses: actions/checkout@v2
118         with:
119           fetch-depth: 0
120
121       - name: Download required linux packages
122         if: runner.os == 'Linux'
123         run: |
124           sudo apt update
125           sudo apt install expect valgrind g++-multilib qemu-user
126
127       - name: Setup msys and install required packages
128         if: runner.os == 'Windows'
129         uses: msys2/setup-msys2@v2
130         with:
131           msystem: ${{matrix.config.msys_sys}}
132           install: mingw-w64-${{matrix.config.msys_env}} make git expect
133
134       - name: Download the used network from the fishtest framework
135         run: |
136           make net
137
138       - name: Extract the bench number from the commit history
139         run: |
140           git log HEAD | grep "\b[Bb]ench[ :]\+[0-9]\{7\}" | head -n 1 | sed "s/[^0-9]*\([0-9]*\).*/\1/g" > git_sig
141           [ -s git_sig ] && echo "benchref=$(cat git_sig)" >> $GITHUB_ENV && echo "Reference bench:" $(cat git_sig) || echo "No bench found"
142
143       - name: Check compiler
144         run: |
145           export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin
146           $COMPILER -v
147
148       - name: Test help target
149         run: |
150           make help
151
152       # x86-32 tests
153
154       - name: Test debug x86-32 build
155         if: ${{ matrix.config.run_32bit_tests }}
156         run: |
157           export CXXFLAGS="-Werror -D_GLIBCXX_DEBUG"
158           make clean
159           make -j2 ARCH=x86-32 optimize=no debug=yes build
160           ../tests/signature.sh $benchref
161
162       - name: Test x86-32 build
163         if: ${{ matrix.config.run_32bit_tests }}
164         run: |
165           make clean
166           make -j2 ARCH=x86-32 build
167           ../tests/signature.sh $benchref
168
169       - name: Test x86-32-sse41-popcnt build
170         if: ${{ matrix.config.run_32bit_tests }}
171         run: |
172           make clean
173           make -j2 ARCH=x86-32-sse41-popcnt build
174           ../tests/signature.sh $benchref
175
176       - name: Test x86-32-sse2 build
177         if: ${{ matrix.config.run_32bit_tests }}
178         run: |
179           make clean
180           make -j2 ARCH=x86-32-sse2 build
181           ../tests/signature.sh $benchref
182
183       - name: Test general-32 build
184         if: ${{ matrix.config.run_32bit_tests }}
185         run: |
186           make clean
187           make -j2 ARCH=general-32 build
188           ../tests/signature.sh $benchref
189
190       # x86-64 tests
191
192       - name: Test debug x86-64-modern build
193         if: ${{ matrix.config.run_64bit_tests }}
194         run: |
195           export CXXFLAGS="-Werror -D_GLIBCXX_DEBUG"
196           make clean
197           make -j2 ARCH=x86-64-modern optimize=no debug=yes build
198           ../tests/signature.sh $benchref
199
200       - name: Test x86-64-modern build
201         if: ${{ matrix.config.run_64bit_tests }}
202         run: |
203           make clean
204           make -j2 ARCH=x86-64-modern build
205           ../tests/signature.sh $benchref
206
207       - name: Test x86-64-ssse3 build
208         if: ${{ matrix.config.run_64bit_tests }}
209         run: |
210           make clean
211           make -j2 ARCH=x86-64-ssse3 build
212           ../tests/signature.sh $benchref
213
214       - name: Test x86-64-sse3-popcnt build
215         if: ${{ matrix.config.run_64bit_tests }}
216         run: |
217           make clean
218           make -j2 ARCH=x86-64-sse3-popcnt build
219           ../tests/signature.sh $benchref
220
221       - name: Test x86-64 build
222         if: ${{ matrix.config.run_64bit_tests }}
223         run: |
224           make clean
225           make -j2 ARCH=x86-64 build
226           ../tests/signature.sh $benchref
227
228       - name: Test general-64 build
229         if: matrix.config.run_64bit_tests
230         run: |
231           make clean
232           make -j2 ARCH=general-64 build
233           ../tests/signature.sh $benchref
234
235       # x86-64 with newer extensions tests
236
237       - name: Compile x86-64-avx2 build
238         if: ${{ matrix.config.run_64bit_tests }}
239         run: |
240           make clean
241           make -j2 ARCH=x86-64-avx2 build
242
243       - name: Compile x86-64-bmi2 build
244         if: ${{ matrix.config.run_64bit_tests }}
245         run: |
246           make clean
247           make -j2 ARCH=x86-64-bmi2 build
248
249       - name: Compile x86-64-avx512 build
250         if: ${{ matrix.config.run_64bit_tests }}
251         run: |
252           make clean
253           make -j2 ARCH=x86-64-avx512 build
254
255       - name: Compile x86-64-vnni512 build
256         if: ${{ matrix.config.run_64bit_tests }}
257         run: |
258           make clean
259           make -j2 ARCH=x86-64-vnni512 build
260
261       - name: Compile x86-64-vnni256 build
262         if: ${{ matrix.config.run_64bit_tests }}
263         run: |
264           make clean
265           make -j2 ARCH=x86-64-vnni256 build
266
267       # armv8 tests
268
269       - name: Test armv8 build
270         if: ${{ matrix.config.run_armv8_tests }}
271         run: |
272           export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
273           export LDFLAGS="-static -Wno-unused-command-line-argument"
274           make clean
275           make -j2 ARCH=armv8 build
276           ../tests/signature.sh $benchref
277
278       # armv7 tests
279
280       - name: Test armv7 build
281         if: ${{ matrix.config.run_armv7_tests }}
282         run: |
283           export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
284           export LDFLAGS="-static -Wno-unused-command-line-argument"
285           make clean
286           make -j2 ARCH=armv7 build
287           ../tests/signature.sh $benchref
288
289       - name: Test armv7-neon build
290         if: ${{ matrix.config.run_armv7_tests }}
291         run: |
292           export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
293           export LDFLAGS="-static -Wno-unused-command-line-argument"
294           make clean
295           make -j2 ARCH=armv7-neon build
296           ../tests/signature.sh $benchref
297
298       # Other tests
299
300       - name: Check perft and search reproducibility
301         if: ${{ matrix.config.run_64bit_tests }}
302         run: |
303           make clean
304           make -j2 ARCH=x86-64-modern build
305           ../tests/perft.sh
306           ../tests/reprosearch.sh
307
308       # Sanitizers
309
310       - name: Run under valgrind
311         if: ${{ matrix.config.run_expensive_tests }}
312         run: |
313           export CXXFLAGS="-O1 -fno-inline"
314           make clean
315           make -j2 ARCH=x86-64-modern debug=yes optimize=no build > /dev/null
316           ../tests/instrumented.sh --valgrind
317           ../tests/instrumented.sh --valgrind-thread
318
319       - name: Run with UB sanitizer
320         if: ${{ matrix.config.run_expensive_tests }}
321         run: |
322           export CXXFLAGS="-O1 -fno-inline"
323           make clean
324           make -j2 ARCH=x86-64-modern sanitize=undefined optimize=no debug=yes build > /dev/null
325           ../tests/instrumented.sh --sanitizer-undefined
326
327       - name: Run with thread sanitizer
328         if: ${{ matrix.config.run_expensive_tests }}
329         run: |
330           export CXXFLAGS="-O1 -fno-inline"
331           make clean
332           make -j2 ARCH=x86-64-modern sanitize=thread optimize=no debug=yes build > /dev/null
333           ../tests/instrumented.sh --sanitizer-thread