]> git.sesse.net Git - stockfish/blob - .github/workflows/stockfish_arm_binaries.yml
CI workflows, install git on windows
[stockfish] / .github / workflows / stockfish_arm_binaries.yml
1 name: Stockfish
2 on:
3   workflow_call:
4 jobs:
5   Stockfish:
6     name: ${{ matrix.config.name }} ${{ matrix.binaries }}
7     runs-on: ${{ matrix.config.os }}
8     env:
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 }}
15     strategy:
16       matrix:
17         config:
18           - {
19               name: "Android NDK aarch64",
20               os: ubuntu-20.04,
21               compiler: aarch64-linux-android21-clang++,
22               emu: qemu-aarch64,
23               comp: ndk,
24               shell: 'bash {0}'
25             }
26           - {
27               name: "Android NDK arm",
28               os: ubuntu-20.04,
29               compiler: armv7a-linux-androideabi21-clang++,
30               emu: qemu-arm,
31               comp: ndk,
32               shell: 'bash {0}'
33             }
34         binaries:
35           - armv8
36           - armv7
37           - armv7-neon
38         exclude:
39           - binaries: armv8
40             config: {compiler: armv7a-linux-androideabi21-clang++}
41           - binaries: armv7
42             config: {compiler: aarch64-linux-android21-clang++}
43           - binaries: armv7-neon
44             config: {compiler: aarch64-linux-android21-clang++}
45     defaults:
46       run:
47         working-directory: src
48         shell: ${{ matrix.config.shell }}
49     steps:
50       - uses: actions/checkout@v3
51         with:
52           fetch-depth: 0
53
54       - name: Download required linux packages
55         if: runner.os == 'Linux'
56         run: |
57           sudo apt update
58           sudo apt install qemu-user
59
60       - name: Download the used network from the fishtest framework
61         run: make net
62
63       - name: Check compiler
64         run: |
65           if [ $COMP == ndk ]; then
66             ANDROID_ROOT=/usr/local/lib/android
67             ANDROID_SDK_ROOT=$ANDROID_ROOT/sdk
68             SDKMANAGER=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager
69             echo "y" | $SDKMANAGER "ndk;21.4.7075529"
70             ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/21.4.7075529
71             export PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
72           fi
73           $COMPILER -v
74
75       - name: Test help target
76         run: make help
77
78       - name: Check git
79         run: git --version
80
81       # Compile profile guided builds
82
83       - name: Compile ${{ matrix.binaries }} build
84         run: |
85           if [ $COMP == ndk ]; then
86             ANDROID_ROOT=/usr/local/lib/android
87             ANDROID_SDK_ROOT=$ANDROID_ROOT/sdk
88             SDKMANAGER=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager
89             echo "y" | $SDKMANAGER "ndk;21.4.7075529"
90             ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/21.4.7075529
91             export PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
92             export LDFLAGS="-static -Wno-unused-command-line-argument"
93           fi
94           make clean
95           make -j2 profile-build ARCH=$BINARY COMP=$COMP WINE_PATH=$EMU
96           make strip ARCH=$BINARY COMP=$COMP
97           mv ./stockfish$EXT ../stockfish-android-$BINARY$EXT
98
99       - name: Remove non src files
100         run: rm -f *.o .depend *.nnue
101
102       - name: Create tar archive.
103         run: |
104           cd ..
105           mkdir stockfish
106           cp -r src stockfish/
107           cp stockfish-android-$BINARY$EXT stockfish/
108           cp "Top CPU Contributors.txt" stockfish/
109           cp Copying.txt stockfish/
110           cp AUTHORS stockfish/
111           tar -cvf stockfish-android-$BINARY.tar stockfish
112
113       - name: Upload binaries
114         uses: actions/upload-artifact@v3
115         with:
116           name: stockfish-android-${{ matrix.binaries }}
117           path: stockfish-android-${{ matrix.binaries }}.tar