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