-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,27 @@ | ||
name: Example workflow for Codecov | ||
name: Go | ||
|
||
on: [push] | ||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
run: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
env: | ||
OS: ${{ matrix.os }} | ||
GO_VERSION: '1.16' # 选择你需要的 Go 版本 | ||
code_cov: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
go-version: '1.16' | ||
|
||
- 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 |