mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00

use a fixed compiler on Linux and Windows (right now gcc 11). build avxvnni on Windows (Linux needs updated core utils) build x86-32 on Linux (Windows needs other mingw) fix a Makefile issue where a failed PGOBENCH would not stop the build reuse the WINE_PATH for SDE as we do for QEMU use WINE_PATH variable also for the signature verify the bench for each of the binaries do not build x86-64-avx2 on macos closes https://github.com/official-stockfish/Stockfish/pull/4682 No functional change
169 lines
5.7 KiB
YAML
169 lines
5.7 KiB
YAML
name: Stockfish
|
|
on:
|
|
workflow_call:
|
|
jobs:
|
|
Stockfish:
|
|
name: ${{ matrix.config.name }} ${{ matrix.binaries }}
|
|
runs-on: ${{ matrix.config.os }}
|
|
env:
|
|
COMPILER: ${{ matrix.config.compiler }}
|
|
COMP: ${{ matrix.config.comp }}
|
|
EMU: ${{ matrix.config.emu }}
|
|
EXT: ${{ matrix.config.ext }}
|
|
OS: ${{ matrix.config.os }}
|
|
BINARY: ${{ matrix.binaries }}
|
|
strategy:
|
|
matrix:
|
|
config:
|
|
- name: Android NDK aarch64
|
|
os: ubuntu-22.04
|
|
compiler: aarch64-linux-android21-clang++
|
|
emu: qemu-aarch64
|
|
comp: ndk
|
|
shell: bash
|
|
- name: Android NDK arm
|
|
os: ubuntu-22.04
|
|
compiler: armv7a-linux-androideabi21-clang++
|
|
emu: qemu-arm
|
|
comp: ndk
|
|
shell: bash
|
|
binaries:
|
|
- armv8-dotprod
|
|
- armv8
|
|
- armv7
|
|
- armv7-neon
|
|
exclude:
|
|
- binaries: armv8-dotprod
|
|
config: {compiler: armv7a-linux-androideabi21-clang++}
|
|
- binaries: armv8
|
|
config: {compiler: armv7a-linux-androideabi21-clang++}
|
|
- binaries: armv7
|
|
config: {compiler: aarch64-linux-android21-clang++}
|
|
- binaries: armv7-neon
|
|
config: {compiler: aarch64-linux-android21-clang++}
|
|
defaults:
|
|
run:
|
|
working-directory: src
|
|
shell: ${{ matrix.config.shell }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Download required linux packages
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install qemu-user
|
|
|
|
- name: Install NDK
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
if [ $COMP == ndk ]; then
|
|
NDKV="21.4.7075529"
|
|
ANDROID_ROOT=/usr/local/lib/android
|
|
ANDROID_SDK_ROOT=$ANDROID_ROOT/sdk
|
|
SDKMANAGER=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager
|
|
echo "y" | $SDKMANAGER "ndk;$NDKV"
|
|
ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/$NDKV
|
|
ANDROID_NDK_BIN=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin
|
|
echo "ANDROID_NDK_BIN=$ANDROID_NDK_BIN" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Extract the bench number from the commit history
|
|
run: |
|
|
for hash in $(git rev-list -100 HEAD); do
|
|
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
|
|
done
|
|
[[ -n "$benchref" ]] && echo "benchref=$benchref" >> $GITHUB_ENV && echo "From commit: $hash" && echo "Reference bench: $benchref" || echo "No bench found"
|
|
|
|
- name: Download the used network from the fishtest framework
|
|
run: make net
|
|
|
|
- name: Check compiler
|
|
run: |
|
|
if [ $COMP == ndk ]; then
|
|
export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
|
|
fi
|
|
$COMPILER -v
|
|
|
|
- name: Test help target
|
|
run: make help
|
|
|
|
- name: Check git
|
|
run: git --version
|
|
|
|
# Compile profile guided builds
|
|
|
|
- name: Compile ${{ matrix.binaries }} build
|
|
run: |
|
|
if [ $COMP == ndk ]; then
|
|
export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
|
|
export LDFLAGS="-static -Wno-unused-command-line-argument"
|
|
fi
|
|
make clean
|
|
make -j2 profile-build ARCH=$BINARY COMP=$COMP WINE_PATH=$EMU
|
|
make strip ARCH=$BINARY COMP=$COMP
|
|
WINE_PATH=$EMU ../tests/signature.sh $benchref
|
|
mv ./stockfish$EXT ../stockfish-android-$BINARY$EXT
|
|
|
|
- name: Remove non src files
|
|
run: rm -f *.o .depend *.nnue
|
|
|
|
- name: Download wiki
|
|
run: |
|
|
git clone https://github.com/official-stockfish/Stockfish.wiki.git ../wiki
|
|
cd ../wiki
|
|
rm -rf .git
|
|
|
|
- name: Create tar archive.
|
|
run: |
|
|
cd ..
|
|
mkdir stockfish
|
|
cp -r wiki stockfish/
|
|
cp -r src stockfish/
|
|
cp stockfish-android-$BINARY$EXT stockfish/
|
|
cp "Top CPU Contributors.txt" stockfish/
|
|
cp Copying.txt stockfish/
|
|
cp AUTHORS stockfish/
|
|
cp CITATION.cff stockfish/
|
|
cp README.md stockfish/
|
|
tar -cvf stockfish-android-$BINARY.tar stockfish
|
|
|
|
- name: Upload binaries
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: stockfish-android-${{ matrix.binaries }}
|
|
path: stockfish-android-${{ matrix.binaries }}.tar
|
|
|
|
- name: Release
|
|
if: startsWith(github.ref_name, 'sf_') && github.ref_type == 'tag'
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: stockfish-android-${{ matrix.binaries }}.tar
|
|
|
|
- name: Get last commit sha
|
|
id: last_commit
|
|
run: echo "COMMIT_SHA=$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
|
|
|
|
- name: Get commit date
|
|
id: commit_date
|
|
run: echo "COMMIT_DATE=$(git show -s --date=format:'%Y%m%d' --format=%cd HEAD)" >> $GITHUB_ENV
|
|
|
|
# Make sure that an old ci which still runs on master doesn't recreate a prerelease
|
|
- name: Check Pullable Commits
|
|
id: check_commits
|
|
run: |
|
|
git fetch
|
|
CHANGES=$(git rev-list HEAD..origin/master --count)
|
|
echo "CHANGES=$CHANGES" >> $GITHUB_ENV
|
|
|
|
- name: Prerelease
|
|
if: github.ref_name == 'master' && env.CHANGES == '0'
|
|
continue-on-error: true
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
name: Stockfish dev-${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }}
|
|
tag_name: stockfish-dev-${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }}
|
|
prerelease: true
|
|
files: stockfish-android-${{ matrix.binaries }}.tar
|