From 40e0bc2aca18996ddcfe559b77066575d51c59ff Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 11:28:32 +0800 Subject: [PATCH 01/15] ci: Add github-action workflow. --- .github/workflows/go.yml | 69 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000000..ba5611b7dd --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,69 @@ +name: CI + +on: + push: + branches: "master" + pull_request: + branches: "*" + +jobs: + + build: + name: ubuntu-latest ${{ matrix.config.go_version }} + runs-on: ubuntu + strategy: + matrix: + config: + - go_version: 1.13 + steps: + + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.config.go_version }} + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + go get -v -t -d ./... + if [ -f Gopkg.toml ]; then + curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + dep ensure + fi + + - name: License Check + run: | + go fmt ./... && [[ -z `git status -s` ]] + sh before_validate_license.sh + chmod u+x /tmp/tools/license/license-header-checker + /tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]] + + - name: Test + run: | + chmod u+x before_ut.sh && ./before_ut.sh + go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic + chmod +x integrate_test.sh && ./integrate_test.sh + + - name: Coverage + run: bash <(curl -s https://codecov.io/bash) + + - name: DingDing Notify Action + # You may pin to the exact commit or the version. + # uses: zcong1993/actions-ding@2a68a4d06ed966d2e5c28178e7187c107ec57862 + uses: zcong1993/actions-ding@v3.0.1 + with: + # DingDing bot token + dingToken: ff0ff436a50c2aa41b7e3c92a0b1f68c302bd9873370aea0da59579ff23461f5 + # Post Body to send + body: | + { + "msgtype": "markdown", + "markdown": { + "text": "Github Actions", + "title": "- name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }}" + } + } From 81fb6b2658aa9885ec524547154f13a0f37d88b6 Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 11:30:28 +0800 Subject: [PATCH 02/15] fix: GithubAction Syntax problom. --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ba5611b7dd..e9de8c6581 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -10,7 +10,7 @@ jobs: build: name: ubuntu-latest ${{ matrix.config.go_version }} - runs-on: ubuntu + runs-on: ubuntu-latest strategy: matrix: config: From 6b97c1f061504103faba717802c53400441903f6 Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 11:55:21 +0800 Subject: [PATCH 03/15] Update go.yml --- .github/workflows/go.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e9de8c6581..a309226773 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -46,6 +46,7 @@ jobs: run: | chmod u+x before_ut.sh && ./before_ut.sh go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic + export COMPOSE_INTERACTIVE_NO_CLI=1 chmod +x integrate_test.sh && ./integrate_test.sh - name: Coverage From f68bcc2cb6e80c3f87181c9712e6c38d8595d283 Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 12:15:04 +0800 Subject: [PATCH 04/15] fix: Cannot use TTY in GithubActions. --- integrate_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrate_test.sh b/integrate_test.sh index c9c2f23b5b..deccda756a 100644 --- a/integrate_test.sh +++ b/integrate_test.sh @@ -63,4 +63,4 @@ docker build . -t ci-consumer --build-arg PR_ORIGIN_REPO=${TRAVIS_PULL_REQUEST_ cd ${ROOT_DIR} # run provider # check consumer status -docker run -it --network host ci-consumer +docker run -i --network host ci-consumer From 4b8ce017d4fbd289c7a3a17ef87f5dc22e90d226 Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 12:50:08 +0800 Subject: [PATCH 05/15] test: skip test of part in workflow. --- .github/workflows/go.yml | 43 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a309226773..c18fe490a8 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -27,30 +27,30 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v2 - - name: Get dependencies - run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure - fi +# - name: Get dependencies +# run: | +# go get -v -t -d ./... +# if [ -f Gopkg.toml ]; then +# curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh +# dep ensure +# fi - - name: License Check - run: | - go fmt ./... && [[ -z `git status -s` ]] - sh before_validate_license.sh - chmod u+x /tmp/tools/license/license-header-checker - /tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]] +# - name: License Check +# run: | +# go fmt ./... && [[ -z `git status -s` ]] +# sh before_validate_license.sh +# chmod u+x /tmp/tools/license/license-header-checker +# /tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]] - - name: Test - run: | - chmod u+x before_ut.sh && ./before_ut.sh - go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic - export COMPOSE_INTERACTIVE_NO_CLI=1 - chmod +x integrate_test.sh && ./integrate_test.sh +# - name: Test +# run: | +# chmod u+x before_ut.sh && ./before_ut.sh +# go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic +# export COMPOSE_INTERACTIVE_NO_CLI=1 +# chmod +x integrate_test.sh && ./integrate_test.sh - - name: Coverage - run: bash <(curl -s https://codecov.io/bash) +# - name: Coverage +# run: bash <(curl -s https://codecov.io/bash) - name: DingDing Notify Action # You may pin to the exact commit or the version. @@ -59,6 +59,7 @@ jobs: with: # DingDing bot token dingToken: ff0ff436a50c2aa41b7e3c92a0b1f68c302bd9873370aea0da59579ff23461f5 + secret: SECffddfca8e454f238ec528532cada0e0d4d9c7f514bc171bdeddc39d164da6145 # Post Body to send body: | { From e9599f5c02fe82131783a3fc141a17ecebc836e4 Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 12:54:22 +0800 Subject: [PATCH 06/15] fix: workflow syntax problom. --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c18fe490a8..0c58af08ef 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -65,7 +65,7 @@ jobs: { "msgtype": "markdown", "markdown": { - "text": "Github Actions", - "title": "- name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }}" + "title": "Github Actions", + "text": "- name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }}" } } From e1b6b23b0993d4be9e9ab3dd477a6420e6aae7bb Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 13:06:51 +0800 Subject: [PATCH 07/15] ci: Improve DingTalk reminder information. --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0c58af08ef..635a5ebf1a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -52,7 +52,7 @@ jobs: # - name: Coverage # run: bash <(curl -s https://codecov.io/bash) - - name: DingDing Notify Action + - name: DingTalk Message Notify # You may pin to the exact commit or the version. # uses: zcong1993/actions-ding@2a68a4d06ed966d2e5c28178e7187c107ec57862 uses: zcong1993/actions-ding@v3.0.1 @@ -66,6 +66,6 @@ jobs: "msgtype": "markdown", "markdown": { "title": "Github Actions", - "text": "- name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }}" + "text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }} \n - sha: ${{ github.sha }} \n - ref: ${{ github.ref }} \n - status: ${{ job.status }} \n - environment: ${{ os }}" } } From cd68a252ba4095bd8817fc8052b1abf21077ca68 Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 13:09:17 +0800 Subject: [PATCH 08/15] fix: workflow syntax problom. --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 635a5ebf1a..abc8cff36c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -66,6 +66,6 @@ jobs: "msgtype": "markdown", "markdown": { "title": "Github Actions", - "text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }} \n - sha: ${{ github.sha }} \n - ref: ${{ github.ref }} \n - status: ${{ job.status }} \n - environment: ${{ os }}" + "text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }} \n - sha: ${{ github.sha }} \n - ref: ${{ github.ref }} \n - status: ${{ job.status }} \n - environment: ${{ runner.os }}" } } From 9dade1574fc7b73aa43766c688b306269c5898c2 Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 13:25:23 +0800 Subject: [PATCH 09/15] ci: Remove sha message. --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index abc8cff36c..d96ec65fb1 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -66,6 +66,6 @@ jobs: "msgtype": "markdown", "markdown": { "title": "Github Actions", - "text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }} \n - sha: ${{ github.sha }} \n - ref: ${{ github.ref }} \n - status: ${{ job.status }} \n - environment: ${{ runner.os }}" + "text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }} \n - ref: ${{ github.ref }} \n - status: ${{ job.status }} \n - environment: ${{ runner.os }}" } } From 5912f600e54e5ea73c635c6f8cb317b0799265ce Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 13:29:04 +0800 Subject: [PATCH 10/15] ci: Add `develop` branch trigger CI. --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d96ec65fb1..ffbe42d8cb 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: "master" + branches: ["master", "develop"] pull_request: branches: "*" From 66d429de1816f964bcadc334ad989a80e4cb9828 Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 13:57:26 +0800 Subject: [PATCH 11/15] ci --- .github/workflows/go.yml | 46 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ffbe42d8cb..738e6f0493 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -27,30 +27,30 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v2 -# - name: Get dependencies -# run: | -# go get -v -t -d ./... -# if [ -f Gopkg.toml ]; then -# curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh -# dep ensure -# fi + - name: Get dependencies + run: | + go get -v -t -d ./... + if [ -f Gopkg.toml ]; then + curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + dep ensure + fi -# - name: License Check -# run: | -# go fmt ./... && [[ -z `git status -s` ]] -# sh before_validate_license.sh -# chmod u+x /tmp/tools/license/license-header-checker -# /tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]] + - name: License Check + run: | + go fmt ./... && [[ -z `git status -s` ]] + sh before_validate_license.sh + chmod u+x /tmp/tools/license/license-header-checker + /tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]] -# - name: Test -# run: | -# chmod u+x before_ut.sh && ./before_ut.sh -# go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic -# export COMPOSE_INTERACTIVE_NO_CLI=1 -# chmod +x integrate_test.sh && ./integrate_test.sh + - name: Test + run: | + chmod u+x before_ut.sh && ./before_ut.sh + go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic + export COMPOSE_INTERACTIVE_NO_CLI=1 + chmod +x integrate_test.sh && ./integrate_test.sh -# - name: Coverage -# run: bash <(curl -s https://codecov.io/bash) + - name: Coverage + run: bash <(curl -s https://codecov.io/bash) - name: DingTalk Message Notify # You may pin to the exact commit or the version. @@ -58,8 +58,8 @@ jobs: uses: zcong1993/actions-ding@v3.0.1 with: # DingDing bot token - dingToken: ff0ff436a50c2aa41b7e3c92a0b1f68c302bd9873370aea0da59579ff23461f5 - secret: SECffddfca8e454f238ec528532cada0e0d4d9c7f514bc171bdeddc39d164da6145 + dingToken: 6374f1bf8d4f23cde81d4a4b8c1f0bc98cc92b5151ca938ab938d3d7f4230fc4 + secret: SECa98677289194bb0e5caec3051301d06515750ff1bd2f932a4704298afb2e0ae6 # Post Body to send body: | { From 8d91ba53810de858c7c88a317c75f2b859166ab6 Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 17:17:42 +0800 Subject: [PATCH 12/15] Update go.yml --- .github/workflows/go.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 738e6f0493..ccce52f57a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -56,6 +56,7 @@ jobs: # You may pin to the exact commit or the version. # uses: zcong1993/actions-ding@2a68a4d06ed966d2e5c28178e7187c107ec57862 uses: zcong1993/actions-ding@v3.0.1 + if: ${{ github.repository == "apache/dubbo-go" }} with: # DingDing bot token dingToken: 6374f1bf8d4f23cde81d4a4b8c1f0bc98cc92b5151ca938ab938d3d7f4230fc4 From 3f38d24475c43a407a74fe125d995425bb728e42 Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 17:19:16 +0800 Subject: [PATCH 13/15] fix: workflow syntax problom. --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ccce52f57a..f8465b2f92 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -56,7 +56,7 @@ jobs: # You may pin to the exact commit or the version. # uses: zcong1993/actions-ding@2a68a4d06ed966d2e5c28178e7187c107ec57862 uses: zcong1993/actions-ding@v3.0.1 - if: ${{ github.repository == "apache/dubbo-go" }} + if: ${{ github.repository == 'apache/dubbo-go' }} with: # DingDing bot token dingToken: 6374f1bf8d4f23cde81d4a4b8c1f0bc98cc92b5151ca938ab938d3d7f4230fc4 From d3f5f8448a69dd64fb8d8f7c26735edb89216096 Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 17:33:04 +0800 Subject: [PATCH 14/15] feat: Cache build dependencies on GithubActnions. --- .github/workflows/go.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f8465b2f92..0551702f57 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -27,6 +27,14 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v2 + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Get dependencies run: | go get -v -t -d ./... From a40f153e2dc7953846833eff93a7b6b11a16215e Mon Sep 17 00:00:00 2001 From: Psnail <42728902+sdttttt@users.noreply.github.com> Date: Fri, 11 Sep 2020 17:44:03 +0800 Subject: [PATCH 15/15] ci: Delete redundant code. --- .github/workflows/go.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0551702f57..c90f6cbe8d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -54,7 +54,6 @@ jobs: run: | chmod u+x before_ut.sh && ./before_ut.sh go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic - export COMPOSE_INTERACTIVE_NO_CLI=1 chmod +x integrate_test.sh && ./integrate_test.sh - name: Coverage