Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Unittest for Linux workflow #2016

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 100 additions & 5 deletions .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
proc_num: $(nproc)

jobs:
compile-with-make:
gcc-compile-with-make:
runs-on: ubuntu-latest # https://github.com/actions/runner-images

steps:
Expand All @@ -19,14 +19,84 @@ jobs:
- name: install dependences
run: |
sudo apt-get install -y git g++ make libssl-dev libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev libgoogle-perftools-dev
- name: config_brpc
- name: config brpc
run: |
./config_brpc.sh --header="/usr/local/include /usr/include" --libs="/usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64"
- name: compile
run: |
make -j ${{env.proc_num}}

gcc-compile-with-cmake:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: install dependences
run: |
sudo apt-get install -y git g++ make libssl-dev libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev
- name: cmake
run: |
mkdir build
cd build
cmake ..
- name: compile
run: |
cd build
make -j ${{env.proc_num}}

gcc-compile-with-bazel:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: install dependences
run: |
sudo apt-get update
sudo apt-get install libibverbs-dev
- name: compile
run: |
bazel build -j ${{env.proc_num}} -c opt --copt -DHAVE_ZLIB=1 //...
gcc-unittest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: install dependences
run: |
sudo apt-get install -y git g++ make libssl-dev libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev libgoogle-perftools-dev
sudo apt-get install -y cmake libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv lib/libgtest* /usr/lib/
- name: config brpc
run: |
./config_brpc.sh --header="/usr/local/include /usr/include" --libs="/usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64" --cc=gcc --cxx=g++
- name: compile
run: |
cd test
make -j ${{env.proc_num}}
- name: run tests
run: |
cd test
sh ./run_tests.sh


compile-with-cmake:
clang-compile-with-make:
runs-on: ubuntu-latest # https://github.com/actions/runner-images

steps:
- uses: actions/checkout@v2

- name: install dependences
run: |
sudo apt-get install -y git g++ make libssl-dev libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev libgoogle-perftools-dev
- name: config brpc
run: |
./config_brpc.sh --header="/usr/local/include /usr/include" --libs="/usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64" --nodebugsymbols --cxx=clang++ --cc=clang
- name: compile
run: |
make -j ${{env.proc_num}}

clang-compile-with-cmake:
runs-on: ubuntu-latest

steps:
Expand All @@ -37,15 +107,17 @@ jobs:
sudo apt-get install -y git g++ make libssl-dev libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev
- name: cmake
run: |
export CC=clang
export CXX=clang++
mkdir build
cd build
cmake ..
- name: compile
run: |
cd build
make -j ${{env.proc_num}}
compile-with-bazel:

clang-compile-with-bazel:
runs-on: ubuntu-latest

steps:
Expand All @@ -57,4 +129,27 @@ jobs:
sudo apt-get install libibverbs-dev
- name: compile
run: |
export CC=clang
export CXX=clang++
bazel build -j ${{env.proc_num}} -c opt --copt -DHAVE_ZLIB=1 //...

clang-unittest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: install dependences
run: |
sudo apt-get install -y git g++ make libssl-dev libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev libgoogle-perftools-dev
sudo apt-get install -y cmake libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv lib/libgtest* /usr/lib/
- name: config brpc
run: |
./config_brpc.sh --header="/usr/local/include /usr/include" --libs="/usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64" --cc=clang --cxx=clang++
- name: compile
run: |
cd test
make -j ${{env.proc_num}}
- name: run tests
run: |
cd test
sh ./run_tests.sh
4 changes: 2 additions & 2 deletions docs/cn/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ brpc有如下依赖:
* [Fedora/CentOS](#fedoracentos)
* [自己构建依赖的Linux](#自己构建依赖的Linux)
* [MacOS](#macos)
* [docker][#docker]
* [docker](#docker)

## Ubuntu/LinuxMint/WSL
### 依赖准备
Expand All @@ -38,7 +38,7 @@ sudo apt-get install -y libgoogle-perftools-dev

如果你要运行测试,那么要安装并编译libgtest-dev(它没有被默认编译):
```shell
sudo apt-get install -y cmake libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libgtest* /usr/lib/ && cd -
sudo apt-get install -y cmake libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv lib/libgtest* /usr/lib/ && cd -
```
gtest源码目录可能变动,如果`/usr/src/gtest`不存在,请尝试`/usr/src/googletest/googletest`。

Expand Down
2 changes: 1 addition & 1 deletion docs/cn/mbvar_c++.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class MVariable {
};
```

最常见的导出需求是通过HTTP接口查询和写入本地文件,多维度统计暂时不提供HTTP接口方式查询,后者已经在bvar中实现了,由用户选择开启,该功能由下面5个gflags控制,你的程序需要使用gflags。
最常见的导出需求是通过HTTP接口查询和写入本地文件,多维度统计支持通过内置服务`/brpc_metrics`接口方式查询。也支持写入本地文件,该功能由下面5个gflags控制,你的程序需要使用gflags。

| 名称 | 默认值 | 描述 |
| ------ | ------ | ------ |
Expand Down
2 changes: 1 addition & 1 deletion docs/en/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ sudo apt-get install -y libgoogle-perftools-dev

If you need to run tests, install and compile libgtest-dev (which is not compiled yet):
```shell
sudo apt-get install -y cmake libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libgtest* /usr/lib/ && cd -
sudo apt-get install -y cmake libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv lib/libgtest* /usr/lib/ && cd -
```
The directory of gtest source code may be changed, try `/usr/src/googletest/googletest` if `/usr/src/gtest` is not there.

Expand Down