From ae5eb37b38c1604984263ed2fb6803f51d24946f Mon Sep 17 00:00:00 2001 From: Joe Zou Date: Tue, 22 Sep 2020 11:43:28 +0800 Subject: [PATCH] Merge pull request #752 from sdttttt/sdttttt-patch-1 Ftr: Migrate travis Ci to GithubActions --- .github/workflows/go.yml | 79 ++++++++++++++++++++++++++++++++++++++++ integrate_test.sh | 2 +- 2 files changed, 80 insertions(+), 1 deletion(-) 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..c90f6cbe8d --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,79 @@ +name: CI + +on: + push: + branches: ["master", "develop"] + pull_request: + branches: "*" + +jobs: + + build: + name: ubuntu-latest ${{ matrix.config.go_version }} + runs-on: ubuntu-latest + 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: 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 ./... + 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: 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 + if: ${{ github.repository == 'apache/dubbo-go' }} + with: + # DingDing bot token + dingToken: 6374f1bf8d4f23cde81d4a4b8c1f0bc98cc92b5151ca938ab938d3d7f4230fc4 + secret: SECa98677289194bb0e5caec3051301d06515750ff1bd2f932a4704298afb2e0ae6 + # Post Body to send + body: | + { + "msgtype": "markdown", + "markdown": { + "title": "Github Actions", + "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 }}" + } + } 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