]> git.sesse.net Git - stockfish/blob - .github/workflows/stockfish_arm_binaries.yml
Add wiki to artifacts
[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           - name: Android NDK aarch64
19             os: ubuntu-22.04
20             compiler: aarch64-linux-android21-clang++
21             emu: qemu-aarch64
22             comp: ndk
23             shell: bash {0}
24           - name: Android NDK arm
25             os: ubuntu-22.04
26             compiler: armv7a-linux-androideabi21-clang++
27             emu: qemu-arm
28             comp: ndk
29             shell: bash {0}
30         binaries:
31           - armv8
32           - armv7
33           - armv7-neon
34         exclude:
35           - binaries: armv8
36             config: {compiler: armv7a-linux-androideabi21-clang++}
37           - binaries: armv7
38             config: {compiler: aarch64-linux-android21-clang++}
39           - binaries: armv7-neon
40             config: {compiler: aarch64-linux-android21-clang++}
41     defaults:
42       run:
43         working-directory: src
44         shell: ${{ matrix.config.shell }}
45     steps:
46       - uses: actions/checkout@v3
47         with:
48           fetch-depth: 0
49
50       - name: Download required linux packages
51         if: runner.os == 'Linux'
52         run: |
53           sudo apt update
54           sudo apt install qemu-user
55
56       - name: Install NDK
57         if: runner.os == 'Linux'
58         run: |
59           if [ $COMP == ndk ]; then
60             NDKV="21.4.7075529"
61             ANDROID_ROOT=/usr/local/lib/android
62             ANDROID_SDK_ROOT=$ANDROID_ROOT/sdk
63             SDKMANAGER=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager
64             echo "y" | $SDKMANAGER "ndk;$NDKV"
65             ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/$NDKV
66             ANDROID_NDK_BIN=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin
67             echo "ANDROID_NDK_BIN=$ANDROID_NDK_BIN" >> $GITHUB_ENV
68           fi
69
70       - name: Download the used network from the fishtest framework
71         run: make net
72
73       - name: Check compiler
74         run: |
75           if [ $COMP == ndk ]; then
76             export PATH=${{ env.ANDROID_NDK_BIN }}:$PATH
77           fi
78           $COMPILER -v
79
80       - name: Test help target
81         run: make help
82
83       - name: Check git
84         run: git --version
85
86       # Compile profile guided builds
87
88       - name: Compile ${{ matrix.binaries }} build
89         run: |
90           if [ $COMP == ndk ]; then
91             export PATH=${{ env.ANDROID_NDK_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: Download wiki
103         run: |
104           git clone https://github.com/official-stockfish/Stockfish.wiki.git ../wiki
105           cd ../wiki
106           rm -rf .git
107
108       - name: Create tar archive.
109         run: |
110           cd ..
111           mkdir stockfish
112           cp -r wiki stockfish/
113           cp -r src stockfish/
114           cp stockfish-android-$BINARY$EXT stockfish/
115           cp "Top CPU Contributors.txt" stockfish/
116           cp Copying.txt stockfish/
117           cp AUTHORS stockfish/
118           tar -cvf stockfish-android-$BINARY.tar stockfish
119
120       - name: Upload binaries
121         uses: actions/upload-artifact@v3
122         with:
123           name: stockfish-android-${{ matrix.binaries }}
124           path: stockfish-android-${{ matrix.binaries }}.tar