forked from baidu/braft
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (78 loc) · 2.58 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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