6 name: ${{ matrix.config.name }} ${{ matrix.binaries }}
7 runs-on: ${{ matrix.config.os }}
9 COMPILER: ${{ matrix.config.compiler }}
10 COMP: ${{ matrix.config.comp }}
11 EMU: ${{ matrix.config.emu }}
12 EXT: ${{ matrix.config.ext }}
13 OS: ${{ matrix.config.os }}
14 BINARY: ${{ matrix.binaries }}
18 - name: Android NDK aarch64
20 compiler: aarch64-linux-android21-clang++
24 - name: Android NDK arm
26 compiler: armv7a-linux-androideabi21-clang++
36 - binaries: armv8-dotprod
37 config: {compiler: armv7a-linux-androideabi21-clang++}
39 config: {compiler: armv7a-linux-androideabi21-clang++}
41 config: {compiler: aarch64-linux-android21-clang++}
42 - binaries: armv7-neon
43 config: {compiler: aarch64-linux-android21-clang++}
46 working-directory: src
47 shell: ${{ matrix.config.shell }}
49 - uses: actions/checkout@v3
53 - name: Download required linux packages
54 if: runner.os == 'Linux'
57 sudo apt install qemu-user
60 if: runner.os == 'Linux'
62 if [ $COMP == ndk ]; then
64 ANDROID_ROOT=/usr/local/lib/android
65 ANDROID_SDK_ROOT=$ANDROID_ROOT/sdk
66 SDKMANAGER=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager
67 echo "y" | $SDKMANAGER "ndk;$NDKV"
68 ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/$NDKV
69 ANDROID_NDK_BIN=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin
70 echo "ANDROID_NDK_BIN=$ANDROID_NDK_BIN" >> $GITHUB_ENV
73 - name: Extract the bench number from the commit history
75 for hash in $(git rev-list -100 HEAD); do
76 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
78 [[ -n "$benchref" ]] && echo "benchref=$benchref" >> $GITHUB_ENV && echo "From commit: $hash" && echo "Reference bench: $benchref" || echo "No bench found"
80 - name: Download the used network from the fishtest framework
83 - name: Check compiler
85 if [ $COMP == ndk ]; then
86 export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
90 - name: Test help target
96 # Compile profile guided builds
98 - name: Compile ${{ matrix.binaries }} build
100 if [ $COMP == ndk ]; then
101 export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
102 export LDFLAGS="-static -Wno-unused-command-line-argument"
105 make -j2 profile-build ARCH=$BINARY COMP=$COMP WINE_PATH=$EMU
106 make strip ARCH=$BINARY COMP=$COMP
107 WINE_PATH=$EMU ../tests/signature.sh $benchref
108 mv ./stockfish$EXT ../stockfish-android-$BINARY$EXT
110 - name: Remove non src files
111 run: rm -f *.o .depend *.nnue
113 - name: Download wiki
115 git clone https://github.com/official-stockfish/Stockfish.wiki.git ../wiki
119 - name: Create tar archive.
123 cp -r wiki stockfish/
125 cp stockfish-android-$BINARY$EXT stockfish/
126 cp "Top CPU Contributors.txt" stockfish/
127 cp Copying.txt stockfish/
128 cp AUTHORS stockfish/
129 cp CITATION.cff stockfish/
130 cp README.md stockfish/
131 cp CONTRIBUTING.md stockfish/
132 tar -cvf stockfish-android-$BINARY.tar stockfish
134 - name: Upload binaries
135 uses: actions/upload-artifact@v3
137 name: stockfish-android-${{ matrix.binaries }}
138 path: stockfish-android-${{ matrix.binaries }}.tar
141 if: startsWith(github.ref_name, 'sf_') && github.ref_type == 'tag'
142 uses: softprops/action-gh-release@v1
144 files: stockfish-android-${{ matrix.binaries }}.tar
146 - name: Get last commit sha
148 run: echo "COMMIT_SHA=$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
150 - name: Get commit date
152 run: echo "COMMIT_DATE=$(git show -s --date=format:'%Y%m%d' --format=%cd HEAD)" >> $GITHUB_ENV
154 # Make sure that an old ci which still runs on master doesn't recreate a prerelease
155 - name: Check Pullable Commits
159 CHANGES=$(git rev-list HEAD..origin/master --count)
160 echo "CHANGES=$CHANGES" >> $GITHUB_ENV
163 if: github.ref_name == 'master' && env.CHANGES == '0'
164 continue-on-error: true
165 uses: softprops/action-gh-release@v1
167 name: Stockfish dev-${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }}
168 tag_name: stockfish-dev-${{ env.COMMIT_DATE }}-${{ env.COMMIT_SHA }}
170 files: stockfish-android-${{ matrix.binaries }}.tar