You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by ji...@apache.org on 2022/11/27 19:03:57 UTC

[incubator-brpc] branch master updated: Support all compile options and unittest for Linux workflow (#2018)

This is an automated email from the ASF dual-hosted git repository.

jiashunzhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 1936db9c Support all compile options and unittest for Linux workflow (#2018)
1936db9c is described below

commit 1936db9ce2d0e35fba2cfed7a1c1a25975ddd30f
Author: 果冻虾仁 <gu...@apache.org>
AuthorDate: Mon Nov 28 03:03:48 2022 +0800

    Support all compile options and unittest for Linux workflow (#2018)
    
    Support all compile options and unittest for Linux workflow #2018
---
 .github/actions/init-make-config/action.yml        |   9 +
 .github/actions/install-all-dependences/action.yml |  10 ++
 .../install-essential-dependences/action.yml       |   7 +
 .github/workflows/ci-linux.yml                     | 196 +++++++++++++++++++++
 .github/workflows/{ci_macos.yml => ci-macos.yml}   |   0
 .github/workflows/ci_linux.yml                     | 114 ------------
 Makefile                                           |   3 +
 7 files changed, 225 insertions(+), 114 deletions(-)

diff --git a/.github/actions/init-make-config/action.yml b/.github/actions/init-make-config/action.yml
new file mode 100644
index 00000000..05e8a92a
--- /dev/null
+++ b/.github/actions/init-make-config/action.yml
@@ -0,0 +1,9 @@
+inputs:
+  options:
+    description: extra options for config_brpc.sh
+    required: false
+runs:
+  using: "composite"
+  steps:
+    - run: sh config_brpc.sh --headers="/usr/local/include /usr/include" --libs="/usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64" --nodebugsymbols ${{inputs.options}}
+      shell: bash
diff --git a/.github/actions/install-all-dependences/action.yml b/.github/actions/install-all-dependences/action.yml
new file mode 100644
index 00000000..dee35111
--- /dev/null
+++ b/.github/actions/install-all-dependences/action.yml
@@ -0,0 +1,10 @@
+runs:
+  using: "composite"
+  steps:
+    - uses: ./.github/actions/install-essential-dependences
+    - run: sudo apt-get install -y libgoogle-glog-dev automake bison flex libboost-all-dev libevent-dev libtool pkg-config
+      shell: bash
+    - run: wget https://archive.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz && tar -xf thrift-0.11.0.tar.gz
+      shell: bash
+    - run: cd thrift-0.11.0/ && ./configure --prefix=/usr --with-rs=no --with-ruby=no --with-python=no --with-java=no --with-go=no --with-perl=no --with-php=no --with-csharp=no --with-erlang=no --with-lua=no --with-nodejs=no --with-haskell=no --with-dotnetcore=no CXXFLAGS="-Wno-unused-variable" && make -j $(nproc) && sudo make install
+      shell: bash
diff --git a/.github/actions/install-essential-dependences/action.yml b/.github/actions/install-essential-dependences/action.yml
new file mode 100644
index 00000000..4b3249d8
--- /dev/null
+++ b/.github/actions/install-essential-dependences/action.yml
@@ -0,0 +1,7 @@
+runs:
+  using: "composite"
+  steps:
+    - run: ulimit -c unlimited -S && sudo bash -c "echo 'core.%e.%p' > /proc/sys/kernel/core_pattern"
+      shell: bash
+    - run: sudo apt-get install -y git g++ make libssl-dev libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev libgoogle-perftools-dev
+      shell: bash
diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml
new file mode 100644
index 00000000..34e0cccc
--- /dev/null
+++ b/.github/workflows/ci-linux.yml
@@ -0,0 +1,196 @@
+name: Build and Test on Linux
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    branches: [ master ]
+
+env:
+  proc_num: $(nproc)
+
+jobs:
+  gcc-compile-with-make:
+    runs-on: ubuntu-latest # https://github.com/actions/runner-images
+    steps:
+    - uses: actions/checkout@v2
+    - uses: ./.github/actions/install-essential-dependences
+    - uses: ./.github/actions/init-make-config
+      with:
+        options: --cc=gcc --cxx=g++
+    - name: compile
+      run: |
+           make -j ${{env.proc_num}}
+
+  gcc-compile-with-cmake:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: ./.github/actions/install-essential-dependences
+    - name: cmake 
+      run: |
+           export CC=gcc && export CXX=g++
+           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: |
+           export CC=gcc && export CXX=g++
+           bazel build -j ${{env.proc_num}} -c opt --copt -DHAVE_ZLIB=1 //...
+
+  gcc-compile-with-make-all-options:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: ./.github/actions/install-all-dependences
+    - uses: ./.github/actions/init-make-config
+      with:
+        options: --cc=gcc --cxx=g++ --with-thrift --with-glog
+    - name: compile
+      run: |
+           make -j ${{env.proc_num}}
+
+  gcc-compile-with-cmake-all-options:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: ./.github/actions/install-all-dependences
+    - name: cmake 
+      run: |
+           export CC=gcc && export CXX=g++
+           mkdir build
+           cd build
+           cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON ..
+    - name: compile
+      run: |
+           cd build
+           make -j ${{env.proc_num}}
+
+  gcc-compile-with-bazel-all-options:
+    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: |
+           export CC=gcc && export CXX=g++
+           bazel build -j 12 -c opt --define with_mesalink=false --define with_glog=true --define with_thrift=true --copt -DHAVE_ZLIB=1 //...
+
+
+  clang-compile-with-make:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: ./.github/actions/install-essential-dependences
+    - uses: ./.github/actions/init-make-config
+      with:
+        options: --cc=clang --cxx=clang++
+    - name: compile
+      run: |
+           make -j ${{env.proc_num}}
+
+  clang-compile-with-cmake:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: ./.github/actions/install-essential-dependences
+    - name: cmake 
+      run: |
+           export CC=clang && export CXX=clang++
+           mkdir build
+           cd build
+           cmake ..
+    - name: compile
+      run: |
+           cd build
+           make -j ${{env.proc_num}}
+
+  clang-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: |
+           export CC=clang && export CXX=clang++
+           bazel build -j ${{env.proc_num}} -c opt --copt -DHAVE_ZLIB=1 //...
+
+  clang-compile-with-make-all-options:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: ./.github/actions/install-all-dependences
+    - uses: ./.github/actions/init-make-config
+      with:
+        options: --cc=clang --cxx=clang++ --with-thrift --with-glog
+    - name: compile
+      run: |
+           make -j ${{env.proc_num}}
+
+  clang-compile-with-cmake-all-options:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: ./.github/actions/install-all-dependences
+    - name: cmake 
+      run: |
+           export CC=clang && export CXX=clang++
+           mkdir build
+           cd build
+           cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON ..
+    - name: compile
+      run: |
+           cd build
+           make -j ${{env.proc_num}}
+
+  clang-compile-with-bazel-all-options:
+    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: |
+           export CC=clang && export CXX=clang++
+           bazel build -j ${{env.proc_num}} -c opt --define with_mesalink=false --define with_glog=true --define with_thrift=true --copt -DHAVE_ZLIB=1 //...
+
+  clang-unittest:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - uses: ./.github/actions/install-essential-dependences
+    - name: install gtest
+      run: |
+           sudo apt-get install -y cmake libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv lib/libgtest* /usr/lib/
+    - uses: ./.github/actions/init-make-config
+      with:
+        options: --cc=clang --cxx=clang++
+    - name: compile tests
+      run: |
+           cd test
+           make -j ${{env.proc_num}}
+    - name: run tests
+      run: |
+           cd test
+           sh ./run_tests.sh
diff --git a/.github/workflows/ci_macos.yml b/.github/workflows/ci-macos.yml
similarity index 100%
rename from .github/workflows/ci_macos.yml
rename to .github/workflows/ci-macos.yml
diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml
deleted file mode 100644
index 8e9aa807..00000000
--- a/.github/workflows/ci_linux.yml
+++ /dev/null
@@ -1,114 +0,0 @@
-name: Build and Test on Linux
-
-on:
-  push:
-    branches: [ master ]
-  pull_request:
-    branches: [ master ]
-
-env:
-  proc_num: $(nproc)
-
-jobs:
-  gcc-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"
-    - 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 //...
-
-   
-  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:
-    - 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: |
-           export CC=clang
-           export CXX=clang++
-           mkdir build
-           cd build
-           cmake ..
-    - name: compile
-      run: |
-           cd build
-           make -j ${{env.proc_num}}
-
-  clang-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: |
-           export CC=clang
-           export CXX=clang++
-           bazel build -j ${{env.proc_num}} -c opt --copt -DHAVE_ZLIB=1 //...
diff --git a/Makefile b/Makefile
index d707c5fa..574c63bb 100644
--- a/Makefile
+++ b/Makefile
@@ -294,6 +294,9 @@ output/bin:protoc-gen-mcpack
 	@echo "> Generating $@"
 	$(PROTOC) --cpp_out=./src --proto_path=./src --proto_path=$(PROTOBUF_HDR) $<
 
+src/mcpack2pb/generator.o:src/mcpack2pb/generator.cpp src/idl_options.pb.h
+	$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@
+
 %.o:%.cpp
 	@echo "> Compiling $@"
 	$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org