]> git.sesse.net Git - stockfish/blob - .github/workflows/stockfish_binaries.yml
86449b97a4bf91fb3cc4c604722930da79d9577b
[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       NAME: ${{ matrix.config.simple_name }}
13       BINARY: ${{ matrix.binaries }}
14     strategy:
15       matrix:
16         config:
17           - name: Ubuntu 20.04 GCC
18             os: ubuntu-20.04
19             simple_name: ubuntu
20             compiler: g++
21             comp: gcc
22             shell: bash {0}
23           - name: MacOS 12 Apple Clang
24             os: macos-12
25             simple_name: macos
26             compiler: clang++
27             comp: clang
28             shell: bash {0}
29           - name: Windows 2022 Mingw-w64 GCC x86_64
30             os: windows-2022
31             simple_name: windows
32             compiler: g++
33             comp: mingw
34             msys_sys: mingw64
35             msys_env: x86_64-gcc
36             shell: msys2 {0}
37             ext: .exe
38         binaries:
39           - x86-64
40           - x86-64-modern
41           - x86-64-avx2
42         exclude:
43           - binaries: x86-64-avx2
44             config: {os: macos-12}
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: sudo apt update
57
58       - name: Setup msys and install required packages
59         if: runner.os == 'Windows'
60         uses: msys2/setup-msys2@v2
61         with:
62           msystem: ${{ matrix.config.msys_sys }}
63           install: mingw-w64-${{ matrix.config.msys_env }} make git
64
65       - name: Download the used network from the fishtest framework
66         run: make net
67
68       - name: Check compiler
69         run: $COMPILER -v
70
71       - name: Test help target
72         run: make help
73
74       - name: Check git
75         run: git --version
76
77       # Compile profile guided builds
78
79       - name: Compile ${{ matrix.binaries }} build
80         run: |
81           make -j2 profile-build ARCH=$BINARY COMP=$COMP
82           make strip ARCH=$BINARY COMP=$COMP
83           mv ./stockfish$EXT ../stockfish-$NAME-$BINARY$EXT
84
85       - name: Remove non src files
86         run: git clean -fx
87
88       - name: Download wiki
89         run: |
90           git clone https://github.com/official-stockfish/Stockfish.wiki.git ../wiki
91           rm -rf ../wiki/.git
92
93       - name: Create tar archive.
94         run: |
95           cd ..
96           mkdir stockfish
97           cp -r wiki stockfish/
98           cp -r src stockfish/
99           cp stockfish-$NAME-$BINARY$EXT stockfish/
100           cp "Top CPU Contributors.txt" stockfish/
101           cp Copying.txt stockfish/
102           cp AUTHORS stockfish/
103           cp CITATION.cff stockfish/
104           cp README.md stockfish/
105           tar -cvf stockfish-$NAME-$BINARY.tar stockfish
106
107       - name: Upload binaries
108         uses: actions/upload-artifact@v3
109         with:
110           name: stockfish-${{ matrix.config.os }}-${{ matrix.binaries }}
111           path: stockfish-${{ matrix.config.simple_name }}-${{ matrix.binaries }}.tar
112
113       - name: Release
114         if: startsWith(github.ref_name, 'sf_') && github.ref_type == 'tag'
115         uses: softprops/action-gh-release@v1
116         with:
117           files: stockfish-${{ matrix.config.simple_name }}-${{ matrix.binaries }}.tar