You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by li...@apache.org on 2021/10/04 09:36:31 UTC

[rocketmq-apis] branch main updated: Add CI assets (#2)

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

lizhanhui pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/rocketmq-apis.git


The following commit(s) were added to refs/heads/main by this push:
     new 74308c1  Add CI assets (#2)
74308c1 is described below

commit 74308c1ea7799e33f0fa734a3fffd94c69557180
Author: Zhanhui Li <li...@apache.org>
AuthorDate: Mon Oct 4 17:36:27 2021 +0800

    Add CI assets (#2)
    
    * Add CI assets
---
 .bazelrc                   | 27 ++++++++++++++++++
 .github/workflows/main.yml | 39 ++++++++++++++++++++++++++
 .gitignore                 |  4 +++
 BUILD.bazel                | 70 ++++++++++++++++++++++++++++++++++++++++++++++
 WORKSPACE                  | 67 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 207 insertions(+)

diff --git a/.bazelrc b/.bazelrc
new file mode 100644
index 0000000..21901dc
--- /dev/null
+++ b/.bazelrc
@@ -0,0 +1,27 @@
+# Bazel doesn't need more than 200MB of memory for local build based on memory profiling:
+# https://docs.bazel.build/versions/master/skylark/performance.html#memory-profiling
+# The default JVM max heapsize is 1/4 of physical memory up to 32GB which could be large
+# enough to consume all memory constrained by cgroup in large host.
+# Limiting JVM heapsize here to let it do GC more when approaching the limit to
+# leave room for compiler/linker.
+# The number 2G is chosen heuristically to both support large VM and small VM with RBE.
+# Startup options cannot be selected via config.
+startup --host_jvm_args=-Xmx4g
+
+build --host_force_python=PY3
+build --host_javabase=@bazel_tools//tools/jdk:remote_jdk11
+build --javabase=@bazel_tools//tools/jdk:remote_jdk11
+
+# https://docs.bazel.build/versions/main/command-line-reference.html#flag--enable_platform_specific_config
+# If true, Bazel picks up host-OS-specific config lines from bazelrc files. For example, if the host OS is Linux and
+# you run bazel build, Bazel picks up lines starting with build:linux. Supported OS identifiers are linux, macos, 
+# windows, freebsd, and openbsd. Enabling this flag is equivalent to using --config=linux on Linux, 
+# --config=windows on Windows, etc.
+build --enable_platform_specific_config
+
+# Pass PATH, CC, CXX and LLVM_CONFIG variables from the environment.
+build --action_env=CC
+build --action_env=CXX
+build --action_env=LD_LIBRARY_PATH
+build --action_env=LLVM_CONFIG
+build --action_env=PATH
\ No newline at end of file
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..7d88236
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,39 @@
+# This is a basic workflow to help you get started with Actions
+
+name: CI
+
+# Controls when the workflow will run
+on:
+  # Triggers the workflow on push or pull request events but only for the master branch
+  push:
+    branches: [ main ]
+  pull_request:
+    branches: [ main ]
+
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+
+# A workflow run is made up of one or more jobs that can run sequentially or in parallel
+jobs:
+  # This workflow contains a single job called "build"
+  build:
+    # The type of runner that the job will run on
+    runs-on: ubuntu-latest
+
+    # Steps represent a sequence of tasks that will be executed as part of the job
+    steps:
+      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
+      - uses: actions/checkout@v2
+      
+      - name: Setup Bazel
+        uses: abhinavsingh/setup-bazel@v3
+        with:
+          version: 4.1.0
+      - name: Use Bazel (Windows only)
+        if: matrix.os == 'windows'
+        run: ./bazel.exe -h
+      - name: Use Bazel
+        if: matrix.os != 'windows'
+        run: bazel -h
+      - name: Compile All Targets
+        run: bazel build //...
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..20af2af
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+bazel-bin
+bazel-out
+bazel-rocketmq-apis
+bazel-testlogs
\ No newline at end of file
diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 0000000..edbd1a5
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,70 @@
+load("@rules_proto//proto:defs.bzl", "proto_library")
+load("@com_google_googleapis_imports//:imports.bzl",
+    "csharp_gapic_assembly_pkg",
+    "csharp_gapic_library",
+    "csharp_grpc_library",
+    "csharp_proto_library",
+    "go_gapic_assembly_pkg",
+    "go_gapic_library",
+    "go_proto_library",
+    "go_test",
+    "java_gapic_assembly_gradle_pkg",
+    "java_gapic_library",
+    "java_gapic_test",
+    "java_grpc_library",
+    "java_proto_library",
+    "nodejs_gapic_assembly_pkg",
+    "nodejs_gapic_library",
+    "php_gapic_assembly_pkg",
+    "php_gapic_library",
+    "php_grpc_library",
+    "php_proto_library",
+    "proto_library_with_info",
+    "py_gapic_assembly_pkg",
+    "py_gapic_library",
+    "ruby_cloud_gapic_library",
+    "ruby_gapic_assembly_pkg",
+    "ruby_grpc_library",
+    "ruby_proto_library",
+)
+load("@rules_proto_grpc//cpp:defs.bzl", "cpp_grpc_library")
+
+package(default_visibility = ["//visibility:public"])
+
+proto_library(
+    name = "rocketmq_v1_proto",
+    srcs = glob(["apache/rocketmq/v1/*.proto"]),
+    deps = [
+        "@com_google_protobuf//:empty_proto",
+        "@com_google_protobuf//:field_mask_proto",
+        "@com_google_protobuf//:duration_proto",
+        "@com_google_protobuf//:timestamp_proto",
+        "@com_google_googleapis//google/rpc:code_proto",
+        "@com_google_googleapis//google/rpc:error_details_proto",
+        "@com_google_googleapis//google/rpc:status_proto",
+    ]
+)
+
+java_proto_library(
+    name = "rocketmq_v1_java_library",
+    deps = [
+        ":rocketmq_v1_proto",
+    ]
+)
+
+java_grpc_library(
+    name = "rocketmq_v1_java_grpc",
+    srcs = [":rocketmq_v1_proto"],
+    deps = [":rocketmq_v1_java_library"],
+)
+
+cpp_grpc_library(
+    name = "rocketmq_v1_cpp_grpc_library",
+    protos = [
+        ":rocketmq_v1_proto",
+        "@com_google_googleapis//google/rpc:code_proto",
+        "@com_google_googleapis//google/rpc:error_details_proto",
+        "@com_google_googleapis//google/rpc:status_proto",
+    ],
+    visibility = ["//visibility:public"]
+)
\ No newline at end of file
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000..4dbba16
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,67 @@
+workspace(name = "org_apache_rocketmq_apis")
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+    name = "rules_proto",
+    sha256 = "66bfdf8782796239d3875d37e7de19b1d94301e8972b3cbd2446b332429b4df1",
+    strip_prefix = "rules_proto-4.0.0",
+    urls = [
+        "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
+        "https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
+    ],
+)
+load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
+rules_proto_dependencies()
+rules_proto_toolchains()
+
+RULES_JVM_EXTERNAL_TAG = "a1eaa5b82103c8b54154c9a37c4901b663aadc07"
+RULES_JVM_EXTERNAL_SHA = "e1aefed247ba2d9ccc405e3f673ec81e3dde5a0a43fa59ccdb2df53a55ef8684"
+http_archive(
+    name = "rules_jvm_external",
+    strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
+    sha256 = RULES_JVM_EXTERNAL_SHA,
+    url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
+)
+load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
+rules_jvm_external_deps()
+load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")
+rules_jvm_external_setup()
+
+http_archive(
+    name = "com_google_googleapis",
+    sha256 = "e89f15d54b0ddab0cd41d18cb2299e5447db704e2b05ff141cb1769170671466",
+    urls = [
+        "https://github.com/googleapis/googleapis/archive/af7fb72df59a814221b123a4d1acb3f6c3e6cc95.zip",
+    ],
+    strip_prefix = "googleapis-af7fb72df59a814221b123a4d1acb3f6c3e6cc95"
+)
+load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
+switched_rules_by_language(
+    name = "com_google_googleapis_imports",
+ #   cc = True,
+ #   csharp = True,
+ #   gapic = True,
+ #   go = True,
+ #   grpc = True,
+    java = True,
+ #   nodejs = True,
+ #   php = True,
+ #   python = True,
+ #   ruby = True,
+)
+
+http_archive(
+    name = "rules_proto_grpc",
+    sha256 = "7954abbb6898830cd10ac9714fbcacf092299fda00ed2baf781172f545120419",
+    strip_prefix = "rules_proto_grpc-3.1.1",
+    urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/3.1.1.tar.gz"],
+)
+load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_toolchains", "rules_proto_grpc_repos")
+rules_proto_grpc_toolchains()
+rules_proto_grpc_repos()
+load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps", "grpc_test_only_deps")
+grpc_deps()
+grpc_test_only_deps()
+load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
+grpc_extra_deps()
\ No newline at end of file