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

tanruixiang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-horaedb-proto.git


The following commit(s) were added to refs/heads/main by this push:
     new e79057e  ci: check golang generated and restructure build (#116)
e79057e is described below

commit e79057e097124dc97846ca9ab36891fd5f64b823
Author: tison <[email protected]>
AuthorDate: Thu Dec 21 13:09:18 2023 +0800

    ci: check golang generated and restructure build (#116)
    
    Signed-off-by: tison <[email protected]>
---
 .github/workflows/ci.yml           | 29 ++++++++++++++++++++---------
 .github/workflows/release-rust.yml |  3 +--
 .gitignore                         | 13 ++++++-------
 rust/Cargo.toml => Cargo.toml      |  6 +++---
 Makefile                           | 16 ++++++++++++----
 README.md                          |  2 +-
 rust/build.rs => build.rs          |  0
 golang/gen-go.sh => generate-go.sh | 21 ++++++++++++++-------
 java/src/.gitignore                |  1 +
 rust/protos                        |  1 -
 {rust/src => src}/lib.rs           |  0
 11 files changed, 58 insertions(+), 34 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1e15e7d..3e52b70 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -19,23 +19,34 @@ name: CI
 
 on:
   push:
-    branches:
-      - main
-    paths:
-      - 'protos/**'
+    branches: [ main ]
   pull_request:
-    paths:
-      - 'protos/**'
 
 jobs:
-  formatting-check:
-    name: Formatting Check
+  check:
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@v4
-    - name: Run clang-format style check for Protobuf files
+    - uses: korandoru/hawkeye@v4
+    - name: Check proto files
       uses: jidicula/[email protected]
       with:
         clang-format-version: '13'
         check-path: 'protos'
         fallback-style: 'google'
+    - name: Install Protoc
+      uses: arduino/setup-protoc@v1
+      with:
+        version: "3.20.1"
+        repo-token: ${{ secrets.GITHUB_TOKEN }}
+    - uses: actions/setup-java@v4
+      with:
+        distribution: 'temurin'
+        java-version: '8'
+        cache: maven
+    - name: Ensure Golang generated identical
+      run: make go && git diff --exit-code
+    - name: Ensure Rust crate compiled
+      run: make rust
+    - name: Ensure Java library compiled
+      run: make java
diff --git a/.github/workflows/release-rust.yml 
b/.github/workflows/release-rust.yml
index e1bc661..241b036 100644
--- a/.github/workflows/release-rust.yml
+++ b/.github/workflows/release-rust.yml
@@ -29,8 +29,7 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v4
-      - name: Release horaedbproto
-        working-directory: rust
+      - name: Release Rust crate
         run: cargo publish
         env:
           CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 814f2de..067b7d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,7 @@
-**/target
-.idea/
+.idea
 .env
-**/.DS_Store
-**/.vscode
-src/
-# 
https://doc.rust-lang.org/cargo/faq.html#why-do-binaries-have-cargolock-in-version-control-but-not-libraries
-rust/Cargo.lock
+.DS_Store
+.vscode
+
+target
+Cargo.lock
diff --git a/rust/Cargo.toml b/Cargo.toml
similarity index 93%
rename from rust/Cargo.toml
rename to Cargo.toml
index 707a3ae..b6af5da 100644
--- a/rust/Cargo.toml
+++ b/Cargo.toml
@@ -18,12 +18,12 @@
 [package]
 name = "horaedbproto"
 version = "1.0.24"
-authors = ["HoraeDB Authors"]
 edition = "2021"
-repository = "https://github.com/apache/incubator-horaedb-proto";
 license = "Apache-2.0"
+readme = "README.md"
 description = "Protobuf specs for HoraeDB"
-readme = "../README.md"
+authors = ["HoraeDB Authors <[email protected]>"]
+repository = "https://github.com/apache/incubator-horaedb-proto";
 
 [dependencies]
 tonic = "0.8"
diff --git a/Makefile b/Makefile
index 20cb9a1..d2a2f0e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,16 @@
-default: build
+.PHONY: all go rust java
 
-prepare:
+all: go rust java
+
+dependence:
        go install google.golang.org/protobuf/cmd/[email protected]
        go install google.golang.org/grpc/cmd/[email protected]
 
-build: prepare
-       cd golang && sh gen-go.sh
+go: dependence
+       ./generate-go.sh
+
+rust:
+       cargo build
+
+java:
+       mvn -f java/pom.xml clean install
diff --git a/README.md b/README.md
index ee201f6..9f831f9 100644
--- a/README.md
+++ b/README.md
@@ -48,4 +48,4 @@ As for the Rust projects that depends on this project, 
everything will be genera
 ### Golang
 
 1. Install [Protocol Buffers 
v3.20.1](https://github.com/protocolbuffers/protobuf/releases/tag/v3.20.1) 
compiler.
-2. Execute `make build`.
+2. Execute `make go`.
diff --git a/rust/build.rs b/build.rs
similarity index 100%
rename from rust/build.rs
rename to build.rs
diff --git a/golang/gen-go.sh b/generate-go.sh
similarity index 61%
rename from golang/gen-go.sh
rename to generate-go.sh
index 1b629ae..06544a8 100755
--- a/golang/gen-go.sh
+++ b/generate-go.sh
@@ -1,4 +1,5 @@
 #!/usr/bin/env 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
@@ -16,14 +17,20 @@
 # specific language governing permissions and limitations
 # under the License.
 
-
-
-
 set -ex
 
-GO_PREFIX_PATH=github.com/apache/incubator-horaedb-proto/golang
+ROOT_DIR=$( dirname "$0" )
+GO_DIR="${ROOT_DIR}/golang"
+GO_PREFIX_PATH="${GO_DIR}/github.com/apache/incubator-horaedb-proto/golang"
 
-protoc --proto_path=../protos --go_out=. --go-grpc_out=. 
../protos/cluster.proto ../protos/common.proto ../protos/meta_event.proto 
../protos/meta_service.proto ../protos/meta_storage.proto 
../protos/prometheus.proto ../protos/storage.proto
+protoc --proto_path=./protos --go_out="$GO_DIR" --go-grpc_out="$GO_DIR" \
+    ./protos/cluster.proto \
+    ./protos/common.proto \
+    ./protos/meta_event.proto \
+    ./protos/meta_service.proto \
+    ./protos/meta_storage.proto \
+    ./protos/prometheus.proto \
+    ./protos/storage.proto
 
-rm -rf pkg && mv $GO_PREFIX_PATH/pkg .
-rm -rf github.com
+rm -rf "$GO_DIR/pkg" && mv "$GO_PREFIX_PATH/pkg" "$GO_DIR"
+rm -rf "$GO_DIR/github.com"
diff --git a/java/src/.gitignore b/java/src/.gitignore
new file mode 100644
index 0000000..2a9bbbd
--- /dev/null
+++ b/java/src/.gitignore
@@ -0,0 +1 @@
+*.java
\ No newline at end of file
diff --git a/rust/protos b/rust/protos
deleted file mode 120000
index 3513e23..0000000
--- a/rust/protos
+++ /dev/null
@@ -1 +0,0 @@
-../protos
\ No newline at end of file
diff --git a/rust/src/lib.rs b/src/lib.rs
similarity index 100%
rename from rust/src/lib.rs
rename to src/lib.rs


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to