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

alexstocks pushed a commit to branch 1.5
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/1.5 by this push:
     new bdd488f  Ftr: Adding integration tests using dubbo-go-samples (#1278)
bdd488f is described below

commit bdd488f68d5f57a21e940042f29025631e47414e
Author: EnableAsync <[email protected]>
AuthorDate: Sun Jun 27 20:53:46 2021 +0800

    Ftr: Adding integration tests using dubbo-go-samples (#1278)
    
    * Ftr: Adding integration tests using dubbo-go-samples
    
    Fix: github-actions.yml
    
    Fix: integrate_test.sh
    
    Fix: github-actions.yml
    
    * Fix: integrate_test.sh
    
    * Fix: integrate_test.sh
---
 .github/workflows/github-actions.yml      | 10 ++++-
 integrate_test.sh                         | 69 +++++++++++++++++--------------
 test/integrate/dubbo/go-server/Dockerfile |  2 +-
 3 files changed, 47 insertions(+), 34 deletions(-)

diff --git a/.github/workflows/github-actions.yml 
b/.github/workflows/github-actions.yml
index 865b60e..475258b 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -69,9 +69,17 @@ jobs:
       run: |
         make verify
 
+      # This step only runs when the event type is a pull_request
     - name: Integrate Test
+      if: ${{ github.event_name == 'pull_request' }}
       run: |
-        chmod +x integrate_test.sh && ./integrate_test.sh 
${{github.event.pull_request.head.repo.full_name}} 
${{github.event.pull_request.head.sha}}
+        chmod +x integrate_test.sh && [[ -n 
"${{github.event.pull_request.head.repo.full_name}}" ]] && [[ -n 
"${{github.event.pull_request.head.sha}}" ]] && [[ -n "${{github.base_ref}}" ]] 
&& ./integrate_test.sh ${{github.event.pull_request.head.repo.full_name}} 
${{github.event.pull_request.head.sha}} ${{github.base_ref}}
+
+      # This step only runs when the event type is a push
+    - name: Integrate Test
+      if: ${{ github.event_name == 'push' }}
+      run: |
+        chmod +x integrate_test.sh && ./integrate_test.sh $GITHUB_REPOSITORY 
$GITHUB_SHA $GITHUB_BASE_REF
 
     - name: Post Coverage
       run: bash <(curl -s https://codecov.io/bash)
diff --git a/integrate_test.sh b/integrate_test.sh
index e1bbc8c..d9bf297 100644
--- a/integrate_test.sh
+++ b/integrate_test.sh
@@ -25,42 +25,47 @@ echo 'start integrate-test'
 ROOT_DIR=$(pwd)
 echo "integrate-test root work-space -> ${ROOT_DIR}"
 
-# show all travis-env
-echo "travis current commit id  -> $2"
-echo "travis pull request branch -> ${GITHUB_REF}"
-echo "travis pull request slug -> ${GITHUB_REPOSITORY}"
-echo "travis pull request repo slug -> ${GITHUB_REPOSITORY}"
-echo "travis pull request actor -> ${GITHUB_ACTOR}"
-echo "travis pull request repo param -> $1"
+# show all github-env
+echo "github current commit id  -> $2"
+echo "github pull request branch -> ${GITHUB_REF}"
+echo "github pull request slug -> ${GITHUB_REPOSITORY}"
+echo "github pull request repo slug -> ${GITHUB_REPOSITORY}"
+echo "github pull request actor -> ${GITHUB_ACTOR}"
+echo "github pull request repo param -> $1"
+echo "github pull request base branch -> $3"
+echo "github pull request head branch -> ${GITHUB_HEAD_REF}"
 
+samples_testing() {
+    echo "use dubbo-go-samples $3 branch for integration testing"
+    git clone -b "$3" https://github.com/apache/dubbo-go-samples.git samples 
&& cd samples
 
-# #start etcd registry  insecure listen in [:]:2379
-# docker run -d --network host k8s.gcr.io/etcd:3.3.10 etcd
-# echo "etcdv3 listen in [:]2379"
+    # update dubbo-go to current commit id
+    go mod edit -replace=github.com/apache/dubbo-go=github.com/"$1"@"$2"
 
-# #start consul registry insecure listen in [:]:8500
-# docker run -d --network host consul
-# echo "consul listen in [:]8500"
+    # start integrate test
+    chmod +x integrate_test.sh
+    ./start_integrate_test.sh
+}
 
-# #start nacos registry insecure listen in [:]:8848
-# docker run -d --network host nacos/nacos-server:latest
-# echo "ncacos listen in [:]8848"
+local_testing() {
+    echo "use test/integrate/dubbo for integration testing"
+    # default use zk as registry
+    #start zookeeper registry insecure listen in [:]:2181
+    docker run -d --network host zookeeper
+    echo "zookeeper listen in [:]2181"
 
-# default use zk as registry
-#start zookeeper registry insecure listen in [:]:2181
-docker run -d --network host zookeeper
-echo "zookeeper listen in [:]2181"
+    # build go-server image
+    cd ./test/integrate/dubbo/go-server
 
-# build go-server image
-cd ./test/integrate/dubbo/go-server
-docker build . -t  ci-provider --build-arg PR_ORIGIN_REPO=$1 --build-arg 
PR_ORIGIN_COMMITID=$2
-cd ${ROOT_DIR}
-docker run -d --network host ci-provider
+    docker build . -t  ci-provider --build-arg PR_ORIGIN_REPO=$1 --build-arg 
PR_ORIGIN_COMMITID=$2
+    cd "${ROOT_DIR}"
+    docker run -d --network host ci-provider
+}
 
-# build go-client image
-cd ./test/integrate/dubbo/go-client
-docker build . -t  ci-consumer --build-arg PR_ORIGIN_REPO=$1 --build-arg 
PR_ORIGIN_COMMITID=$2
-cd ${ROOT_DIR}
-# run provider
-# check consumer status
-docker run -i --network host ci-consumer
+# check dubbo-go-samples corresponding branch
+res=$(git ls-remote --heads https://github.com/apache/dubbo-go-samples.git 
"$3" | wc -l)
+if [ "$res" -eq "1" ]; then
+    samples_testing "$@"
+else
+    local_testing "$@"
+fi
diff --git a/test/integrate/dubbo/go-server/Dockerfile 
b/test/integrate/dubbo/go-server/Dockerfile
index f72648d..a6b75a2 100644
--- a/test/integrate/dubbo/go-server/Dockerfile
+++ b/test/integrate/dubbo/go-server/Dockerfile
@@ -28,7 +28,7 @@ ARG PR_ORIGIN_COMMITID
 ADD . /go/src/github.com/apache/dubbo-go/test/integrate/dubbo/go-server
 # update dubbo-go to current commit id
 RUN test ${PR_ORIGIN_REPO} && echo "github.com/apache/dubbo-go will be replace 
to github.com/${PR_ORIGIN_REPO}@${PR_ORIGIN_COMMITID}" || echo 'go get 
github.com/apache/dubbo-go@develop'
-RUN test ${PR_ORIGIN_REPO} && go mod edit  
-replace=github.com/apache/dubbo-go=github.com/${PR_ORIGIN_REPO}@${PR_ORIGIN_COMMITID}
 || go get -u github.com/apache/dubbo-go@develop
+RUN test ${PR_ORIGIN_REPO} && go mod edit 
-replace=github.com/apache/dubbo-go=github.com/${PR_ORIGIN_REPO}@${PR_ORIGIN_COMMITID}
 || go get -u github.com/apache/dubbo-go@develop
 
 ENV GO111MODULE on
 

Reply via email to