Skip to content

[thirdparty] support import brpc and gtest lib from cmake #55

[thirdparty] support import brpc and gtest lib from cmake

[thirdparty] support import brpc and gtest lib from cmake #55

Workflow file for this run

name: ci
on: [push, pull_request]
permissions:
contents: read
jobs:
build-and-test:
name: >-
CI
${{ matrix.os }}
${{ matrix.compiler }}
${{ matrix.build_tool}}
unittest ${{ matrix.with_test }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
compiler: [clang, gcc]
os: [ubuntu-20.04]
build_tool: [cmake, bazel]
with_test: [true, false]
exclude:
# Not support test using bazel
- build_tool: bazel
with_test: true
- build_tool: cmake
with_test: false
include:
- compiler: clang
CC: clang
CXX: clang++
- compiler: gcc
CC: gcc
CXX: g++
env:
CMAKE_BUILD_DIR: ${{ github.workspace }}/bld
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install dependencies on Linux
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install -qq libgflags-dev \
libprotobuf-dev libprotoc-dev protobuf-compiler \
libleveldb-dev libgoogle-perftools-dev
sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo env "PATH=$PATH" cmake . && sudo make && sudo mv ./lib/libgtest* /usr/lib/
- name: Install bazel
if: ${{ matrix.build_tool == 'bazel' }}
run: |
sudo apt-get install python-dev
wget https://github.com/bazelbuild/bazel/releases/download/0.25.2/bazel-0.25.2-installer-linux-x86_64.sh
chmod a+x bazel-0.25.2-installer-linux-x86_64.sh
./bazel-0.25.2-installer-linux-x86_64.sh --user
export PATH="$PATH:$HOME/bin"
- name: Build with cmake
if: ${{ matrix.build_tool == 'cmake' }}
run: |
cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" -DBUILD_UNIT_TESTS=ON
cmake --build "${{ env.CMAKE_BUILD_DIR }}"
- name: Build with bazel
if: ${{ matrix.build_tool == 'bazel' }}
run: |
~/.bazel/bin/bazel build -c opt --copt -DHAVE_ZLIB=1 //...
- name: Run Tests
if: ${{ matrix.with_test }}
id: test-braft
working-directory: ${{ github.workspace }}/bld/test
run: |
ulimit -c unlimited -S
sh ../../test/run_tests.sh
- name: Collect failure info
if: ${{ steps.test-braft.conclusion == 'failure'}}
run: |
COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1)
gdb -c "$COREFILE" example -ex "thread apply all bt" -ex "set pagination 0" -batch