Fix Windows CI: stop pinning CMake to the VS 2022 generator (#1208) #159
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential zlib1g-dev libzip-dev opencl-headers ocl-icd-opencl-dev | |
| - name: Cache CMake build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| cpp/CMakeCache.txt | |
| cpp/CMakeFiles | |
| key: ${{ runner.os }}-cmake-${{ hashFiles('**/CMakeLists.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cmake- | |
| - name: Configure CMake | |
| working-directory: cpp | |
| run: | | |
| cmake . -DUSE_BACKEND=OPENCL -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS_RELEASE="-s" | |
| - name: Build | |
| working-directory: cpp | |
| run: | | |
| make -j$(nproc) | |
| - name: Run tests | |
| working-directory: cpp | |
| run: | | |
| ./katago runtests | |
| - name: Upload artifact | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: katago-linux-opencl | |
| path: cpp/katago | |
| build-macos: | |
| runs-on: macos-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| brew install zlib libzip opencl-headers | |
| - name: Cache CMake build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| cpp/CMakeCache.txt | |
| cpp/CMakeFiles | |
| cpp/build.ninja | |
| cpp/.ninja_deps | |
| cpp/.ninja_log | |
| key: ${{ runner.os }}-cmake-${{ hashFiles('**/CMakeLists.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cmake- | |
| - name: Configure CMake | |
| working-directory: cpp | |
| run: | | |
| cmake . -G Ninja -DUSE_BACKEND=OPENCL -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| working-directory: cpp | |
| run: | | |
| ninja | |
| - name: Run tests | |
| working-directory: cpp | |
| run: | | |
| ./katago runtests | |
| - name: Upload artifact | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: katago-macos-opencl | |
| path: cpp/katago | |
| build-macos-metal: | |
| runs-on: macos-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| brew install ninja zlib libzip protobuf abseil | |
| # The CMake build (build.ninja, CMakeCache.txt) bakes in version-pinned | |
| # Homebrew Cellar paths for protobuf/abseil (e.g. | |
| # -L/opt/homebrew/Cellar/protobuf/34.1/lib). When Homebrew bumps those | |
| # the cached paths go stale and the link fails. | |
| # Capture the installed versions into the cache key so | |
| # a formula bump invalidates the cache and forces a fresh configure. | |
| - name: Capture dependency versions for cache key | |
| id: dep-versions | |
| run: | | |
| echo "versions=$(brew list --versions protobuf abseil | tr '\n' '-')" >> "$GITHUB_OUTPUT" | |
| - name: Cache CMake build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| cpp/CMakeCache.txt | |
| cpp/CMakeFiles | |
| cpp/build.ninja | |
| cpp/.ninja_deps | |
| cpp/.ninja_log | |
| key: ${{ runner.os }}-cmake-metal-${{ steps.dep-versions.outputs.versions }}-${{ hashFiles('**/CMakeLists.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cmake-metal-${{ steps.dep-versions.outputs.versions }}- | |
| - name: Configure CMake | |
| working-directory: cpp | |
| run: | | |
| cmake . -G Ninja -DUSE_BACKEND=METAL -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| working-directory: cpp | |
| run: | | |
| ninja | |
| - name: Run tests | |
| working-directory: cpp | |
| run: | | |
| ./katago runtests | |
| - name: Upload artifact | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: katago-macos-metal | |
| path: cpp/katago | |
| build-windows: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup MSVC | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Cache vcpkg packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ env.VCPKG_INSTALLATION_ROOT }}/installed | |
| ${{ env.VCPKG_INSTALLATION_ROOT }}/packages | |
| key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }}-opencl | |
| restore-keys: | | |
| ${{ runner.os }}-vcpkg- | |
| - name: Install vcpkg dependencies | |
| run: | | |
| vcpkg install zlib:x64-windows libzip:x64-windows opencl:x64-windows | |
| - name: Configure CMake | |
| working-directory: cpp | |
| run: | | |
| cmake . -A x64 ` | |
| -DUSE_BACKEND=OPENCL ` | |
| -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" | |
| - name: Build | |
| working-directory: cpp | |
| run: | | |
| cmake --build . --config Release -j 4 | |
| - name: Copy required DLLs | |
| working-directory: cpp | |
| run: | | |
| $vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT | |
| Copy-Item "$vcpkgRoot/installed/x64-windows/bin/*.dll" -Destination "Release/" | |
| - name: Run tests | |
| working-directory: cpp | |
| run: | | |
| Release/katago.exe runtests | |
| - name: Upload artifact | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: katago-windows-opencl | |
| path: cpp/Release/ |