]> git.sesse.net Git - stockfish/blob - .github/workflows/stockfish_binaries.yml
1fa123fac218b6d9d71769c50c6a1b6858ec1c3a
[stockfish] / .github / workflows / stockfish_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       EXT: ${{ matrix.config.ext }}
12       OS: ${{ matrix.config.os }}
13       BINARY: ${{ matrix.binaries }}
14     strategy:
15       matrix:
16         config:
17           - {
18               name: "Ubuntu 20.04 GCC",
19               os: ubuntu-20.04,
20               compiler: g++,
21               comp: gcc,
22               shell: 'bash {0}'
23             }
24           - {
25               name: "MacOS 12 Apple Clang",
26               os: macos-12,
27               compiler: clang++,
28               comp: clang,
29               shell: 'bash {0}'
30             }
31           - {
32               name: "Windows 2022 Mingw-w64 GCC x86_64",
33               os: windows-2022,
34               compiler: g++,
35               comp: mingw,
36               msys_sys: 'mingw64',
37               msys_env: 'x86_64-gcc',
38               shell: 'msys2 {0}',
39               ext: .exe
40             }
41         binaries:
42           - x86-64
43           - x86-64-modern
44           - x86-64-avx2
45         exclude:
46           - binaries: x86-64-avx2
47             config: {os: macos-12}
48     defaults:
49       run:
50         working-directory: src
51         shell: ${{ matrix.config.shell }}
52     steps:
53       - uses: actions/checkout@v3
54         with:
55           fetch-depth: 0
56
57       - name: Download required linux packages
58         if: runner.os == 'Linux'
59         run: |
60           sudo apt update
61
62       - name: Setup msys and install required packages
63         if: runner.os == 'Windows'
64         uses: msys2/setup-msys2@v2
65         with:
66           msystem: ${{ matrix.config.msys_sys }}
67           install: mingw-w64-${{ matrix.config.msys_env }} make
68
69       - name: Download the used network from the fishtest framework
70         run: |
71           make net
72
73       - name: Check compiler
74         run: |
75           $COMPILER -v
76
77       - name: Test help target
78         run: |
79           make help
80
81       # Compile profile guided builds
82
83       - name: Compile ${{ matrix.binaries }} build
84         run: |
85           make clean
86           make -j2 profile-build ARCH=$BINARY COMP=$COMP
87           make strip ARCH=$BINARY COMP=$COMP
88           mv ./stockfish$EXT ../stockfish-$OS-$BINARY$EXT
89
90       - name: Remove non src files
91         run: rm -f *.o .depend *.nnue
92
93       - name: Create tar archive.
94         run: |
95           cd ..
96           mkdir stockfish
97           cp -r src stockfish/
98           cp stockfish-$OS-$BINARY$EXT stockfish/
99           cp "Top CPU Contributors.txt" stockfish/
100           cp Copying.txt stockfish/
101           cp AUTHORS stockfish/
102           tar -cvf stockfish-$OS-$BINARY.tar stockfish
103
104       - name: Upload binaries
105         uses: actions/upload-artifact@v3
106         with:
107           name: stockfish-${{ matrix.config.os }}-${{ matrix.binaries }}
108           path: |
109             stockfish-${{ matrix.config.os }}-${{ matrix.binaries }}.tar