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

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


The following commit(s) were added to refs/heads/develop by this push:
     new 8e43eff  modify ci
     new 6e14115  Merge pull request #388 from ztelur/ci-improve
8e43eff is described below

commit 8e43eff52d1f952b4f47b239d034c94a9124ea05
Author: randy <[email protected]>
AuthorDate: Sun Apr 3 17:16:31 2022 +0800

    modify ci
    
    modify ci
---
 .github/workflows/github-actions.yml | 23 ++++++++++++++--
 start_integrate_test.sh              | 51 ++++++++++++++++++++----------------
 2 files changed, 49 insertions(+), 25 deletions(-)

diff --git a/.github/workflows/github-actions.yml 
b/.github/workflows/github-actions.yml
index f692417..3e6ec44 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -61,6 +61,7 @@ jobs:
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
+
       - name: Cache dependencies
         uses: actions/cache@v2
         with:
@@ -72,6 +73,17 @@ jobs:
           restore-keys: |
             ${{ runner.os }}-go-
 
+      - name: Merge base
+        if: ${{ github.event_name == 'pull_request' }}
+        run: |
+          git fetch origin develop
+          git checkout -b develop origin/develop
+          git remote add devrepo 
https://github.com/${{github.event.pull_request.head.repo.full_name}}.git
+          git fetch devrepo ${{github.event.pull_request.head.sha}}
+          git config --global user.email "[email protected]"
+          git config --global user.name "robot"
+          git merge ${{github.event.pull_request.head.sha}}
+
       - name: Get dependencies
         run: |
           if [ -f Gopkg.toml ]; then
@@ -97,9 +109,16 @@ jobs:
           chmod u+x before_ut.sh && ./before_ut.sh
           go mod vendor && go test ./pkg/... -gcflags=-l 
-coverprofile=coverage.txt -covermode=atomic
       # integration test
-      - name: Integration Test
+      # This step only runs when the event type is a pull_request
+      - name: Integrate Test
+        if: ${{ github.event_name == 'pull_request' }}
+        run: |
+          chmod +x start_integrate_test.sh && [[ -n 
"${{github.event.pull_request.head.repo.full_name}}" ]] && [[ -n 
"${{github.event.pull_request.head.sha}}" ]] && [[ -n "${{github.base_ref}}" ]] 
&& ./start_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 start_integrate_test.sh && chmod +x integrate_test.sh && 
./start_integrate_test.sh
+          chmod +x start_integrate_test.sh && ./start_integrate_test.sh 
$GITHUB_REPOSITORY $GITHUB_SHA $GITHUB_BASE_REF
 
       - name: Coverage
         run: bash <(curl -s https://codecov.io/bash)
diff --git a/start_integrate_test.sh b/start_integrate_test.sh
index 0433ba2..d93b5a5 100755
--- a/start_integrate_test.sh
+++ b/start_integrate_test.sh
@@ -14,27 +14,32 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-array=("samples/dubbogo/simple/body")
-array+=("samples/dubbogo/simple/mix")
-array+=("samples/dubbogo/simple/proxy")
-array+=("samples/dubbogo/simple/query")
-array+=("samples/dubbogo/simple/uri")
-array+=("samples/dubbogo/simple/resolve")
-array+=("samples/dubbogo/simple/registry")
-array+=("samples/dubbogo/simple/triple")
+#!/bin/bash
 
-#
-##http
-array+=("samples/http/grpc")
-array+=("samples/http/simple")
-## grpc proxy
-array+=("samples/grpc")
-
-for((i=0;i<${#array[*]};i++))
-do
-       sh ./integrate_test.sh ${array[i]}
-       result=$?
-       if [ $result -gt 0 ]; then
-    exit $result
-       fi
-done
+set -e
+set -x
+
+echo 'start integrate-test'
+
+# set root workspace
+ROOT_DIR=$(pwd)
+echo "integrate-test root work-space -> ${ROOT_DIR}"
+
+# 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}"
+
+echo "use dubbo-go-samples $3 branch for integration testing"
+git clone -b main https://github.com/dubbo-go-pixiu/samples.git 
integrate_samples && cd integrate_samples
+
+# update dubbo-go to current commit id
+go mod edit -replace=github.com/apache/dubbo-go-pixiu=github.com/"$1"@"$2"
+
+# start integrate test
+./start_integrate_test.sh
\ No newline at end of file

Reply via email to