6 name: ${{ matrix.config.name }} ${{ matrix.binaries }}
7 runs-on: ${{ matrix.config.os }}
9 COMPILER: ${{ matrix.config.compiler }}
10 COMP: ${{ matrix.config.comp }}
11 EXT: ${{ matrix.config.ext }}
12 SDE: ${{ matrix.config.sde }}
13 NAME: ${{ matrix.config.simple_name }}
14 BINARY: ${{ matrix.binaries }}
18 - name: Ubuntu 20.04 GCC
25 sde: /home/runner/work/Stockfish/Stockfish/.output/sde-temp-files/sde-external-9.14.0-2022-10-25-lin/sde -future --
26 - name: MacOS 12 Apple Clang
33 - name: Windows 2022 Mingw-w64 GCC x86_64
42 sde: /d/a/Stockfish/Stockfish/.output/sde-temp-files/sde-external-9.14.0-2022-10-25-win/sde.exe -future --
56 config: { os: macos-12 }
57 - binaries: x86-64-avx2
58 config: { os: macos-12 }
59 - binaries: x86-64-bmi2
60 config: { os: macos-12 }
61 - binaries: x86-64-avxvnni
62 config: { os: macos-12 }
63 - binaries: x86-64-avxvnni
64 config: { ubuntu-20.04 }
65 - binaries: x86-64-avx512
66 config: { os: macos-12 }
67 - binaries: x86-64-vnni256
68 config: { os: macos-12 }
69 - binaries: x86-64-vnni512
70 config: { os: macos-12 }
73 working-directory: src
74 shell: ${{ matrix.config.shell }}
76 - uses: actions/checkout@v3
80 - name: Download required Linux packages
81 if: runner.os == 'Linux'
84 sudo apt install g++-multilib g++-11-multilib
86 - name: Install fixed GCC on Linux
87 if: runner.os == 'Linux'
88 uses: egor-tensin/setup-gcc@v1
92 - name: Setup msys and install required packages
93 if: runner.os == 'Windows'
94 uses: msys2/setup-msys2@v2
96 msystem: ${{ matrix.config.msys_sys }}
97 install: mingw-w64-${{ matrix.config.msys_env }} make git zip
99 - name: Install fixed GCC on Windows
100 if: runner.os == 'Windows'
102 wget https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc-11.3.0-2-any.pkg.tar.zst
103 pacman -U mingw-w64-x86_64-gcc-11.3.0-2-any.pkg.tar.zst --noconfirm
105 - name: Download SDE package
106 if: runner.os == 'Linux' || runner.os == 'Windows'
107 uses: petarpetrovt/setup-sde@v2.1
109 environmentVariableName: SDE_DIR
112 - name: Download the used network from the fishtest framework
115 - name: Extract the bench number from the commit history
117 for hash in $(git rev-list -100 HEAD); do
118 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
120 [[ -n "$benchref" ]] && echo "benchref=$benchref" >> $GITHUB_ENV && echo "From commit: $hash" && echo "Reference bench: $benchref" || echo "No bench found"
122 - name: Check compiler
125 - name: Test help target
131 # Compile profile guided builds
133 - name: Compile ${{ matrix.binaries }} build
135 make -j2 profile-build ARCH=$BINARY COMP=$COMP WINE_PATH="$SDE"
136 make strip ARCH=$BINARY COMP=$COMP
137 WINE_PATH="$SDE" ../tests/signature.sh $benchref
138 mv ./stockfish$EXT ../stockfish-$NAME-$BINARY$EXT
140 - name: Remove non src files
143 - name: Download wiki
145 git clone https://github.com/official-stockfish/Stockfish.wiki.git ../wiki
148 - name: Create directory.
152 cp -r wiki stockfish/
154 cp stockfish-$NAME-$BINARY$EXT stockfish/
155 cp "Top CPU Contributors.txt" stockfish/
156 cp Copying.txt stockfish/
157 cp AUTHORS stockfish/
158 cp CITATION.cff stockfish/
159 cp README.md stockfish/
162 if: runner.os != 'Windows'
165 tar -cvf stockfish-$NAME-$BINARY.tar stockfish
168 if: runner.os == 'Windows'
171 zip -r stockfish-$NAME-$BINARY.zip stockfish
173 - name: Upload binaries
174 if: runner.os != 'Windows'
175 uses: actions/upload-artifact@v3
177 name: stockfish-${{ matrix.config.os }}-${{ matrix.binaries }}
178 path: stockfish-${{ matrix.config.simple_name }}-${{ matrix.binaries }}.tar
180 # Artifacts automatically get zipped
181 # to avoid double zipping, we use the unzipped directory
182 - name: Upload binaries
183 if: runner.os == 'Windows'
184 uses: actions/upload-artifact@v3
186 name: stockfish-${{ matrix.config.os }}-${{ matrix.binaries }}
190 if: startsWith(github.ref_name, 'sf_') && github.ref_type == 'tag'
191 uses: softprops/action-gh-release@v1
193 files: stockfish-${{ matrix.config.simple_name }}-${{ matrix.binaries }}.${{ matrix.config.archive_ext }}
195 - name: Get last commit sha
197 run: echo "COMMIT_SHA=$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
199 - name: Get commit date
201 run: echo "COMMIT_DATE=$(git show -s --date=format:'%Y%m%d' --format=%cd HEAD)" >> $GITHUB_ENV
203 # Make sure that an old ci which still runs on master doesn't recreate a prerelease
204 - name: Check Pullable Commits
208 CHANGES=$(git rev-list HEAD..origin/master --count)
209 echo "CHANGES=$CHANGES" >> $GITHUB_ENV
212 if: github.ref_name == 'master' && env.CHANGES == '0'
213 continue-on-error: true
214 uses: softprops/action-gh-release@v1
216 name: Stockfish dev-${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }}
217 tag_name: stockfish-dev-${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }}
219 files: stockfish-${{ matrix.config.simple_name }}-${{ matrix.binaries }}.${{ matrix.config.archive_ext }}