Skip to content

Commit

Permalink
add example pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
oathdruid committed Jul 1, 2024
1 parent 76686c0 commit 89973b8
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 41 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion example/anyflow/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.2
7.2.1
2 changes: 1 addition & 1 deletion example/anyflow/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bazel_dep(name = 'babylon', version = '1.2.1')
bazel_dep(name = 'babylon', version = '1.2.2')
2 changes: 1 addition & 1 deletion example/depend-use-bzlmod/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.2
7.2.1
2 changes: 1 addition & 1 deletion example/depend-use-bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bazel_dep(name = 'babylon', version = '1.2.1')
bazel_dep(name = 'babylon', version = '1.2.2')
2 changes: 1 addition & 1 deletion example/depend-use-bzlmod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions example/depend-use-cmake-fetch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions example/depend-use-cmake-fetch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
Expand Down
6 changes: 3 additions & 3 deletions example/depend-use-cmake-find/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions example/depend-use-cmake-subdir/build.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion example/depend-use-workspace/.bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build --cxxopt=-std=c++17
build --enable_bzlmod=false --cxxopt=-std=c++17
2 changes: 1 addition & 1 deletion example/depend-use-workspace/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.2
7.2.1
6 changes: 3 additions & 3 deletions example/depend-use-workspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
)
```

Expand Down
20 changes: 9 additions & 11 deletions example/depend-use-workspace/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,26 @@ 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',
)
################################################################################

################################################################################
# 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()
Expand Down
2 changes: 1 addition & 1 deletion example/depend-use-workspace/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
set -ex

bazel run --enable_bzlmod=false example
bazel run example
2 changes: 1 addition & 1 deletion example/use-arena-with-brpc/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion example/use-arena-with-brpc/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.2
7.2.1
2 changes: 1 addition & 1 deletion example/use-arena-with-brpc/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -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')
2 changes: 1 addition & 1 deletion example/use-counter-with-bvar/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.2
7.2.1
3 changes: 1 addition & 2 deletions example/use-counter-with-bvar/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -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')
2 changes: 1 addition & 1 deletion example/use-with-bthread/.bazelrc
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion example/use-with-bthread/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.2
7.2.1
2 changes: 1 addition & 1 deletion example/use-with-bthread/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit 89973b8

Please sign in to comment.