Skip to content

Commit

Permalink
Merge pull request #1921 from GoogleCloudPlatform/coverage
Browse files Browse the repository at this point in the history
Implement code coverage checks
  • Loading branch information
kislaykishore authored May 16, 2024
2 parents 6516028 + d2b6a74 commit 8312967
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
codecov:
strict_yaml_branch: master
coverage:
round: down
precision: 2
status:
changes: true
project:
default:
target: 60%
threshold: 0%
flags:
- "unittest"
patch:
default:
target: 80%
threshold: 0%
flags:
- "unittest"

31 changes: 31 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Code Coverage
on: [push, pull_request]
jobs:
codecov:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.x
cache: false

- name: Download dependencies
run: go mod download

- name: Test and coverage
run: CGO_ENABLED=0 go test -p 1 -covermode=atomic -v -coverprofile=coverage.out ./...

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.3.1
timeout-minutes: 5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests

0 comments on commit 8312967

Please sign in to comment.