]> git.sesse.net Git - stockfish/blob - .github/workflows/stockfish_sanitizers.yml
speedup CI
[stockfish] / .github / workflows / stockfish_sanitizers.yml
1 name: Stockfish
2 on:
3   workflow_call:
4 jobs:
5   Stockfish:
6     name: ${{ matrix.sanitizers.name }}
7     runs-on: ${{ matrix.config.os }}
8     env:
9       COMPILER: ${{ matrix.config.compiler }}
10       COMP: ${{ matrix.config.comp }}
11       CXXFLAGS: "-Werror"
12     strategy:
13       matrix:
14         config:
15           - {
16               name: "Ubuntu 20.04 GCC",
17               os: ubuntu-20.04,
18               compiler: g++,
19               comp: gcc,
20               shell: 'bash {0}'
21             }
22         sanitizers:
23           - {
24               name: Run with thread sanitizer,
25               make_option: sanitize=thread,
26               instrumented_option: sanitizer-thread
27             }
28           - {
29               name: Run with UB sanitizer,
30               make_option: sanitize=undefined,
31               instrumented_option: sanitizer-undefined
32             }
33           - {
34               name: Run under valgrind,
35               make_option: "",
36               instrumented_option: valgrind
37             }
38           - {
39               name: Run under valgrind-thread,
40               make_option: "",
41               instrumented_option: valgrind-thread
42             }
43     defaults:
44       run:
45         working-directory: src
46         shell: ${{ matrix.config.shell }}
47     steps:
48       - uses: actions/checkout@v3
49         with:
50           fetch-depth: 0
51
52       - name: Download required linux packages
53         run: |
54           sudo apt update
55           sudo apt install expect valgrind g++-multilib qemu-user
56
57       - name: Download the used network from the fishtest framework
58         run: |
59           make net
60
61       - name: Check compiler
62         run: |
63           export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin
64           $COMPILER -v
65
66       - name: Test help target
67         run: |
68           make help
69
70       # Sanitizers
71
72       - name: ${{ matrix.sanitizers.name }}
73         run: |
74           export CXXFLAGS="-O1 -fno-inline"
75           make clean
76           make -j2 ARCH=x86-64-modern ${{ matrix.sanitizers.make_option }} debug=yes optimize=no build > /dev/null
77           ../tests/instrumented.sh --${{ matrix.sanitizers.instrumented_option }}