Skip to content
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
455 changes: 455 additions & 0 deletions .github/scripts/flatbuffers-on.py

Large diffs are not rendered by default.

351 changes: 351 additions & 0 deletions .github/scripts/test_flatbuffers_on.py

Large diffs are not rendered by default.

130 changes: 130 additions & 0 deletions .github/workflows/flatbuffers-on.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: FlatBuffers ON

on:
push:
branches: [master]
paths:
- 'src/brpc/flatbuffers/**'
- 'src/brpc/policy/flatbuffers_protocol.*'
- 'src/brpc/channel.*'
- 'src/brpc/controller.*'
- 'src/brpc/server.*'
- 'src/brpc/global.cpp'
- 'src/brpc/options.proto'
- 'src/brpc/details/*_private_accessor.h'
- 'test/*flatbuffers*'
- 'test/CMakeLists.txt'
- 'test/Makefile'
- 'test/BUILD.bazel'
- 'tools/flatbuffers/**'
- 'example/benchmark_fb/**'
- 'CMakeLists.txt'
- 'src/**/CMakeLists.txt'
- 'Makefile'
- 'config_brpc.sh'
- 'BUILD.bazel'
- 'MODULE.bazel'
- 'WORKSPACE'
- '.github/scripts/*flatbuffers*'
- '.github/workflows/flatbuffers-on.yml'
pull_request:
paths:
- 'src/brpc/flatbuffers/**'
- 'src/brpc/policy/flatbuffers_protocol.*'
- 'src/brpc/channel.*'
- 'src/brpc/controller.*'
- 'src/brpc/server.*'
- 'src/brpc/global.cpp'
- 'src/brpc/options.proto'
- 'src/brpc/details/*_private_accessor.h'
- 'test/*flatbuffers*'
- 'test/CMakeLists.txt'
- 'test/Makefile'
- 'test/BUILD.bazel'
- 'tools/flatbuffers/**'
- 'example/benchmark_fb/**'
- 'CMakeLists.txt'
- 'src/**/CMakeLists.txt'
- 'Makefile'
- 'config_brpc.sh'
- 'BUILD.bazel'
- 'MODULE.bazel'
- 'WORKSPACE'
- '.github/scripts/*flatbuffers*'
- '.github/workflows/flatbuffers-on.yml'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build-test:
name: FB ON (${{ matrix.os }}, ${{ matrix.system }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
max-parallel: 2
matrix:
include:
- {os: ubuntu-22.04, system: cmake, compiler: gcc, cc: gcc, cxx: g++, cache: ccache}
- {os: ubuntu-22.04, system: cmake, compiler: clang, cc: clang, cxx: clang++, cache: ccache}
- {os: ubuntu-22.04, system: make, compiler: gcc, cc: gcc, cxx: g++, cache: ccache}
- {os: ubuntu-22.04, system: make, compiler: clang, cc: clang, cxx: clang++, cache: ccache}
- {os: ubuntu-22.04, system: bazel, compiler: gcc, cc: gcc, cxx: g++, cache: bazel}
- {os: macos-latest, system: cmake, compiler: apple-clang, cc: clang, cxx: clang++, cache: ccache}
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
FB_WORK: ${{ runner.temp }}/brpc-fb-${{ matrix.system }}-${{ matrix.compiler }}
BUILD_SYSTEM: ${{ matrix.system }}
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false

- name: Validate the gate's report checks
run: python3 .github/scripts/test_flatbuffers_on.py

- name: Install focused Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake ninja-build clang ccache pkg-config python3 curl ca-certificates git \
libssl-dev libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler \
libleveldb-dev libgoogle-perftools-dev zlib1g-dev

- name: Install focused macOS dependencies
if: runner.os == 'macOS'
run: brew install cmake ninja pkg-config openssl@3 gflags leveldb protobuf@29 abseil

- uses: ./.github/actions/setup-build-cache
with:
kind: ${{ matrix.cache }}
cache-key: fb-on-${{ matrix.system }}-${{ matrix.compiler }}

- name: Build and run the FB ON gates
shell: bash
run: |
args=(--build-system "$BUILD_SYSTEM" --work "$FB_WORK" --jobs 2)
if [[ "$RUNNER_OS" == macOS ]]; then
for package in protobuf@29 abseil openssl@3 gflags leveldb; do
args+=(--dependency-prefix "$(brew --prefix "$package")")
done
args+=(--protoc "$(brew --prefix protobuf@29)/bin/protoc")
fi
python3 .github/scripts/flatbuffers-on.py "${args[@]}"

- name: Upload commands, logs and test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: flatbuffers-on-${{ matrix.os }}-${{ matrix.system }}-${{ matrix.compiler }}
path: ${{ env.FB_WORK }}/evidence/
if-no-files-found: warn
retention-days: 14
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
/test/output
build/

# Ignore hidden files
# Ignore hidden files, but keep GitHub workflows and helpers discoverable.
.*
!/.github/
/.github/scripts/__pycache__/
*.swp

# Ignore auto-generated files
Expand Down
5 changes: 4 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,10 @@ brpc_proto_library(
visibility = ["//visibility:public"],
)

FLATBUFFERS_SRC_PATTERNS = ["src/brpc/flatbuffers/*.cpp"]
FLATBUFFERS_SRC_PATTERNS = [
"src/brpc/flatbuffers/*.cpp",
"src/brpc/policy/flatbuffers_protocol.cpp",
]

URMA_SRC_PATTERNS = [
"src/brpc/urma/*.cpp",
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ option(WITH_MESALINK "With MesaLink" OFF)
option(WITH_BORINGSSL "With BoringSSL" OFF)
option(WITH_DEBUG_SYMBOLS "With debug symbols" ON)
option(WITH_THRIFT "With thrift framed protocol supported" OFF)
option(WITH_FLATBUFFERS "With FlatBuffers message support (headers only)" OFF)
option(WITH_FLATBUFFERS "With FlatBuffers message and RPC support (headers only)" OFF)
option(WITH_BTHREAD_TRACER "With bthread tracer supported" OFF)
option(WITH_SNAPPY "With snappy" OFF)
option(WITH_RDMA "With RDMA" OFF)
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ BRPC_SOURCES_ALL = $(foreach d,$(BRPC_DIRS),$(wildcard $(addprefix $(d)/*,$(SRCE
ifeq ($(URMA_USE_MOCK),0)
BRPC_SOURCES_ALL := $(filter-out src/brpc/urma/mock_urma.cpp,$(BRPC_SOURCES_ALL))
endif
ifneq ($(WITH_FLATBUFFERS),1)
BRPC_SOURCES_ALL := $(filter-out src/brpc/policy/flatbuffers_protocol.cpp,$(BRPC_SOURCES_ALL))
endif
BRPC_SOURCES = $(filter-out $(THRIFT_SOURCES) $(EXCLUDE_SOURCES), $(BRPC_SOURCES_ALL))
BRPC_PROTOS = $(filter %.proto,$(BRPC_SOURCES))
BRPC_CFAMILIES = $(filter-out %.proto %.pb.cc,$(BRPC_SOURCES))
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ You can use it to:
* Read [overview](docs/en/overview.md) to know where bRPC can be used and its advantages.
* Read [getting started](docs/en/getting_started.md) for building steps and play with [examples](https://github.com/apache/brpc/tree/master/example/).
* Docs:
* [Enable FlatBuffers RPC and verify the example](docs/en/flatbuffers.md)
* [Performance benchmark](docs/en/benchmark.md)
* [bvar](docs/en/bvar.md)
* [bvar_c++](docs/en/bvar_c++.md)
Expand Down
1 change: 1 addition & 0 deletions README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* 通过[概述](docs/cn/overview.md)了解哪里可以用bRPC及其优势。
* 阅读[编译步骤](docs/cn/getting_started.md)了解如何开始使用, 之后可以运行一下[示例程序](https://github.com/apache/brpc/tree/master/example/).
* 文档:
* [启用 FlatBuffers RPC 并通过 example 验证](docs/cn/flatbuffers.md)
* [性能测试](docs/cn/benchmark.md)
* [bvar](docs/cn/bvar.md)
* [bvar_c++](docs/cn/bvar_c++.md)
Expand Down
Loading
Loading