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
14 changes: 14 additions & 0 deletions .github/actions/compile-with-bazel-protobuf/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
inputs:
protobuf-version:
description: version of protobuf
required: true
env:
description: action environment
required: false
runs:
using: "composite"
steps:
- run: |
bash ./.github/actions/compile-with-bazel-protobuf/change_bzlmod_protobuf_version.sh ${{inputs.protobuf-version}}
bazel build --verbose_failures --action_env="${{inputs.env}}" -- //... -//example/...
shell: bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#!/bin/bash


if [ $# -ne 1 ]; then
echo 'Usage: $0 <new_version>'
echo 'Example: $0 21.7'
exit 1
fi

NEW_VERSION="$1"
MODULE_FILE='MODULE.bazel'

if [ ! -f "$MODULE_FILE" ]; then
echo "Error: $MODULE_FILE not found"
exit 1
fi

TEMP_FILE=$(mktemp)

# Scan file to find relevant lines.
bazel_dep_line_num=0
override_exists=false
current_line_num=0

echo "Scanning $MODULE_FILE..."

while read -r line; do
current_line_num=$((current_line_num + 1))

# Skip comment lines.
if [[ "$line" =~ ^[[:space:]]*# ]]; then
continue
fi

# Check if this is protobuf bazel_dep line.
if [[ "$line" =~ bazel_dep.*name[[:space:]]*=[[:space:]]*[\'\"]*protobuf[\'\"]*.*version ]]; then
bazel_dep_line_num=$current_line_num
echo "Found bazel_dep for protobuf at line $current_line_num"
fi

# Check if protobuf single_version_override exists.
if [[ "$line" =~ single_version_override.*module_name[[:space:]]*=[[:space:]]*[\'\"]*protobuf[\'\"]*.*version ]]; then
override_exists=true
echo "Found existing single_version_override for protobuf at line $current_line_num"
fi
done < "$MODULE_FILE"

# If bazel_dep protobuf line not found, returns error.
if [ "$bazel_dep_line_num" -eq 0 ]; then
echo 'Error: bazel_dep for protobuf not found in MODULE.bazel'
exit 1
fi

# Process file.
echo "Processing $MODULE_FILE..."
current_line_num=0
while read -r line; do
current_line_num=$((current_line_num + 1))

# If this is single_version_override protobuf line and not a comment, replace version
if [[ "$line" =~ single_version_override.*module_name[[:space:]]*=[[:space:]]*[\'\"]*protobuf[\'\"]*.*version ]] && ! [[ "$line" =~ ^[[:space:]]*# ]]; then
# Replace version using single quote format uniformly
new_line=$(echo "$line" | sed "s/version[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]/version = '$NEW_VERSION'/")
echo "$new_line"
else
echo "$line"
# If no override exists and current line is bazel_dep protobuf, add single_version_override after it
if [ "$override_exists" = false ] && [ "$current_line_num" -eq "$bazel_dep_line_num" ]; then
echo "single_version_override(module_name = 'protobuf', version = '$NEW_VERSION')"
fi
fi
done < "$MODULE_FILE" > "$TEMP_FILE"

# Replace original file directly
mv "$TEMP_FILE" "$MODULE_FILE"

echo "Successfully updated protobuf version to $NEW_VERSION in $MODULE_FILE"

cat "$MODULE_FILE"

# Clean up temporary file
trap "rm -f $TEMP_FILE" EXIT
251 changes: 62 additions & 189 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,222 +15,95 @@ env:

# https://github.com/actions/runner-images
jobs:
compile-with-make:
gcc-compile-with-bazel:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-all-dependencies

- name: gcc with default options
uses: ./.github/actions/compile-with-make
- name: protobuf 23.1
uses: ./.github/actions/compile-with-bazel-protobuf
with:
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=gcc --cxx=g++ --werror
protobuf-version: 23.1
env: CC=gcc

- name: gcc with all options
uses: ./.github/actions/compile-with-make
- name: protobuf 24.4
uses: ./.github/actions/compile-with-bazel-protobuf
with:
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=gcc --cxx=g++ --werror --with-thrift --with-glog --with-rdma --with-debug-bthread-sche-safety --with-debug-lock --with-bthread-tracer --with-asan
protobuf-version: 24.4
env: CC=gcc

- name: clang with default options
uses: ./.github/actions/compile-with-make
- name: protobuf 25.5
uses: ./.github/actions/compile-with-bazel-protobuf
with:
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=clang --cxx=clang++ --werror
protobuf-version: 25.5
env: CC=gcc

- name: clang with all options
uses: ./.github/actions/compile-with-make
- name: protobuf 27.5
uses: ./.github/actions/compile-with-bazel-protobuf
with:
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=clang --cxx=clang++ --werror --with-thrift --with-glog --with-rdma --with-debug-bthread-sche-safety --with-debug-lock --with-bthread-tracer --with-asan

compile-with-cmake:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-all-dependencies

- name: gcc with default options
run: |
export CC=gcc && export CXX=g++
mkdir gcc_build && cd gcc_build && cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
make -j ${{env.proc_num}} && make clean

- name: gcc with all options
run: |
export CC=gcc && export CXX=g++
mkdir gcc_build_all && cd gcc_build_all
cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON -DWITH_RDMA=ON -DWITH_DEBUG_BTHREAD_SCHE_SAFETY=ON -DWITH_DEBUG_LOCK=ON -DWITH_BTHREAD_TRACER=ON -DWITH_ASAN=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
make -j ${{env.proc_num}} && make clean

- name: clang with default options
run: |
export CC=clang && export CXX=clang++
mkdir clang_build && cd clang_build && cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
make -j ${{env.proc_num}} && make clean

- name: clang with all options
run: |
export CC=clang && export CXX=clang++
mkdir clang_build_all && cd clang_build_all
cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON -DWITH_RDMA=ON -DWITH_DEBUG_BTHREAD_SCHE_SAFETY=ON -DWITH_DEBUG_LOCK=ON -DWITH_BTHREAD_TRACER=ON -DWITH_ASAN=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
make -j ${{env.proc_num}} && make clean

gcc-compile-with-make-protobuf:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-essential-dependencies
protobuf-version: 27.5
env: CC=gcc

- name: protobuf 3.5.1
uses: ./.github/actions/compile-with-make-protobuf
- name: protobuf 28.3
uses: ./.github/actions/compile-with-bazel-protobuf
with:
protobuf-version: 3.5.1
protobuf-cpp-version: 3.5.1
protobuf-install-dir: /protobuf-3.5.1
config-brpc-options: --cc=gcc --cxx=g++ --werror
protobuf-version: 28.3
env: CC=gcc

- name: protobuf 3.12.4
uses: ./.github/actions/compile-with-make-protobuf
- name: protobuf 29.5
uses: ./.github/actions/compile-with-bazel-protobuf
with:
protobuf-version: 3.12.4
protobuf-cpp-version: 3.12.4
protobuf-install-dir: /protobuf-3.12.4
config-brpc-options: --cc=gcc --cxx=g++ --werror
protobuf-version: 29.5
env: CC=gcc

- name: protobuf 21.12
uses: ./.github/actions/compile-with-make-protobuf
- name: protobuf 30.2
uses: ./.github/actions/compile-with-bazel-protobuf
with:
protobuf-version: 21.12
protobuf-cpp-version: 3.21.12
protobuf-install-dir: /protobuf-3.21.12
config-brpc-options: --cc=gcc --cxx=g++ --werror
protobuf-version: 30.2
env: CC=gcc

gcc-compile-with-bazel:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: bazel build --verbose_failures -- //... -//example/...

gcc-compile-with-boringssl:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: bazel build --verbose_failures --define with_mesalink=false --define with_glog=true --define with_thrift=true --define BRPC_WITH_BORINGSSL=true -- //... -//example/...

gcc-compile-with-bazel-all-options:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: |
bazel build --verbose_failures \
--define with_mesalink=false \
--define with_glog=true \
--define with_thrift=true \
--define with_debug_bthread_sche_safety=true \
--define with_debug_lock=true \
--define with_asan=true \
--define with_bthread_tracer=true \
--define BRPC_WITH_NO_PTHREAD_MUTEX_HOOK=true \
-- //... -//example/...

clang-compile-with-make-protobuf:
clang-compile-with-bazel:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-essential-dependencies

- name: protobuf 3.5.1
uses: ./.github/actions/compile-with-make-protobuf
- name: protobuf 23.1
uses: ./.github/actions/compile-with-bazel-protobuf
with:
protobuf-version: 3.5.1
protobuf-cpp-version: 3.5.1
protobuf-install-dir: /protobuf-3.5.1
config-brpc-options: --cc=clang --cxx=clang++ --werror
protobuf-version: 23.1
env: CC=clang

- name: protobuf 3.12.4
uses: ./.github/actions/compile-with-make-protobuf
- name: protobuf 24.4
uses: ./.github/actions/compile-with-bazel-protobuf
with:
protobuf-version: 3.12.4
protobuf-cpp-version: 3.12.4
protobuf-install-dir: /protobuf-3.12.4
config-brpc-options: --cc=clang --cxx=clang++ --werror
protobuf-version: 24.4
env: CC=clang

- name: protobuf 21.12
uses: ./.github/actions/compile-with-make-protobuf
- name: protobuf 25.5
uses: ./.github/actions/compile-with-bazel-protobuf
with:
protobuf-version: 21.12
protobuf-cpp-version: 3.21.12
protobuf-install-dir: /protobuf-3.21.12
config-brpc-options: --cc=clang --cxx=clang++ --werror
protobuf-version: 25.5
env: CC=clang

clang-compile-with-bazel:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: bazel build --verbose_failures --action_env=CC=clang -- //... -//example/...
- name: protobuf 27.5
uses: ./.github/actions/compile-with-bazel-protobuf
with:
protobuf-version: 27.5
env: CC=clang

clang-compile-with-boringssl:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: bazel build --verbose_failures --action_env=CC=clang --define with_mesalink=false --define with_glog=true --define with_thrift=true --define BRPC_WITH_BORINGSSL=true -- //... -//example/...
- name: protobuf 28.3
uses: ./.github/actions/compile-with-bazel-protobuf
with:
protobuf-version: 28.3
env: CC=clang

clang-compile-with-bazel-all-options:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: |
bazel build --verbose_failures \
--action_env=CC=clang \
--define with_mesalink=false \
--define with_glog=true \
--define with_thrift=true \
--define with_debug_bthread_sche_safety=true \
--define with_debug_lock=true \
--define with_asan=true \
--define with_bthread_tracer=true \
--define BRPC_WITH_NO_PTHREAD_MUTEX_HOOK=true \
-- //... -//example/...

clang-unittest:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-essential-dependencies
- uses: ./.github/actions/init-ut-make-config
- name: protobuf 29.5
uses: ./.github/actions/compile-with-bazel-protobuf
with:
options: --with-bthread-tracer
- name: compile tests
run: |
cat config.mk
cd test
make -j ${{env.proc_num}}
- name: run tests
run: |
cd test
sh ./run_tests.sh

clang-unittest-asan:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-essential-dependencies
- uses: ./.github/actions/init-ut-make-config
protobuf-version: 29.5
env: CC=clang

- name: protobuf 30.2
uses: ./.github/actions/compile-with-bazel-protobuf
with:
options: --with-bthread-tracer --with-asan
- name: compile tests
run: |
cat config.mk
cd test
make NEED_GPERFTOOLS=0 -j ${{env.proc_num}}
- name: run tests
run: |
cd test
sh ./run_tests.sh

bazel-bvar-unittest:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: bazel test --verbose_failures //test:bvar_test
- run: bazel test --verbose_failures --define with_babylon_counter=true //test:bvar_test
- run: bazel test --verbose_failures --action_env=CC=clang //test:bvar_test
- run: bazel test --verbose_failures --action_env=CC=clang --define with_babylon_counter=true //test:bvar_test
protobuf-version: 30.2
env: CC=clang

Loading
Loading