From 89973b83b08ca925b0bc7ec78bbd12ebf0b50833 Mon Sep 17 00:00:00 2001 From: Kevin Li Date: Mon, 1 Jul 2024 19:45:54 +0800 Subject: [PATCH] add example pipeline --- .github/workflows/example.yml | 22 +++++++++++++++++++ example/anyflow/.bazelversion | 2 +- example/anyflow/MODULE.bazel | 2 +- example/depend-use-bzlmod/.bazelversion | 2 +- example/depend-use-bzlmod/MODULE.bazel | 2 +- example/depend-use-bzlmod/README.md | 2 +- example/depend-use-cmake-fetch/CMakeLists.txt | 4 ++-- example/depend-use-cmake-fetch/README.md | 4 ++-- example/depend-use-cmake-find/build.sh | 6 ++--- example/depend-use-cmake-subdir/build.sh | 6 ++--- example/depend-use-workspace/.bazelrc | 2 +- example/depend-use-workspace/.bazelversion | 2 +- example/depend-use-workspace/README.md | 6 ++--- example/depend-use-workspace/WORKSPACE | 20 ++++++++--------- example/depend-use-workspace/build.sh | 2 +- example/use-arena-with-brpc/.bazelrc | 2 +- example/use-arena-with-brpc/.bazelversion | 2 +- example/use-arena-with-brpc/MODULE.bazel | 2 +- example/use-counter-with-bvar/.bazelversion | 2 +- example/use-counter-with-bvar/MODULE.bazel | 3 +-- example/use-with-bthread/.bazelrc | 2 +- example/use-with-bthread/.bazelversion | 2 +- example/use-with-bthread/MODULE.bazel | 2 +- 23 files changed, 60 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/example.yml diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml new file mode 100644 index 00000000..30f56b46 --- /dev/null +++ b/.github/workflows/example.yml @@ -0,0 +1,22 @@ +name: example + +on: + push: + branches: ["main"] + +#drwxrwxr-x 2 oathdruid oathdruid 4096 Jul 1 19:16 anyflow +#drwxrwxr-x 2 oathdruid oathdruid 4096 Jul 1 19:24 depend-use-bzlmod +#drwxrwxr-x 3 oathdruid oathdruid 4096 Jul 1 19:27 depend-use-cmake-fetch +#drwxrwxr-x 2 oathdruid oathdruid 4096 Jul 1 19:28 depend-use-cmake-find +#drwxrwxr-x 2 oathdruid oathdruid 4096 Jul 1 19:28 depend-use-cmake-subdir +#drwxrwxr-x 2 oathdruid oathdruid 4096 Jul 1 19:31 depend-use-workspace +#drwxrwxr-x 2 oathdruid oathdruid 4096 Jul 1 19:32 use-arena-with-brpc +#drwxrwxr-x 3 oathdruid oathdruid 4096 Jul 1 19:42 use-counter-with-bvar +#drwxrwxr-x 2 oathdruid oathdruid 4096 Jul 1 19:42 use-with-bthread + +jobs: + anyflow: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: cd example/anyflow && ./build.sh diff --git a/example/anyflow/.bazelversion b/example/anyflow/.bazelversion index a8a18875..b26a34e4 100644 --- a/example/anyflow/.bazelversion +++ b/example/anyflow/.bazelversion @@ -1 +1 @@ -7.1.2 +7.2.1 diff --git a/example/anyflow/MODULE.bazel b/example/anyflow/MODULE.bazel index 0ef1bf23..127e7433 100644 --- a/example/anyflow/MODULE.bazel +++ b/example/anyflow/MODULE.bazel @@ -1 +1 @@ -bazel_dep(name = 'babylon', version = '1.2.1') +bazel_dep(name = 'babylon', version = '1.2.2') diff --git a/example/depend-use-bzlmod/.bazelversion b/example/depend-use-bzlmod/.bazelversion index a8a18875..b26a34e4 100644 --- a/example/depend-use-bzlmod/.bazelversion +++ b/example/depend-use-bzlmod/.bazelversion @@ -1 +1 @@ -7.1.2 +7.2.1 diff --git a/example/depend-use-bzlmod/MODULE.bazel b/example/depend-use-bzlmod/MODULE.bazel index 0ef1bf23..127e7433 100644 --- a/example/depend-use-bzlmod/MODULE.bazel +++ b/example/depend-use-bzlmod/MODULE.bazel @@ -1 +1 @@ -bazel_dep(name = 'babylon', version = '1.2.1') +bazel_dep(name = 'babylon', version = '1.2.2') diff --git a/example/depend-use-bzlmod/README.md b/example/depend-use-bzlmod/README.md index a77a66ce..04d40b06 100644 --- a/example/depend-use-bzlmod/README.md +++ b/example/depend-use-bzlmod/README.md @@ -15,7 +15,7 @@ common --registry=https://raw.githubusercontent.com/bazelboost/registry/main - 增加依赖项 ``` # in MODULE.bazel -bazel_dep(name = 'babylon', version = '1.2.1') +bazel_dep(name = 'babylon', version = '1.2.2') ``` - 添加依赖的子模块到编译目标,全部可用子模块可以参照[模块功能文档](../../README.md#模块功能文档),或者[BUILD](../../BUILD)文件,也可以直接添加All in One依赖目标`@babylon` diff --git a/example/depend-use-cmake-fetch/CMakeLists.txt b/example/depend-use-cmake-fetch/CMakeLists.txt index 90431884..840aa415 100644 --- a/example/depend-use-cmake-fetch/CMakeLists.txt +++ b/example/depend-use-cmake-fetch/CMakeLists.txt @@ -3,8 +3,8 @@ set(BUILD_DEPS ON) include(FetchContent) FetchContent_Declare( babylon - URL "https://github.com/baidu/babylon/archive/refs/tags/v1.2.1.tar.gz" - URL_HASH SHA256=f5b200d1190d00d9d74519174b38d45a816cd3489a038696c3ae3885ba56d151 + URL "https://github.com/baidu/babylon/archive/refs/tags/v1.2.2.tar.gz" + URL_HASH SHA256=241d0d3e8bf89c9b47765c794aa5153f73b32a7f419c48d8aeeeb4461cf8aec7 ) FetchContent_MakeAvailable(babylon) diff --git a/example/depend-use-cmake-fetch/README.md b/example/depend-use-cmake-fetch/README.md index e3a5ec2a..8b6aaf4b 100644 --- a/example/depend-use-cmake-fetch/README.md +++ b/example/depend-use-cmake-fetch/README.md @@ -10,8 +10,8 @@ set(BUILD_DEPS ON) include(FetchContent) FetchContent_Declare( babylon - URL "https://github.com/baidu/babylon/archive/refs/tags/v1.2.1.tar.gz" - URL_HASH SHA256=f5b200d1190d00d9d74519174b38d45a816cd3489a038696c3ae3885ba56d151 + URL "https://github.com/baidu/babylon/archive/refs/tags/v1.2.2.tar.gz" + URL_HASH SHA256=241d0d3e8bf89c9b47765c794aa5153f73b32a7f419c48d8aeeeb4461cf8aec7 ) FetchContent_MakeAvailable(babylon) ``` diff --git a/example/depend-use-cmake-find/build.sh b/example/depend-use-cmake-find/build.sh index f8cc3c1b..f97ae041 100755 --- a/example/depend-use-cmake-find/build.sh +++ b/example/depend-use-cmake-find/build.sh @@ -5,9 +5,9 @@ set -ex # sudo apt instal boost # sudo apt instal protobuf -URL=https://github.com/baidu/babylon/archive/refs/tags/v1.2.1.tar.gz -NAME=babylon-1.2.1 -SHA256=f5b200d1190d00d9d74519174b38d45a816cd3489a038696c3ae3885ba56d151 +URL=https://github.com/baidu/babylon/archive/refs/tags/v1.2.2.tar.gz +NAME=babylon-1.2.2 +SHA256=241d0d3e8bf89c9b47765c794aa5153f73b32a7f419c48d8aeeeb4461cf8aec7 if ! echo "$SHA256 $NAME.tar.gz" | sha256sum -c; then wget $URL --continue -O $NAME.tar.gz fi diff --git a/example/depend-use-cmake-subdir/build.sh b/example/depend-use-cmake-subdir/build.sh index 3e891ebe..bd19037d 100755 --- a/example/depend-use-cmake-subdir/build.sh +++ b/example/depend-use-cmake-subdir/build.sh @@ -1,9 +1,9 @@ #!/bin/sh set -ex -URL=https://github.com/baidu/babylon/archive/refs/tags/v1.2.1.tar.gz -NAME=babylon-1.2.1 -SHA256=f5b200d1190d00d9d74519174b38d45a816cd3489a038696c3ae3885ba56d151 +URL=https://github.com/baidu/babylon/archive/refs/tags/v1.2.2.tar.gz +NAME=babylon-1.2.2 +SHA256=241d0d3e8bf89c9b47765c794aa5153f73b32a7f419c48d8aeeeb4461cf8aec7 if ! echo "$SHA256 $NAME.tar.gz" | sha256sum -c; then wget $URL --continue -O $NAME.tar.gz fi diff --git a/example/depend-use-workspace/.bazelrc b/example/depend-use-workspace/.bazelrc index 5b3d13f5..a665af1b 100644 --- a/example/depend-use-workspace/.bazelrc +++ b/example/depend-use-workspace/.bazelrc @@ -1 +1 @@ -build --cxxopt=-std=c++17 +build --enable_bzlmod=false --cxxopt=-std=c++17 diff --git a/example/depend-use-workspace/.bazelversion b/example/depend-use-workspace/.bazelversion index a8a18875..b26a34e4 100644 --- a/example/depend-use-workspace/.bazelversion +++ b/example/depend-use-workspace/.bazelversion @@ -1 +1 @@ -7.1.2 +7.2.1 diff --git a/example/depend-use-workspace/README.md b/example/depend-use-workspace/README.md index 21711aa3..fc6dc05c 100644 --- a/example/depend-use-workspace/README.md +++ b/example/depend-use-workspace/README.md @@ -7,9 +7,9 @@ # in WORKSPACE http_archive( name = 'com_baidu_babylon', - urls = ['https://github.com/baidu/babylon/archive/refs/tags/v1.2.1.tar.gz'], - strip_prefix = 'babylon-1.2.1', - sha256 = 'f5b200d1190d00d9d74519174b38d45a816cd3489a038696c3ae3885ba56d151', + urls = ['https://github.com/baidu/babylon/archive/refs/tags/v1.2.2.tar.gz'], + strip_prefix = 'babylon-1.2.2', + sha256 = '241d0d3e8bf89c9b47765c794aa5153f73b32a7f419c48d8aeeeb4461cf8aec7', ) ``` diff --git a/example/depend-use-workspace/WORKSPACE b/example/depend-use-workspace/WORKSPACE index b46ec0d4..5d668e38 100644 --- a/example/depend-use-workspace/WORKSPACE +++ b/example/depend-use-workspace/WORKSPACE @@ -6,9 +6,9 @@ load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') # babylon http_archive( name = 'com_baidu_babylon', - urls = ['https://github.com/baidu/babylon/archive/refs/tags/v1.2.1.tar.gz'], - strip_prefix = 'babylon-1.2.1', - sha256 = 'f5b200d1190d00d9d74519174b38d45a816cd3489a038696c3ae3885ba56d151', + urls = ['https://github.com/baidu/babylon/archive/refs/tags/v1.2.2.tar.gz'], + strip_prefix = 'babylon-1.2.2', + sha256 = '241d0d3e8bf89c9b47765c794aa5153f73b32a7f419c48d8aeeeb4461cf8aec7', ) ################################################################################ @@ -16,18 +16,16 @@ http_archive( # copy from WORKSPACE of babylon http_archive( name = 'com_google_absl', - urls = ['https://github.com/abseil/abseil-cpp/archive/refs/tags/20240116.2.tar.gz'], - strip_prefix = 'abseil-cpp-20240116.2', - sha256 = '733726b8c3a6d39a4120d7e45ea8b41a434cdacde401cba500f14236c49b39dc', + urls = ['https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz'], + strip_prefix = 'abseil-cpp-20211102.0', + sha256 = 'dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4', ) http_archive( name = 'com_google_protobuf', - urls = ['https://github.com/protocolbuffers/protobuf/archive/refs/tags/v25.3.tar.gz'], - strip_prefix = 'protobuf-25.3', - sha256 = 'd19643d265b978383352b3143f04c0641eea75a75235c111cc01a1350173180e', - patches = ['@com_baidu_babylon//:registry/modules/protobuf/25.3.arenastring/patches/arenastring.patch'], - patch_args = ['-p1'], + urls = ['https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.19.6.tar.gz'], + strip_prefix = 'protobuf-3.19.6', + sha256 = '9a301cf94a8ddcb380b901e7aac852780b826595075577bb967004050c835056', ) load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") protobuf_deps() diff --git a/example/depend-use-workspace/build.sh b/example/depend-use-workspace/build.sh index 4c144ae8..111ee566 100755 --- a/example/depend-use-workspace/build.sh +++ b/example/depend-use-workspace/build.sh @@ -1,4 +1,4 @@ #!/bin/sh set -ex -bazel run --enable_bzlmod=false example +bazel run example diff --git a/example/use-arena-with-brpc/.bazelrc b/example/use-arena-with-brpc/.bazelrc index 20b94d4d..948f7ffe 100644 --- a/example/use-arena-with-brpc/.bazelrc +++ b/example/use-arena-with-brpc/.bazelrc @@ -2,4 +2,4 @@ common --registry=https://bcr.bazel.build common --registry=https://baidu.github.io/babylon/registry common --registry=https://raw.githubusercontent.com/bazelboost/registry/main -build --compilation_mode opt --cxxopt=-std=c++17 +build --compilation_mode=opt --copt=-O3 --cxxopt=-std=c++17 diff --git a/example/use-arena-with-brpc/.bazelversion b/example/use-arena-with-brpc/.bazelversion index a8a18875..b26a34e4 100644 --- a/example/use-arena-with-brpc/.bazelversion +++ b/example/use-arena-with-brpc/.bazelversion @@ -1 +1 @@ -7.1.2 +7.2.1 diff --git a/example/use-arena-with-brpc/MODULE.bazel b/example/use-arena-with-brpc/MODULE.bazel index 7b11cc7b..4cc8799c 100644 --- a/example/use-arena-with-brpc/MODULE.bazel +++ b/example/use-arena-with-brpc/MODULE.bazel @@ -1,4 +1,4 @@ -bazel_dep(name = 'babylon', version = '1.2.1') +bazel_dep(name = 'babylon', version = '1.2.2') bazel_dep(name = 'brpc', version = '1.9.0') bazel_dep(name = 'tcmalloc', version = '0.0.0-20240411-5ed309d') single_version_override(module_name = 'protobuf', version = '25.3.arenastring') diff --git a/example/use-counter-with-bvar/.bazelversion b/example/use-counter-with-bvar/.bazelversion index a8a18875..b26a34e4 100644 --- a/example/use-counter-with-bvar/.bazelversion +++ b/example/use-counter-with-bvar/.bazelversion @@ -1 +1 @@ -7.1.2 +7.2.1 diff --git a/example/use-counter-with-bvar/MODULE.bazel b/example/use-counter-with-bvar/MODULE.bazel index 9f764d30..a35ab872 100644 --- a/example/use-counter-with-bvar/MODULE.bazel +++ b/example/use-counter-with-bvar/MODULE.bazel @@ -1,4 +1,3 @@ -bazel_dep(name = 'babylon', version = '1.2.1') +bazel_dep(name = 'babylon', version = '1.2.2') bazel_dep(name = 'brpc', version = '1.9.0') bazel_dep(name = 'tcmalloc', version = '0.0.0-20240411-5ed309d') -single_version_override(module_name = 'protobuf', version = '25.3') diff --git a/example/use-with-bthread/.bazelrc b/example/use-with-bthread/.bazelrc index abc99e77..4ac1d61f 100644 --- a/example/use-with-bthread/.bazelrc +++ b/example/use-with-bthread/.bazelrc @@ -1,5 +1,5 @@ +common --registry=https://bcr.bazel.build common --registry=https://baidu.github.io/babylon/registry common --registry=https://raw.githubusercontent.com/bazelboost/registry/main -common --registry=https://bcr.bazel.build build --cxxopt=-std=c++17 diff --git a/example/use-with-bthread/.bazelversion b/example/use-with-bthread/.bazelversion index a8a18875..b26a34e4 100644 --- a/example/use-with-bthread/.bazelversion +++ b/example/use-with-bthread/.bazelversion @@ -1 +1 @@ -7.1.2 +7.2.1 diff --git a/example/use-with-bthread/MODULE.bazel b/example/use-with-bthread/MODULE.bazel index 6414f7dc..92943a5e 100644 --- a/example/use-with-bthread/MODULE.bazel +++ b/example/use-with-bthread/MODULE.bazel @@ -1,2 +1,2 @@ -bazel_dep(name = 'babylon', version = '1.2.1') +bazel_dep(name = 'babylon', version = '1.2.2') bazel_dep(name = 'brpc', version = '1.9.0')