From 6df3c995f0ee3764f187a2e39ced5b6a8ad274a5 Mon Sep 17 00:00:00 2001 From: gongna1 Date: Tue, 24 Sep 2024 19:09:58 +0800 Subject: [PATCH] feat:use CODECOV_TOKEN Implement codecov --- .github/workflows/codecov.yml | 36 +++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 0951d1d..2f58dcd 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -1,23 +1,35 @@ -name: Codecov +name: Example workflow for Codecov -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] +on: [push] jobs: - code_cov: - runs-on: ubuntu-latest + run: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + env: + OS: ${{ matrix.os }} + GO_VERSION: '1.16' # 选择你需要的 Go 版本 steps: - uses: actions/checkout@v3 - + - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.16' - + go-version: ${{ env.GO_VERSION }} + - name: Run tests and generate coverage report run: | go test -coverprofile=coverage.out -gcflags="all=-l -N" $(go list ./...) -short - - uses: codecov/codecov-action@v3 + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + file: coverage.out + env_vars: OS,GO_VERSION + fail_ci_if_error: true + flags: unittests + name: codecov-umbrella + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true