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

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


The following commit(s) were added to refs/heads/main by this push:
     new 68ac30d6 fix(ci): refactor ci trigger conditions (#1474)
68ac30d6 is described below

commit 68ac30d6c5462db7d515bd306e16a65e64c90107
Author: Jiacai Liu <[email protected]>
AuthorDate: Wed Jan 31 17:50:53 2024 +0800

    fix(ci): refactor ci trigger conditions (#1474)
    
    ## Rationale
    After #1460, horaemeta server src is moved into horaemeta directory, but
    ci trigger condition has not
    updated, which cause unnecessary ci task run for PRs.
    
    ## Detailed Changes
    - Add more strict trigger condition
    - Update build meta script
    
    ## Test Plan
    Pass CI
---
 .github/workflows/ci.yml                     | 24 +++++++++-----------
 .github/workflows/{check.yml => meta-ci.yml} | 26 ++++++++++++++-------
 horaemeta/Makefile                           |  4 +---
 horaemeta/scripts/run-integration-test.sh    | 34 ----------------------------
 integration_tests/Makefile                   |  2 +-
 integration_tests/build_meta.sh              | 10 ++++----
 6 files changed, 37 insertions(+), 63 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1bcb5594..3c71912d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-name: HoraeDB
+name: HoraeDB CI
 
 on:
   merge_group:
@@ -24,19 +24,17 @@ on:
     branches:
       - main
       - dev
-    paths-ignore:
-      - 'docs/**'
-      - 'etc/**'
-      - '**.md'
-      - '.dockerignore'
-      - 'docker/**'
+    paths:
+      - 'src/**'
+      - 'integration_tests/**'
+      - 'Cargo.toml'
+      - '.github/workflows/ci.yml'
   pull_request:
-    paths-ignore:
-      - 'docs/**'
-      - 'etc/**'
-      - '**.md'
-      - '.dockerignore'
-      - 'docker/**'
+    paths:
+      - 'src/**'
+      - 'integration_tests/**'
+      - 'Cargo.toml'
+      - '.github/workflows/ci.yml'
 
 # Common environment variables
 env:
diff --git a/.github/workflows/check.yml b/.github/workflows/meta-ci.yml
similarity index 82%
rename from .github/workflows/check.yml
rename to .github/workflows/meta-ci.yml
index fcebc29b..bb4b9ad1 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/meta-ci.yml
@@ -15,12 +15,23 @@
 # specific language governing permissions and limitations
 # under the License.
 
-name: HoraeMeta
+name: HoraeMeta CI
+
 on:
+  push:
+    branches:
+      - main
+    paths:
+      - 'src/**'
+      - 'integration_tests/**'
+      - 'horaemeta/**'
+      - '.github/workflows/meta-ci.yml'
   pull_request:
-    paths-ignore:
-      - 'docs/**'
-      - '**.md'
+    paths:
+      - 'src/**'
+      - 'integration_tests/**'
+      - 'horaemeta/**'
+      - '.github/workflows/meta-ci.yml'
   workflow_dispatch:
 
 jobs:
@@ -38,7 +49,7 @@ jobs:
         run: |
           make install-tools
           make check
-          
+
   unit-test:
     runs-on: ubuntu-latest
     timeout-minutes: 10
@@ -60,8 +71,7 @@ jobs:
       - uses: actions/setup-go@v3
         with:
           go-version: 1.21.3
-      - working-directory: ./horaemeta
+      - working-directory: ./integration_tests
         run: |
-          make install-tools
           sudo apt install -y protobuf-compiler
-          make integration-test
+          make run
diff --git a/horaemeta/Makefile b/horaemeta/Makefile
index 77d6f240..2eed4211 100644
--- a/horaemeta/Makefile
+++ b/horaemeta/Makefile
@@ -1,6 +1,7 @@
 GO_TOOLS_BIN_PATH := $(shell pwd)/.tools/bin
 PATH := $(GO_TOOLS_BIN_PATH):$(PATH)
 SHELL := env PATH='$(PATH)' GOBIN='$(GO_TOOLS_BIN_PATH)' $(shell which bash)
+ROOT = $(shell pwd)
 
 COMMIT_ID := $(shell git rev-parse HEAD)
 BRANCH_NAME := $(shell git rev-parse --abbrev-ref HEAD)
@@ -28,6 +29,3 @@ test:
 
 build:
        @ go build -ldflags="-X main.commitID=$(COMMIT_ID) -X 
main.branchName=$(BRANCH_NAME) -X main.buildDate=$(BUILD_DATE)" -o 
bin/horaemeta-server ./cmd/horaemeta-server
-
-integration-test: build
-       @ bash ./scripts/run-integration-test.sh
diff --git a/horaemeta/scripts/run-integration-test.sh 
b/horaemeta/scripts/run-integration-test.sh
deleted file mode 100644
index 65eff3e3..00000000
--- a/horaemeta/scripts/run-integration-test.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/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
-# 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.
-
-
-
-
-set -exo
-
-META_BIN_PATH="$(pwd)/bin/horaemeta-server"
-INTEGRATION_TEST_PATH=$(mktemp -d)
-
-# Download HoraeDB Code
-cd $INTEGRATION_TEST_PATH
-git clone --depth 1 https://github.com/apache/incubator-horaedb.git horaedb 
--branch main
-
-# Run integration_test
-cd horaedb/integration_tests
-
-META_BIN_PATH=$META_BIN_PATH make run-cluster
diff --git a/integration_tests/Makefile b/integration_tests/Makefile
index caed90ba..86aeabcd 100644
--- a/integration_tests/Makefile
+++ b/integration_tests/Makefile
@@ -16,7 +16,7 @@ export HORAEDB_STDOUT_FILE ?= /tmp/horaedb-stdout.log
 export HORAEDB_CONFIG_FILE ?= $(ROOT)/../docs/minimal.toml
 
 # Environment variables for cluster
-export HORAEMETA_BINARY_PATH ?= $(ROOT)/horaemeta/horaemeta-server
+export HORAEMETA_BINARY_PATH ?= $(ROOT)/../target/horaemeta-server
 export HORAEMETA_CONFIG_PATH ?= $(ROOT)/config/horaemeta.toml
 export HORAEMETA_STDOUT_FILE ?= /tmp/horaemeta-stdout.log
 export HORAEDB_CONFIG_FILE_0 ?= $(ROOT)/config/horaedb-cluster-0.toml
diff --git a/integration_tests/build_meta.sh b/integration_tests/build_meta.sh
index b56565af..7576ab44 100755
--- a/integration_tests/build_meta.sh
+++ b/integration_tests/build_meta.sh
@@ -4,14 +4,16 @@ set -o errexit
 set -o nounset
 set -o pipefail
 
+SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)
+TARGET="${SCRIPT_DIR}/../target"
+
 META_BIN_PATH=${META_BIN_PATH:-""}
 
 if [[ -z "${META_BIN_PATH}" ]]; then
-    echo "Fetch and install horaemeta-server..."
-    go install -a 
github.com/apache/incubator-horaedb-meta/cmd/horaemeta-server@main
-    META_BIN_PATH="$(go env GOPATH)/bin/horaemeta-server"
+  echo "Build horaemeta-server..."
+  make -C "${SCRIPT_DIR}/../horaemeta" build
+  META_BIN_PATH="${SCRIPT_DIR}/../horaemeta/bin/horaemeta-server"
 fi
 
-TARGET=$(pwd)/horaemeta
 mkdir -p ${TARGET}
 cp ${META_BIN_PATH} ${TARGET}/horaemeta-server


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

Reply via email to