feat:use CODECOV_TOKEN Implement codecov #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Example workflow for Codecov | |
on: [push] | |
jobs: | |
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: ${{ env.GO_VERSION }} | |
- name: Run tests and generate coverage report | |
run: | | |
go test -coverprofile=coverage.out -gcflags="all=-l -N" $(go list ./...) -short | |
- 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 |