Merge pull request #51 #176
This file contains 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 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
linux: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow_ref }}-${{ github.job }}_${{ matrix.container }}-${{ matrix.compiler }}-${{ matrix.variant }} | |
container: ${{ matrix.container }} | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: | |
- g++ | |
- clang++ | |
container: | |
- ubuntu:24.04 | |
variant: | |
- libuv | |
- asio | |
include: | |
- compiler: g++ | |
dependencies: g++ | |
- compiler: clang++ | |
dependencies: clang | |
- variant: asio | |
cmake_args: -DGRPCXX_USE_ASIO=ON | |
steps: | |
- name: Install dependencies | |
run: | | |
apt-get update | |
apt-get install -y --no-install-recommends \ | |
${{ matrix.dependencies }} \ | |
cmake ninja-build \ | |
libprotobuf-dev libprotoc-dev protobuf-compiler | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: .build | |
key: ${{ runner.arch }}_${{ matrix.container }}-${{ matrix.compiler }}-${{ matrix.variant }}-${{ hashFiles('cmake/dependencies.cmake') }} | |
- name: Configure CMake | |
run: | | |
cmake -B .build -G Ninja \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DGRPCXX_BUILD_TESTING=OFF \ | |
${{ matrix.cmake_args }} | |
- name: Build | |
run: | | |
cmake --build .build --config Release | |
macos: | |
runs-on: macos-latest | |
concurrency: | |
group: ${{ github.workflow_ref }}-${{ github.job }}_${{ matrix.compiler }}-${{ matrix.variant }} | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: | |
- g++ | |
- clang++ | |
variant: | |
- libuv | |
- boost_asio | |
include: | |
- variant: boost_asio | |
cmake_args: -DGRPCXX_USE_ASIO=ON | |
dependencies: boost | |
steps: | |
- name: Install dependencies | |
run: | | |
brew install \ | |
protobuf@3 \ | |
ninja \ | |
${{ matrix.dependencies }} | |
brew link protobuf@3 | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: .build | |
key: ${{ runner.arch }}_${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.variant }}-${{ hashFiles('cmake/dependencies.cmake') }} | |
- name: Configure CMake | |
run: | | |
cmake -B .build -G Ninja \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DGRPCXX_BUILD_TESTING=OFF \ | |
${{ matrix.cmake_args }} | |
- name: Build | |
run: | | |
cmake --build .build --config Release | |
windows: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: | |
- cl | |
variant: | |
# [Nov. 2024] msvc throws C2894 errors when using libuv, need to investigate why | |
# Ref: https://github.com/uatuko/grpcxx/pull/46 | |
# - libuv | |
- asio | |
include: | |
- variant: asio | |
cmake_args: -DGRPCXX_USE_ASIO=ON | |
steps: | |
- uses: actions/cache/restore@v4 | |
id: cache-restore-vcpkg | |
with: | |
path: C:\vcpkg\packages | |
key: ${{ runner.arch }}_${{ runner.os }}-vcpkg-20241101 | |
- name: Install dependencies (choco) | |
run: choco install ninja | |
- name: Install dependencies (vcpkg) | |
if: steps.cache-restore-vcpkg.outputs.cache-hit != 'true' | |
run: vcpkg install protobuf | |
# Always save vcpkg cache if vcpkg install is successful | |
- uses: actions/cache/save@v4 | |
if: always() && steps.cache-restore-vcpkg.outputs.cache-hit != 'true' | |
id: cache-save-vcpkg | |
with: | |
path: C:\vcpkg\packages | |
key: ${{ steps.cache-restore-vcpkg.outputs.cache-primary-key }} | |
# It's not straight forward to setup dev commant prompt to use across steps. Have to find the location and execute | |
# `vcvarsall.bat ${{ runner.arch }}` and "export" env vars set by vcvarsall.bat. | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- uses: actions/checkout@v4 | |
- name: Configure CMake | |
run: | | |
cmake -B .build -G Ninja ` | |
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} ` | |
-DCMAKE_BUILD_TYPE=Release ` | |
-DGRPCXX_BUILD_EXAMPLES=OFF ` | |
-DGRPCXX_BUILD_EXPERIMENTS=OFF ` | |
-DGRPCXX_BUILD_TESTING=OFF ` | |
-DProtobuf_ROOT=C:\vcpkg\packages\protobuf_x64-windows ` | |
-DCMAKE_CXX_FLAGS="-DNGHTTP2_NO_SSIZE_T -IC:\vcpkg\packages\abseil_x64-windows\include" ` | |
${{ matrix.cmake_args }} | |
- name: Build | |
run: cmake --build .build --config Release |