From 6879275b8894ee27caf6986bf0cb4a9881ea093b Mon Sep 17 00:00:00 2001 From: zhanglei28 Date: Wed, 19 Feb 2025 10:47:08 +0800 Subject: [PATCH] fix codecov --- .github/workflows/test.yml | 53 +++++++++++--------------------------- .gitignore | 3 ++- README.md | 3 +-- 3 files changed, 18 insertions(+), 41 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ba52da95..24bfa35f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,4 @@ +name: Test and coverage on: push: branches: @@ -9,11 +10,7 @@ on: - master - dev -name: build -env: - GOPATH: /home/runner/go - GO111MODULE: on jobs: testing: @@ -24,50 +21,30 @@ jobs: runs-on: ${{ matrix.platform }} steps: - name: Checkout code - uses: actions/checkout@v3 - + uses: actions/checkout@v4 - name: Install Go if: success() - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - + - name: Gather dependencies + run: go mod tidy - name: Run tests - run: | - echo "GOPATH >>> $GOPATH" - echo "pwd >>> $PWD" - mkdir -p $GOPATH/src/github.com/weibocom/ - cp -R ../motan-go $GOPATH/src/github.com/weibocom/ - cd $GOPATH/src/github.com/weibocom/motan-go - go mod tidy - go test -v -race $(go list ./... | grep -v main) + run: go test -v -race $(go list ./... | grep -v main) codecov: name: codecov runs-on: ubuntu-latest steps: - - name: Set up Go 1.16 - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - name: Set up Go version to stable + uses: actions/setup-go@v5 with: - go-version: 1.16.x - id: go - - - name: Checkout code - uses: actions/checkout@v3 - + go-version: 'stable' + - name: Gather dependencies + run: go mod tidy - name: Generate coverage report - run: | - echo "GOPATH >>> $GOPATH" - echo "pwd >>> $PWD" - mkdir -p $GOPATH/src/github.com/weibocom/ - cp -R ../motan-go $GOPATH/src/github.com/weibocom/ - cd $GOPATH/src/github.com/weibocom/motan-go - go mod tidy - go test -v -race -coverprofile=coverage.txt -covermode=atomic $(go list ./... | grep -v main) - + run: go test -v -race -coverprofile=coverage.txt -covermode=atomic $(go list ./... | grep -v main) - name: Upload coverage report - uses: codecov/codecov-action@v1.0.2 + uses: codecov/codecov-action@v5 with: - token: "282c293b-ab38-4ea6-8518-b44f78df02eb" - file: ./coverage.txt - flags: unittests - name: codecov-umbrella \ No newline at end of file + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index f203523c..c734550e 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,5 @@ main/magent* log/log.test* go.sum agent_runtime -test/ \ No newline at end of file +test/ +coverage.txt \ No newline at end of file diff --git a/README.md b/README.md index 3d4956f9..49a9d9ec 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Motan-go [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/weibocom/motan/blob/master/LICENSE) -[![Build Status](https://img.shields.io/travis/weibocom/motan-go/master.svg?label=Build)](https://travis-ci.org/weibocom/motan-go) -[![codecov](https://codecov.io/gh/weibocom/motan-go/branch/master/graph/badge.svg)](https://codecov.io/gh/weibocom/motan-go) +[![codecov](https://codecov.io/gh/weibocom/motan-go/branch/master/graph/badge.svg?token=2s9DFOt9Y4)](https://codecov.io/gh/weibocom/motan-go) [![GoDoc](https://godoc.org/github.com/weibocom/motan-go?status.svg&style=flat)](https://godoc.org/github.com/weibocom/motan-go) [![Go Report Card](https://goreportcard.com/badge/github.com/weibocom/motan-go)](https://goreportcard.com/report/github.com/weibocom/motan-go)